[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH] Libc: p()/v() in Makros umgewandelt, die noch eine Barrier beinhalten
* Libc: p()/v() in Makros umgewandelt, die noch eine Barrier beinhalten,
die eigentlichen Funktionen wurden in syscall_p/v umbenannt.
Signed-off-by: Antoine Kaufmann <toni@xxxxxxxxxx>
---
src/kernel/src/init.c | 4 ++--
src/kernel2/src/pv.c | 4 ++--
src/lib/stdlibc/liballoc.c | 8 ++++----
src/modules/include/syscall.h | 8 ++++++--
src/modules/lib/syscalls/pv.c | 4 ++--
5 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/kernel/src/init.c b/src/kernel/src/init.c
index 58309ca..f8fd58d 100644
--- a/src/kernel/src/init.c
+++ b/src/kernel/src/init.c
@@ -176,5 +176,5 @@ __attribute__((noreturn)) void panic(char * message, ...)
}
}
-void p(void) {}
-void v(void) {}
+void syscall_p(void) {}
+void syscall_v(void) {}
diff --git a/src/kernel2/src/pv.c b/src/kernel2/src/pv.c
index fe79fe1..780c352 100644
--- a/src/kernel2/src/pv.c
+++ b/src/kernel2/src/pv.c
@@ -1,4 +1,4 @@
// Das hier ist ein gemeiner Hack, damit es in den Locking-Funktionen von
// liballoc keine nicht-aufgelösten Symbole gibt.
-void __attribute__((weak)) p(void) {}
-void __attribute__((weak)) v(void) {}
+void __attribute__((weak)) syscall_p(void) {}
+void __attribute__((weak)) syscall_v(void) {}
diff --git a/src/lib/stdlibc/liballoc.c b/src/lib/stdlibc/liballoc.c
index c02892f..da125b3 100644
--- a/src/lib/stdlibc/liballoc.c
+++ b/src/lib/stdlibc/liballoc.c
@@ -8,8 +8,8 @@
#define PREFIX(func) func
extern void* mem_allocate(dword size, dword flags);
-extern void p(void);
-extern void v(void);
+extern void syscall_p(void);
+extern void syscall_v(void);
extern void mem_free(void* address, dword size);
/** Durand's Amazing Super Duper Memory functions. */
@@ -114,14 +114,14 @@ static lock_t la_lock = 0;
static int liballoc_lock(void)
{
//lock(&la_lock);
- p();
+ syscall_p();
return 0;
}
static int liballoc_unlock(void)
{
//unlock(&la_lock);
- v();
+ syscall_v();
return 0;
}
diff --git a/src/modules/include/syscall.h b/src/modules/include/syscall.h
index 6bb3593..325e11c 100644
--- a/src/modules/include/syscall.h
+++ b/src/modules/include/syscall.h
@@ -65,8 +65,12 @@ bool release_ports(dword port, dword length);
void yield(void);
void wait_for_rpc(void);
-void p(void);
-void v(void);
+void syscall_p(void);
+void syscall_v(void);
+
+#define p() do { asm volatile (""); syscall_p(); } while (0)
+#define v() do { asm volatile (""); syscall_v(); } while (0)
+
void set_rpc_handler(void (*rpc_handler)(void));
void add_intr_handler(dword intr);
diff --git a/src/modules/lib/syscalls/pv.c b/src/modules/lib/syscalls/pv.c
index 98ab630..e8c425b 100644
--- a/src/modules/lib/syscalls/pv.c
+++ b/src/modules/lib/syscalls/pv.c
@@ -1,6 +1,6 @@
#include "syscall.h"
-void p()
+void syscall_p()
{
asm(
"mov %0, %%eax;"
@@ -8,7 +8,7 @@ void p()
: : "i" (SYSCALL_PM_P) : "eax");
}
-void v()
+void syscall_v()
{
asm(
"mov %0, %%eax;"
--
1.6.3.3