ARMv8: Correct timer calls.
authorLukas Humbel <lukas.humbel@inf.ethz.ch>
Tue, 18 Apr 2017 09:01:04 +0000 (11:01 +0200)
committerLukas Humbel <lukas.humbel@inf.ethz.ch>
Tue, 18 Apr 2017 09:01:04 +0000 (11:01 +0200)
Timer interrupts trigger now reasonably often (each 80ms)

Signed-off-by: Lukas Humbel <lukas.humbel@inf.ethz.ch>

kernel/arch/armv8/exn.c
kernel/arch/armv8/timers.c

index 80d9343..80da981 100644 (file)
@@ -257,7 +257,7 @@ void handle_irq(arch_registers_state_t* save_area, uintptr_t fault_pc,
 
     if(irq == 30 || irq==29) {
         gicv3_ack_irq(irq);
-        timer_reset(kernel_timeslice);
+        timer_reset(CONFIG_TIMESLICE);
         dispatch(schedule());
     }
     else {
index 2f8535b..2cad518 100644 (file)
@@ -52,8 +52,10 @@ void timers_init(int timeslice)
     armv8_generic_timer_compare_val_el0_wr(NULL, 0xffffffffffffffff);
 
 
+    /* systime_frequency is ticks per milisecond, while timer_get_frequency is in HZ */
     systime_frequency = timer_get_frequency() / 1000;
-    /* The timeslice is in ms, so divide by 1000. */
+
+    /* The timeslice is in ms */
     kernel_timeslice = ns_to_systime(timeslice * 1000000);
 
     printf("System counter frequency is %uHz.\n", timer_get_frequency());
@@ -66,8 +68,7 @@ void timers_init(int timeslice)
     while(timer_is_set())
         ;
 
-    armv8_generic_timer_timer_val_el0_wr(NULL, kernel_timeslice);
-
+    timer_reset(timeslice);
 
     uint32_t PMCR_EL0  = 0;