From 606b7dc226cb51077c016a8ea5fa862ac6ce1db4 Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Fri, 18 Feb 2022 01:31:03 +0000 Subject: bug fixes - needed an atomic_load() when getting the count in pic8253_nanoseconds_elapsed() - i was deleting half the bits of the outgoing task's stack in cpu_task.S (oops) - updated .gdbint. TODO: automate laoding section offsets correctly --- kc/core/pit8253.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kc/core/pit8253.c') diff --git a/kc/core/pit8253.c b/kc/core/pit8253.c index 4728020..6f6256a 100644 --- a/kc/core/pit8253.c +++ b/kc/core/pit8253.c @@ -21,7 +21,7 @@ static void pit8253_set_divisor(uint16_t divisor); -static atomic_uint_fast64_t count = 0; +static volatile atomic_uint_fast64_t count = 0; static uint16_t divisor = 0; const struct timer_source pit8253_timer_source = @@ -82,7 +82,7 @@ uint32_t pit8253_get_frequency(void) uint64_t pit8253_nanoseconds_elapsed(void) { - return pit8253_nanoseconds_delta() * count; + return pit8253_nanoseconds_delta() * atomic_load(&count); } uint64_t pit8253_nanoseconds_delta(void) -- cgit v1.3.1-1-g115d