aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/inc
diff options
context:
space:
mode:
authorMarvin Borner2021-04-02 16:17:50 +0200
committerMarvin Borner2021-04-02 16:17:50 +0200
commitb62b9d1f33a4911feb9f318ece0c1565f27abf8d (patch)
treeaecea9f7b5bf651b584911cf90c61258b9564556 /libs/libc/inc
parentd055495f3dbb62f74809d31a84621d6e86d61d0a (diff)
Replaced target macros
Diffstat (limited to 'libs/libc/inc')
-rw-r--r--libs/libc/inc/assert.h6
-rw-r--r--libs/libc/inc/cpu.h2
-rw-r--r--libs/libc/inc/def.h6
-rw-r--r--libs/libc/inc/errno.h2
-rw-r--r--libs/libc/inc/mem.h6
-rw-r--r--libs/libc/inc/print.h2
-rw-r--r--libs/libc/inc/sys.h2
7 files changed, 11 insertions, 15 deletions
diff --git a/libs/libc/inc/assert.h b/libs/libc/inc/assert.h
index ed835c5..9621e36 100644
--- a/libs/libc/inc/assert.h
+++ b/libs/libc/inc/assert.h
@@ -5,7 +5,7 @@
#include <print.h>
-#ifdef kernel
+#ifdef KERNEL
#include <proc.h>
#define assert(exp) \
if (!(exp)) { \
@@ -13,12 +13,10 @@
#exp); \
__asm__ volatile("cli\nhlt"); \
}
-#elif defined(userspace)
+#elif defined(USER)
#define assert(exp) \
if (!(exp)) \
err(1, "%s:%d: %s: Assertion '%s' failed\n", __FILE__, __LINE__, __func__, #exp);
-#else
-#error "No lib target specified. Please use -Dkernel or -Duserspace"
#endif
#endif
diff --git a/libs/libc/inc/cpu.h b/libs/libc/inc/cpu.h
index 4c6e721..0410125 100644
--- a/libs/libc/inc/cpu.h
+++ b/libs/libc/inc/cpu.h
@@ -22,7 +22,7 @@ static inline void spinlock(u32 *ptr)
while (prev);
}
-#ifdef kernel
+#ifdef KERNEL
void cpu_print(void);
void cpu_enable_features(void);
void fpu_restore(void);
diff --git a/libs/libc/inc/def.h b/libs/libc/inc/def.h
index 2bf50b1..583a351 100644
--- a/libs/libc/inc/def.h
+++ b/libs/libc/inc/def.h
@@ -25,10 +25,10 @@ typedef unsigned long long u64;
#define UNUSED(__a) ((void)(__a))
-#define MIN(__a, __b) (((__a) < (__b)) ? (__a) : (__b))
-#define MAX(__a, __b) (((__a) > (__b)) ? (__a) : (__b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#define ABS(__a) ((u32)(((s32)(__a) < 0) ? (-__a) : (__a)))
+#define ABS(a) ((u32)(((s32)(a) < 0) ? -(a) : (a)))
#define ATTR __attribute__
#define NORETURN ATTR((noreturn))
diff --git a/libs/libc/inc/errno.h b/libs/libc/inc/errno.h
index 133f543..787aab1 100644
--- a/libs/libc/inc/errno.h
+++ b/libs/libc/inc/errno.h
@@ -44,7 +44,7 @@ typedef s32 res;
#define ERANGE 34 /* Math result not representable */
#define EMAX 35 /* Max errno */
-#ifdef userspace
+#ifdef USER
#define errno (*__errno())
extern u32 *__errno(void);
diff --git a/libs/libc/inc/mem.h b/libs/libc/inc/mem.h
index 2d55eff..960ee86 100644
--- a/libs/libc/inc/mem.h
+++ b/libs/libc/inc/mem.h
@@ -12,12 +12,10 @@ void free_debug(void *ptr, const char *file, int line, const char *func, const c
void *realloc(void *ptr, u32 size);
void *zalloc(u32 size);
-#ifdef kernel
+#ifdef KERNEL
#define STACK_START 0x00500000 // Defined it bootloader
#define STACK_SIZE 0x1000 // idk
-#elif defined(userspace)
-#else
-#error "No lib target specified. Please use -Dkernel or -Duserspace"
+#elif defined(USER)
#endif
void *memcpy(void *dest, const void *src, u32 n) NONNULL;
diff --git a/libs/libc/inc/print.h b/libs/libc/inc/print.h
index 751a929..c0d864e 100644
--- a/libs/libc/inc/print.h
+++ b/libs/libc/inc/print.h
@@ -13,7 +13,7 @@ int vsnprintf(char *str, u32 size, const char *format, va_list ap) NONNULL;
int print(const char *str) NONNULL;
NORETURN void panic(const char *format, ...) NONNULL;
-#ifdef userspace
+#ifdef USER
int vfprintf(const char *path, const char *format, va_list ap) NONNULL;
int fprintf(const char *path, const char *format, ...) NONNULL;
int log(const char *format, ...) NONNULL;
diff --git a/libs/libc/inc/sys.h b/libs/libc/inc/sys.h
index 6565e10..81de724 100644
--- a/libs/libc/inc/sys.h
+++ b/libs/libc/inc/sys.h
@@ -59,7 +59,7 @@ struct stat {
u32 size;
};
-#if defined(userspace)
+#ifdef USER
/**
* Syscall wrappers