Skip to content

Commit

Permalink
setup: make timers and keyboard initialization optional
Browse files Browse the repository at this point in the history
By default keyboard and timers are not initialized.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Feb 9, 2021
1 parent 844bd1b commit 62f8600
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions common/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
bool opt_debug = false;
bool_cmd("debug", opt_debug);

bool opt_keyboard = false;
bool_cmd("keyboard", opt_keyboard);

bool opt_pit = false;
bool_cmd("pit", opt_pit);

bool opt_apic_timer = false;
bool_cmd("apic_timer", opt_apic_timer);

io_port_t com_ports[2] = {COM1_PORT, COM2_PORT};

static unsigned bsp_cpu_id = 0;
Expand Down Expand Up @@ -202,11 +211,8 @@ void __noreturn __text_init kernel_start(uint32_t multiboot_magic,

/* Setup final pagetables */
init_pagetables();

write_cr3(cr3.paddr);

write_sp(get_free_pages_top(PAGE_ORDER_2M, GFP_KERNEL));

if (opt_debug)
dump_pagetables();

Expand Down Expand Up @@ -234,11 +240,14 @@ void __noreturn __text_init kernel_start(uint32_t multiboot_magic,
uart_input_init(get_bsp_cpu_id());

/* Initialize timers */
init_pit(get_bsp_cpu_id());
init_apic_timer();
if (opt_pit)
init_pit(get_bsp_cpu_id());
if (opt_apic_timer)
init_apic_timer();

/* Initialize keyboard */
init_keyboard(get_bsp_cpu_id());
if (opt_keyboard)
init_keyboard(get_bsp_cpu_id());

/* Jump from .text.init section to .text */
asm volatile("push %0; ret" ::"r"(&kernel_main));
Expand Down

0 comments on commit 62f8600

Please sign in to comment.