23 lines
803 B
Swift
23 lines
803 B
Swift
@_cdecl("kmain")
|
|
public func kernelMain(_ bootInfo: UInt) {
|
|
// Bootinfo offsets: fb starts at 64, then base(8), baseSize(8), width(8), height(8)
|
|
let fbBase = UnsafePointer<UInt>(bitPattern: bootInfo &+ 64)!.pointee
|
|
let width = UnsafePointer<UInt64>(bitPattern: bootInfo &+ 80)!.pointee
|
|
let height = UnsafePointer<UInt64>(bitPattern: bootInfo &+ 88)!.pointee
|
|
|
|
let pixels = UnsafeMutablePointer<UInt32>(bitPattern: fbBase)!
|
|
let total = Int(width) &* Int(height)
|
|
let stripe = total / 5
|
|
|
|
var i = 0
|
|
while i < total {
|
|
let s = i / stripe
|
|
let color: UInt32
|
|
if s == 0 || s >= 4 { color = 0x5BCEFA }
|
|
else if s == 2 { color = 0xFFFFFF }
|
|
else { color = 0xF5A7B8 }
|
|
pixels[i] = color
|
|
i &+= 1
|
|
}
|
|
}
|