fix: added arc4random_buf stub
this fixes linking error on aarch64 also _seralPutchar was made public to prevent mangling
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
let kUARTBaseAddress: UInt = 0x09000000 // TODO: Make it dynamic by parsion DTB
|
||||
|
||||
@_cdecl("putchar")
|
||||
@discardableResult func _serialPutchar(_ char: Int32) -> Int32 {
|
||||
@discardableResult
|
||||
public func _serialPutchar(_ char: Int32) -> Int32 {
|
||||
let uartFR: UInt = kUARTBaseAddress + 0x18// TXFF -- TRansmit FIFO Full for PL011 is 5 bit of FR reg (0x18)
|
||||
|
||||
while (mmio_read32(uartFR) & (1 << 5)) != 0 {
|
||||
@@ -16,4 +17,4 @@ public func kprint(_ message: StaticString) {
|
||||
for i in 0..<message.utf8CodeUnitCount {
|
||||
_serialPutchar(Int32(message.utf8Start[i]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,3 +34,9 @@ int posix_memalign(void** ptr, unsigned long align, unsigned long size) {
|
||||
}
|
||||
|
||||
void free(void* ptr) { (void)ptr; }
|
||||
|
||||
// Swift stdlib uses arc4random_buf for Hasher seed — stub with zeroes in bare-metal
|
||||
void arc4random_buf(void* buf, unsigned long nbytes) {
|
||||
unsigned char* b = (unsigned char*)buf;
|
||||
while (nbytes--) *b++ = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user