Files
ksOS/Kernel/Source/kernel.swift
T
sonya f3819a5450 Added bridging header for swift
c structures are now exposed to swift using a bridging header.
it is possible to access bootinfo using the structure (as oppossed to doing bytesfifts blind)
tested on aarch64 apple.
please test on other systems
2026-04-20 16:33:41 +09:00

21 lines
565 B
Swift

@_cdecl("kmain")
public func kernelMain(_ bootInfo: UnsafeMutablePointer<Bootinfo>) {
let fb = bootInfo.pointee.framebuffer
let pixels = fb.base!
let width = Int(fb.width)
let height = Int(fb.height)
let total = width * 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
}
}