summaryrefslogtreecommitdiff
path: root/src/include/smp.h
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@bpcspace.com>2021-09-21 10:50:33 -0500
committerBrett Weiland <brett_weiland@bpcspace.com>2021-09-21 10:50:33 -0500
commitcf7cd8be60c254b44b444c97dcb238d7cf3afd4c (patch)
treee86fe62827f4dbc5f1b6b74cf7bd89c78e797711 /src/include/smp.h
parent907fb823bf8329066b1bcff60ea6c4faa54a3642 (diff)
palloc smp safe (testing required, NOT pfree)
Diffstat (limited to 'src/include/smp.h')
-rw-r--r--src/include/smp.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/include/smp.h b/src/include/smp.h
index f4e3aa8..e331036 100644
--- a/src/include/smp.h
+++ b/src/include/smp.h
@@ -1,7 +1,10 @@
#ifndef SMP_INCLUDED
#define SMP_INCLUDED
#include <stdint.h>
-void smp_boot();
+#include <stdbool.h>
+#include <cpuid.h>
+#include <printf.h>
+void smp_prepare();
extern uint8_t corecount;
static inline void lock(uint8_t *lock) {
@@ -18,9 +21,25 @@ static inline void unlock(uint8_t *lock) {
asm("lock andb [%0], 0"::"r"(lock));
}
-static inline void waitup(uint8_t *loto) {
+static inline bool get_set_mutex(uint16_t *mutex) {
+ bool ret;
+ asm("lock bts %1, 0\n"
+ "jc .mutex_taken\n"
+ "mov %0, 0\n"
+ "jmp .done\n"
+ ".mutex_taken:\n"
+ "mov %0, 1\n"
+ ".done:\n"
+ :"=r"(ret)
+ :"m"(*mutex));
+ return ret;
}
+
+
+//THIS IS ONLY UNTIL WE GET MULTITHREADING SET UP
+uint8_t get_coreid();
+
#define CREATE_LOTO(name)
#endif