diff options
Diffstat (limited to 'libc/inc')
-rw-r--r-- | libc/inc/mem.h | 10 | ||||
-rw-r--r-- | libc/inc/sys.h | 9 |
2 files changed, 9 insertions, 10 deletions
diff --git a/libc/inc/mem.h b/libc/inc/mem.h index 4750efb..a01c9a2 100644 --- a/libc/inc/mem.h +++ b/libc/inc/mem.h @@ -10,14 +10,14 @@ void free_debug(void *ptr, const char *file, int line, const char *func, const c #define malloc(size) malloc_debug(size, __FILE__, __LINE__, __func__, #size) #define free(ptr) free_debug(ptr, __FILE__, __LINE__, __func__, #ptr) -// Huh +/* void *_malloc(u32 size); */ +/* void _free(void *ptr); */ +/* #define malloc(size) _malloc(size) */ +/* #define free(ptr) _free(ptr) */ + #ifdef kernel void heap_init(u32 start); -/* void *malloc(u32 size); */ -/* void free(void *ptr); */ #elif defined(userspace) -/* void *malloc(u32 size); */ -/* void free(void *ptr); */ #else #error "No lib target specified. Please use -Dkernel or -Duserspace" #endif diff --git a/libc/inc/sys.h b/libc/inc/sys.h index 3145432..c846b4b 100644 --- a/libc/inc/sys.h +++ b/libc/inc/sys.h @@ -98,14 +98,13 @@ int sysv(enum sys num, ...); #define event_unregister(id) sys1(SYS_UNREGISTER, (int)(id)) #define msg_send(pid, type, msg) sys3(SYS_SEND, (int)(pid), (int)(type), (int)(msg)) -#define msg_receive() (struct message *)sys0(SYS_RECEIVE) +#define msg_receive(buf) (struct message *)sys1(SYS_RECEIVE, (int)(buf)) #define getpid() (int)sys0(SYS_GETPID) -static inline struct message *msg_receive_loop() +static inline struct message *msg_receive_loop(struct message *buf) { - struct message *msg; - while (!(msg = msg_receive())) + while (!msg_receive(&buf)) yield(); - return msg; + return buf; } // Simple read wrapper |