diff options
author | Marvin Borner | 2021-04-02 23:26:28 +0200 |
---|---|---|
committer | Marvin Borner | 2021-04-02 23:26:28 +0200 |
commit | ce98400f8a9ebd4e62e76b9e292b7598d0d66cc0 (patch) | |
tree | 823f06c2c325ead611863eeb3ac974c1ae562878 /kernel/drivers/timer.c | |
parent | fe468b476d567b6aa0695a030c408ccf46278c7d (diff) |
Added kernel section clear/protect after init
This is a huge security improvement as it prevents potential exploits
of using or modifying internal kernel functions or data.
Diffstat (limited to 'kernel/drivers/timer.c')
-rw-r--r-- | kernel/drivers/timer.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/drivers/timer.c b/kernel/drivers/timer.c index 8887279..2a7ca2a 100644 --- a/kernel/drivers/timer.c +++ b/kernel/drivers/timer.c @@ -7,9 +7,9 @@ #include <timer.h> static u32 timer_ticks = 0; -static u8 call_scheduler = 0; +PROTECTED static u8 call_scheduler = 0; -static void timer_phase(int hz) +CLEAR static void timer_phase(int hz) { int divisor = 3579545 / 3 / hz; outb(0x43, 0x36); // 01 10 11 0b // CTR, RW, MODE, BCD @@ -38,12 +38,12 @@ void timer_wait(u32 ticks) { u32 eticks = timer_ticks + ticks; while (timer_ticks < eticks) { - __asm__ volatile("sti//hlt//cli"); + __asm__ volatile("sti\nhlt\ncli"); } } // Install timer handler into IRQ0 -void timer_install(void) +CLEAR void timer_install(void) { /* hpet_install(10000); // TODO: Find optimal femtosecond period */ /* if (!hpet) */ @@ -51,13 +51,13 @@ void timer_install(void) irq_install_handler(0, timer_handler); } -void scheduler_enable(void) +CLEAR void scheduler_enable(void) { call_scheduler = 1; irq_install_handler(0, timer_handler); } -void scheduler_disable(void) +CLEAR void scheduler_disable(void) { call_scheduler = 0; irq_install_handler(0, timer_handler); |