summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/hal/obj.c2
-rw-r--r--arch/x86_64/hal/paging.c8
-rw-r--r--arch/x86_64/lock.c25
-rw-r--r--arch/x86_64/lock.h11
-rw-r--r--arch/x86_64/main.c3
5 files changed, 10 insertions, 39 deletions
diff --git a/arch/x86_64/hal/obj.c b/arch/x86_64/hal/obj.c
index 75cb0c0..110351c 100644
--- a/arch/x86_64/hal/obj.c
+++ b/arch/x86_64/hal/obj.c
@@ -1,5 +1,5 @@
#include "obj.h"
-#include "arch/x86_64/lock.h"
+#include "sys/lock.h"
#include "lib/printf.h"
#include "paging.h"
#include "hal/obj.h"
diff --git a/arch/x86_64/hal/paging.c b/arch/x86_64/hal/paging.c
index a0d6ca9..1587c62 100644
--- a/arch/x86_64/hal/paging.c
+++ b/arch/x86_64/hal/paging.c
@@ -28,6 +28,14 @@ phys_tovirt(uintptr_t phys)
return (void*)(phys | IDENT_VIRT_BASE);
}
+physaddr_t
+phys_fromvirt(virtaddr_t virt)
+{
+ if(virt < IDENT_VIRT_BASE) return 0;
+ if(virt > KERNEL_VIRT_BASE) return KPTR_TOPHYS(virt);
+ return virt & ~IDENT_VIRT_BASE;
+}
+
uintptr_t
paging_get_pml4(void)
{
diff --git a/arch/x86_64/lock.c b/arch/x86_64/lock.c
deleted file mode 100644
index a34cee6..0000000
--- a/arch/x86_64/lock.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "lock.h"
-
-extern int _kernel_panic_unlock;
-
-void
-take_mutex(atomic_flag *lock)
-{
- if(_kernel_panic_unlock) return;
- while(atomic_flag_test_and_set(lock)) {
- __builtin_ia32_pause();
- }
-}
-
-int
-try_take_mutex(atomic_flag *lock)
-{
- if(_kernel_panic_unlock) return 1;
- return atomic_flag_test_and_set(lock);
-}
-
-void
-release_mutex(atomic_flag *lock)
-{
- atomic_flag_clear(lock);
-}
diff --git a/arch/x86_64/lock.h b/arch/x86_64/lock.h
deleted file mode 100644
index 3592ea1..0000000
--- a/arch/x86_64/lock.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _JOVE_x86_64_LOCK_H
-#define _JOVE_x86_64_LOCK_H 1
-
-#include <stdatomic.h>
-
-void take_mutex(atomic_flag *lock);
-int try_take_mutex(atomic_flag *lock);
-
-void release_mutex(atomic_flag *lock);
-
-#endif
diff --git a/arch/x86_64/main.c b/arch/x86_64/main.c
index 92f9fe1..6e2fcb8 100644
--- a/arch/x86_64/main.c
+++ b/arch/x86_64/main.c
@@ -38,6 +38,7 @@ kernel_entry(void)
serial_com_init();
smp_init_bsp();
+ mem_setup_regions();
initrd_setup();
fb_init();
@@ -45,8 +46,6 @@ kernel_entry(void)
cmdline_print();
- mem_setup_untyped();
-
extern void processing_setup(void*);
processing_setup(kernel_process_entry);
hcf();