aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/inc
diff options
context:
space:
mode:
authorMarvin Borner2021-04-02 01:27:36 +0200
committerMarvin Borner2021-04-02 01:27:36 +0200
commit192b756a6999a0637fcc72f3fd2f9f7099e32543 (patch)
treef936c42baeb54c8aebd0fc0ac0cb56f9dcf3c96c /libs/libc/inc
parentafa00abb2b68205bee539d7947130d6b1b1ec6e9 (diff)
Huge scheduling/proc-management improvements
Diffstat (limited to 'libs/libc/inc')
-rw-r--r--libs/libc/inc/assert.h6
-rw-r--r--libs/libc/inc/cpu.h4
-rw-r--r--libs/libc/inc/def.h14
-rw-r--r--libs/libc/inc/sys.h2
4 files changed, 13 insertions, 13 deletions
diff --git a/libs/libc/inc/assert.h b/libs/libc/inc/assert.h
index 3656c33..ed835c5 100644
--- a/libs/libc/inc/assert.h
+++ b/libs/libc/inc/assert.h
@@ -11,11 +11,7 @@
if (!(exp)) { \
printf("%s:%d: %s: Kernel assertion '%s' failed\n", __FILE__, __LINE__, __func__, \
#exp); \
- struct proc *assert_proc = proc_current(); \
- if (assert_proc) \
- proc_exit(assert_proc, 1); \
- else \
- __asm__ volatile("cli\nhlt"); \
+ __asm__ volatile("cli\nhlt"); \
}
#elif defined(userspace)
#define assert(exp) \
diff --git a/libs/libc/inc/cpu.h b/libs/libc/inc/cpu.h
index f96fa58..52e5571 100644
--- a/libs/libc/inc/cpu.h
+++ b/libs/libc/inc/cpu.h
@@ -14,9 +14,9 @@ void outb(u16 port, u8 data);
void outw(u16 port, u16 data);
void outl(u16 port, u32 data);
-static inline void spinlock(int *ptr)
+static inline void spinlock(u8 *ptr)
{
- int prev;
+ u32 prev;
do
__asm__ volatile("lock xchgl %0,%1" : "=a"(prev) : "m"(*ptr), "a"(1));
while (prev);
diff --git a/libs/libc/inc/def.h b/libs/libc/inc/def.h
index 378a4d0..2bf50b1 100644
--- a/libs/libc/inc/def.h
+++ b/libs/libc/inc/def.h
@@ -23,12 +23,12 @@ typedef unsigned long long u64;
* Macros
*/
-#define UNUSED(a) ((void)(a))
+#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))
@@ -39,8 +39,12 @@ typedef unsigned long long u64;
#define FLATTEN ATTR((flatten))
#define PACKED ATTR((packed))
#define HOT ATTR((hot))
-#define ALIGNED(align) ATTR((aligned(align)))
+#define SENTINEL ATTR((sentinel))
+#define USED_FUNC ATTR((used))
+#define UNUSED_FUNC ATTR((unused))
#define NO_SANITIZE ATTR((no_sanitize("undefined")))
+#define ALIGNED(align) ATTR((aligned(align)))
+#define SECTION(section) ATTR((section(section)))
#define EOF (-1)
#define NULL ((void *)0)
diff --git a/libs/libc/inc/sys.h b/libs/libc/inc/sys.h
index b555998..6565e10 100644
--- a/libs/libc/inc/sys.h
+++ b/libs/libc/inc/sys.h
@@ -72,7 +72,7 @@ res write(const char *path, const void *buf, u32 offset, u32 count) NONNULL;
res ioctl(const char *path, ...) NONNULL;
res stat(const char *path, struct stat *buf) NONNULL;
res poll(const char **files) NONNULL;
-res exec(const char *path, ...) ATTR((nonnull(1)));
+res exec(const char *path, ...) ATTR((nonnull(1))) SENTINEL;
res yield(void);
res boot(u32 cmd);
u32 time(void);