diff options
author | Marvin Borner | 2020-04-29 00:39:24 +0200 |
---|---|---|
committer | Marvin Borner | 2020-04-29 00:39:24 +0200 |
commit | 50858d043cbd6f61cc091c6772f981ca2d6cca6b (patch) | |
tree | 82afcc2daf9c4b67d29832923283654913490d06 /src/userspace/libc | |
parent | 34c752f6fe4f71169172f1b3e46b1eddf69eba6e (diff) |
Added basic exec calls for init and started libc
Diffstat (limited to 'src/userspace/libc')
-rw-r--r-- | src/userspace/libc/math.h | 20 | ||||
-rw-r--r-- | src/userspace/libc/stdarg.h | 6 | ||||
-rw-r--r-- | src/userspace/libc/stdbool.h | 11 | ||||
-rw-r--r-- | src/userspace/libc/stddef.h | 8 | ||||
-rw-r--r-- | src/userspace/libc/stdint.h | 18 | ||||
-rw-r--r-- | src/userspace/libc/stdio.h | 8 | ||||
-rw-r--r-- | src/userspace/libc/stdlib.h | 10 | ||||
-rw-r--r-- | src/userspace/libc/syscall.c | 10 | ||||
-rw-r--r-- | src/userspace/libc/syscall.h | 10 |
9 files changed, 93 insertions, 8 deletions
diff --git a/src/userspace/libc/math.h b/src/userspace/libc/math.h new file mode 100644 index 0000000..2683535 --- /dev/null +++ b/src/userspace/libc/math.h @@ -0,0 +1,20 @@ +#ifndef MELVIX_MATH_H +#define MELVIX_MATH_H + +// Trigonometric + +// Hyperbolic + +// Exponential and logarithmic + +// Power + +// Error and gamma + +// Rounding and remainder + +// Floating point manipulation + +// Minimum, maximum, difference + +#endif diff --git a/src/userspace/libc/stdarg.h b/src/userspace/libc/stdarg.h new file mode 100644 index 0000000..41583f9 --- /dev/null +++ b/src/userspace/libc/stdarg.h @@ -0,0 +1,6 @@ +#ifndef MELVIX_STDARG_H +#define MELVIX_STDARG_H + +// va_{list,start,arg,end,copy} + +#endif diff --git a/src/userspace/libc/stdbool.h b/src/userspace/libc/stdbool.h new file mode 100644 index 0000000..b445c80 --- /dev/null +++ b/src/userspace/libc/stdbool.h @@ -0,0 +1,11 @@ +#ifndef MELVIX_STDBOOL_H +#define MELVIX_STDBOOL_H + +#define true 1 +#define false 0 + +// For the strange people in the world +#define TRUE 1 +#define FALSE 0 + +#endif diff --git a/src/userspace/libc/stddef.h b/src/userspace/libc/stddef.h new file mode 100644 index 0000000..531cee3 --- /dev/null +++ b/src/userspace/libc/stddef.h @@ -0,0 +1,8 @@ +#ifndef MELVIX_STDDEF_H +#define MELVIX_STDDEF_H + +// size_t + +#define NULL ((void *)0) + +#endif diff --git a/src/userspace/libc/stdint.h b/src/userspace/libc/stdint.h new file mode 100644 index 0000000..be28300 --- /dev/null +++ b/src/userspace/libc/stdint.h @@ -0,0 +1,18 @@ +#ifndef MELVIX_STDINT_H +#define MELVIX_STDINT_H + +// TODO: Use shorter fixed length integers as stdint in kernel + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long s64; +typedef unsigned long u64; + +#endif diff --git a/src/userspace/libc/stdio.h b/src/userspace/libc/stdio.h new file mode 100644 index 0000000..03dfd1a --- /dev/null +++ b/src/userspace/libc/stdio.h @@ -0,0 +1,8 @@ +#ifndef MELVIX_STDIO_H +#define MELVIX_STDIO_H + +// File operations + +// Character input/output + +#endif diff --git a/src/userspace/libc/stdlib.h b/src/userspace/libc/stdlib.h new file mode 100644 index 0000000..ab6bff4 --- /dev/null +++ b/src/userspace/libc/stdlib.h @@ -0,0 +1,10 @@ +#ifndef MELVIX_STDLIB_H +#define MELVIX_STDLIB_H + +// String conversion + +// Exit functions + +// Memory management + +#endif diff --git a/src/userspace/libc/syscall.c b/src/userspace/libc/syscall.c index fd27ef5..42786d4 100644 --- a/src/userspace/libc/syscall.c +++ b/src/userspace/libc/syscall.c @@ -5,10 +5,12 @@ */ DEFN_SYSCALL0(halt, 0); -DEFN_SYSCALL1(putch, 1, const char *); +DEFN_SYSCALL1(exec, 1, char *); -DEFN_SYSCALL0(getch, 2); +DEFN_SYSCALL1(putch, 2, char *); -DEFN_SYSCALL1(malloc, 3, uint32_t); +DEFN_SYSCALL0(getch, 3); -DEFN_SYSCALL1(free, 4, uint32_t);
\ No newline at end of file +DEFN_SYSCALL1(malloc, 4, u32); + +DEFN_SYSCALL1(free, 5, u32); diff --git a/src/userspace/libc/syscall.h b/src/userspace/libc/syscall.h index 61ffecc..394118c 100644 --- a/src/userspace/libc/syscall.h +++ b/src/userspace/libc/syscall.h @@ -70,12 +70,14 @@ */ DECL_SYSCALL0(halt); -DECL_SYSCALL1(putch, const char *); +DECL_SYSCALL1(exec, char *); + +DECL_SYSCALL1(putch, char *); DECL_SYSCALL0(getch); -DECL_SYSCALL1(malloc, uint32_t); +DECL_SYSCALL1(malloc, u32); -DECL_SYSCALL1(free, uint32_t); +DECL_SYSCALL1(free, u32); -#endif
\ No newline at end of file +#endif |