summaryrefslogtreecommitdiff
path: root/kernel/x86.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-09-03 15:26:19 +0200
committerMichal Idziorek <m.i@gmx.at>2014-09-03 15:26:19 +0200
commite5e674724ec527c45efaa1622d0e9a1618757ca3 (patch)
treed7bd7a4d6c9b155b6828171b0a80be5b5bac79cd /kernel/x86.c
parentfcfa7a7537ed76a63896ec5a9aa39cfc989d761c (diff)
system clock
Diffstat (limited to 'kernel/x86.c')
-rw-r--r--kernel/x86.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/kernel/x86.c b/kernel/x86.c
index 0b6a448..782baec 100644
--- a/kernel/x86.c
+++ b/kernel/x86.c
@@ -1,14 +1,23 @@
+#define FOOLOS_MODULE_NAME "x86"
+
#include "x86.h"
+#include "lib/int/stdint.h"
+#include "lib/logger/log.h"
+
+extern volatile uint64_t task_system_clock; // from task.c
-//TODO!!!
void sleep(int i)
{
- i*=1000000;
- for(;i>0;i--)
- {
-
- }
+ volatile uint64_t clock=task_system_clock;
+
+// while(clock+i>task_system_clock)
+// {
+// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"It is %d but I will sleep until %d...",task_system_clock,clock+i);
+ for(int j=0;j<i;j++)asm("hlt");
+
+ // }
}
+
// disable interrupts
void x86_int_disable()
{
@@ -22,7 +31,6 @@ void x86_int_enable()
}
// get control registers (cr0-cr4)
-
uint32_t x86_get_cr0()
{
uint32_t cr;