57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
#include <stdint.h>
|
|
#include <socks/init.h>
|
|
#include <socks/clock.h>
|
|
#include <socks/panic.h>
|
|
#include <socks/test.h>
|
|
#include <socks/printk.h>
|
|
#include <socks/kext.h>
|
|
#include <socks/object.h>
|
|
#include <socks/sched.h>
|
|
#include <socks/machine/init.h>
|
|
#include <socks/cpu.h>
|
|
|
|
extern unsigned long get_rflags(void);
|
|
|
|
extern char __pstart[], __pend[];
|
|
|
|
void print_kernel_banner(void)
|
|
{
|
|
printk("Socks kernel version " BUILD_ID);
|
|
}
|
|
|
|
void background_thread(void)
|
|
{
|
|
printk("background_thread() running on processor %u", this_cpu());
|
|
while (1) {
|
|
milli_sleep(500);
|
|
printk("tock");
|
|
}
|
|
}
|
|
|
|
void kernel_init(uintptr_t arg)
|
|
{
|
|
ml_init(arg);
|
|
|
|
kern_status_t status;
|
|
status = scan_internal_kexts();
|
|
if (status != KERN_OK) {
|
|
panic("scan_internal_kexts() failed with code %s", kern_status_string(status));
|
|
}
|
|
|
|
status = bring_internal_kexts_online();
|
|
if (status != KERN_OK) {
|
|
panic("bring_internal_kexts_online() failed with code %s", kern_status_string(status));
|
|
}
|
|
|
|
printk("kernel_init() running on processor %u", this_cpu());
|
|
|
|
run_all_tests();
|
|
|
|
create_kernel_thread(background_thread);
|
|
|
|
while (1) {
|
|
milli_sleep(1000);
|
|
printk("tick");
|
|
}
|
|
}
|