2022-12-21 08:29:33 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <socks/init.h>
|
2023-04-30 21:09:36 +01:00
|
|
|
#include <socks/clock.h>
|
2023-04-09 16:43:03 +01:00
|
|
|
#include <socks/panic.h>
|
2023-02-26 10:05:39 +00:00
|
|
|
#include <socks/test.h>
|
2023-02-03 20:51:23 +00:00
|
|
|
#include <socks/printk.h>
|
2023-04-08 09:27:21 +01:00
|
|
|
#include <socks/kext.h>
|
2023-03-06 11:08:02 +00:00
|
|
|
#include <socks/object.h>
|
2023-03-06 11:08:26 +00:00
|
|
|
#include <socks/sched.h>
|
2022-12-21 08:29:33 +00:00
|
|
|
#include <socks/machine/init.h>
|
2023-03-18 19:35:00 +00:00
|
|
|
#include <socks/cpu.h>
|
2023-02-04 19:03:45 +00:00
|
|
|
|
|
|
|
|
extern unsigned long get_rflags(void);
|
2022-12-21 08:29:33 +00:00
|
|
|
|
2023-02-05 10:50:13 +00:00
|
|
|
extern char __pstart[], __pend[];
|
|
|
|
|
|
2023-02-04 19:19:48 +00:00
|
|
|
void print_kernel_banner(void)
|
|
|
|
|
{
|
|
|
|
|
printk("Socks kernel version " BUILD_ID);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-21 08:29:33 +00:00
|
|
|
void kernel_init(uintptr_t arg)
|
|
|
|
|
{
|
2023-02-03 20:24:27 +00:00
|
|
|
ml_init(arg);
|
2023-02-26 10:05:39 +00:00
|
|
|
|
2023-04-09 16:43:03 +01:00
|
|
|
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));
|
|
|
|
|
}
|
2023-04-08 09:27:21 +01:00
|
|
|
|
2023-03-18 19:35:00 +00:00
|
|
|
printk("kernel_init() running on processor %u", this_cpu());
|
|
|
|
|
|
2023-02-26 10:05:39 +00:00
|
|
|
run_all_tests();
|
2023-03-18 19:35:00 +00:00
|
|
|
|
2023-03-19 20:36:36 +00:00
|
|
|
while (1) {
|
2023-04-30 21:09:36 +01:00
|
|
|
schedule_timeout(HZ);
|
|
|
|
|
printk("tick");
|
2023-03-19 20:36:36 +00:00
|
|
|
}
|
2022-12-21 08:29:33 +00:00
|
|
|
}
|