summaryrefslogtreecommitdiff
path: root/kernel/x86.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/x86.c')
-rw-r--r--kernel/x86.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/kernel/x86.c b/kernel/x86.c
index 7775ab7..15236a3 100644
--- a/kernel/x86.c
+++ b/kernel/x86.c
@@ -4,6 +4,10 @@
#include "lib/int/stdint.h"
#include "lib/logger/log.h"
+//
+// suffix (b, w, l, q for byte, word, dword, and qword).
+//
+
extern volatile uint64_t task_system_clock; // from task.c
void sleep(int i)
@@ -139,25 +143,19 @@ void x86_flush_tlb(uint32_t addr)
}
//xchg
-volatile uint8_t x86_xchg(volatile uint8_t *addr, uint8_t val)
+uint8_t x86_xchg(uint8_t *addr, uint8_t val)
{
- uint8_t result;
- // test. because asm does not work !?
- uint8_t oldval=*addr;
- *addr=val;
- return oldval;
-
+ uint8_t result;
-
// The + in "+m" denotes a read-modify-write operand.
- asm volatile("lock xchg %0, %1" :
+ asm volatile("lock xchgb %0, %1" :
"+m" (*addr), "=a" (result) :
"1" (val) :
"cc");
//log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"xchg val:%d with addr:0x%08X : result: %d",val,addr,result);
-//
+
return result;
}