72 lines
1.3 KiB
C
72 lines
1.3 KiB
C
#include <socks/arg.h>
|
|
#include <socks/clock.h>
|
|
#include <socks/cpu.h>
|
|
#include <socks/device.h>
|
|
#include <socks/init.h>
|
|
#include <socks/input.h>
|
|
#include <socks/kext.h>
|
|
#include <socks/libc/stdio.h>
|
|
#include <socks/machine/init.h>
|
|
#include <socks/object.h>
|
|
#include <socks/panic.h>
|
|
#include <socks/printk.h>
|
|
#include <socks/sched.h>
|
|
#include <socks/test.h>
|
|
#include <socks/tty.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef KEXT_NET_DOORSTUCK_SOCKS_FBCON
|
|
#include <socks/fbcon.h>
|
|
#endif
|
|
|
|
extern unsigned long get_rflags(void);
|
|
|
|
extern char __pstart[], __pend[];
|
|
|
|
void print_kernel_banner(void)
|
|
{
|
|
printk("Socks kernel version " BUILD_ID);
|
|
}
|
|
|
|
static void hang(void)
|
|
{
|
|
while (1) {
|
|
printk("%d: tick", this_cpu());
|
|
milli_sleep(2000);
|
|
}
|
|
}
|
|
|
|
void background_thread(void)
|
|
{
|
|
printk("background_thread() running on processor %u", this_cpu());
|
|
milli_sleep(1000);
|
|
|
|
while (1) {
|
|
printk("%d: tock", this_cpu());
|
|
milli_sleep(2000);
|
|
}
|
|
}
|
|
|
|
static void putchar(char c)
|
|
{
|
|
unsigned long flags;
|
|
struct queue *consoles = get_consoles(&flags);
|
|
queue_foreach(struct console, con, consoles, c_list)
|
|
{
|
|
console_write(con, &c, 1);
|
|
}
|
|
|
|
put_consoles(consoles, flags);
|
|
}
|
|
|
|
void kernel_init(uintptr_t arg)
|
|
{
|
|
ml_init(arg);
|
|
|
|
printk("kernel_init() running on processor %u", this_cpu());
|
|
|
|
create_kernel_thread(background_thread);
|
|
|
|
hang();
|
|
}
|