aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-02 16:07:28 -0800
committerChristian Cunningham <cc@localhost>2022-01-02 16:07:28 -0800
commit8823cb198dff5ef086fb70da93d1134423e8198b (patch)
tree892b3d08ce83e070dce5f3b403e7fdef4e3eb00f
parent059f08cb73ef2b1631f2c89f8c524e27888f6ba5 (diff)
Fixed mutex pointer type
-rw-r--r--src/sys/core.c2
-rw-r--r--src/sys/timer.c5
-rw-r--r--src/util/mutex.h2
3 files changed, 5 insertions, 4 deletions
diff --git a/src/sys/core.c b/src/sys/core.c
index ebf50a0..079fc78 100644
--- a/src/sys/core.c
+++ b/src/sys/core.c
@@ -105,7 +105,7 @@ void postinit(void)
write_cstring(&g_Drawer, os_info_v, 0x00FFFF);
write_string(&g_Drawer, " #");
if (lock_mutex(&exe_cnt_m, SYS_PID) == 0) {
- write_10(&g_Drawer, *(exe_cnt_m.addr));
+ write_10(&g_Drawer, *((unsigned long*)exe_cnt_m.addr));
release_mutex(&exe_cnt_m, SYS_PID);
}
diff --git a/src/sys/timer.c b/src/sys/timer.c
index 207ea09..c3ae53b 100644
--- a/src/sys/timer.c
+++ b/src/sys/timer.c
@@ -26,12 +26,13 @@ void c_timer(void)
// Lock the execution counter
if (lock_mutex(&exe_cnt_m, SCHED_PID) == 0) {
- *(exe_cnt_m.addr) += 1;
+ unsigned long* counter = (unsigned long*)exe_cnt_m.addr;
+ *counter += 1;
write_cstring(&g_Drawer, "DendritOS", 0xFF0000);
write_cstring(&g_Drawer, " v", 0x00FFFF);
write_cstring(&g_Drawer, os_info_v, 0x00FFFF);
write_string(&g_Drawer, " #");
- write_10(&g_Drawer, *(exe_cnt_m.addr));
+ write_10(&g_Drawer, *((unsigned long*)exe_cnt_m.addr));
release_mutex(&exe_cnt_m, SCHED_PID);
}
diff --git a/src/util/mutex.h b/src/util/mutex.h
index f8178a2..283be53 100644
--- a/src/util/mutex.h
+++ b/src/util/mutex.h
@@ -6,7 +6,7 @@
#define SCHED_PID 2
struct Mutex {
- unsigned long* addr;
+ void* addr;
unsigned long pid;
} __attribute__((packed, aligned(4)));;