aboutsummaryrefslogtreecommitdiff
path: root/include/apos
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-04-29 17:38:41 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-04-29 17:38:41 +0300
commit9273c16434316a8ab60dc78ee65a03e68031203a (patch)
tree41754de4b7c459fc07e20189948c94a0e2cab966 /include/apos
parent105f3d0dab75f669d1fc404c06b73289b343591c (diff)
downloadkmi-9273c16434316a8ab60dc78ee65a03e68031203a.tar.gz
kmi-9273c16434316a8ab60dc78ee65a03e68031203a.zip
continue building base for irq handling
Diffstat (limited to 'include/apos')
-rw-r--r--include/apos/syscalls.h4
-rw-r--r--include/apos/uapi.h3
-rw-r--r--include/apos/utils.h70
3 files changed, 42 insertions, 35 deletions
diff --git a/include/apos/syscalls.h b/include/apos/syscalls.h
index ed18872..6f9e312 100644
--- a/include/apos/syscalls.h
+++ b/include/apos/syscalls.h
@@ -4,6 +4,10 @@
/* enum for now, possibly macros in the future once I get an approximate idea of
* which syscalls are necessary etc. */
enum {
+ /* noop, for testing out how many syscalls per second can done I suppose
+ * */
+ SYS_NOOP,
+
/* memory management */
SYS_REQ_MEM, /* request memory from anywhere */
SYS_REQ_PMEM, /* request physical address */
diff --git a/include/apos/uapi.h b/include/apos/uapi.h
index fa66b31..a6fc2b7 100644
--- a/include/apos/uapi.h
+++ b/include/apos/uapi.h
@@ -60,6 +60,9 @@ typedef vm_t (*sys_t)(vm_t, vm_t, vm_t, vm_t);
} \
static vm_t __##name
+/* noop */
+SYSCALL_DECLARE(noop);
+
/* memory */
SYSCALL_DECLARE(req_mem);
SYSCALL_DECLARE(req_pmem);
diff --git a/include/apos/utils.h b/include/apos/utils.h
index d7dd8b9..e09a35f 100644
--- a/include/apos/utils.h
+++ b/include/apos/utils.h
@@ -51,21 +51,21 @@
/* clang-format doesn't like _Generic, but I guess that's fine. */
#define align_up(x, y) \
- _Generic((x), signed char \
- : align_up_c, signed short \
- : align_up_s, signed int \
- : align_up_i, signed long \
- : align_up_l, signed long long \
- : align_up_ll,\
+ _Generic((x), signed char \
+ : align_up_c, signed short \
+ : align_up_s, signed int \
+ : align_up_i, signed long \
+ : align_up_l, signed long long \
+ : align_up_ll, \
\
- unsigned char \
- : align_up_uc, unsigned short \
- : align_up_us, unsigned int \
- : align_up_ui, unsigned long \
- : align_up_ul, unsigned long long\
+ unsigned char \
+ : align_up_uc, unsigned short \
+ : align_up_us, unsigned int \
+ : align_up_ui, unsigned long \
+ : align_up_ul, unsigned long long \
: align_up_ull)((x), (y))
-#define DEFINE_ALIGN_UP(name, type) \
+#define DEFINE_ALIGN_UP(name, type) \
static inline type align_up_##name(type val, type a) \
{ \
if (!a) \
@@ -92,21 +92,21 @@ DEFINE_ALIGN_UP(ul, unsigned long);
DEFINE_ALIGN_UP(ull, unsigned long long);
#define align_down(x, y) \
- _Generic((x), signed char \
+ _Generic((x), signed char \
: align_down_c, signed short \
- : align_down_s, signed int \
- : align_down_i, signed long \
- : align_down_l, signed long long \
- : align_down_ll,\
+ : align_down_s, signed int \
+ : align_down_i, signed long \
+ : align_down_l, signed long long \
+ : align_down_ll, \
\
- unsigned char \
- : align_down_uc, unsigned short \
- : align_down_us, unsigned int \
- : align_down_ui, unsigned long \
- : align_down_ul, unsigned long long\
- : align_down_ull)((x), (y))
+ unsigned char \
+ : align_down_uc, unsigned short \
+ : align_down_us, unsigned int \
+ : align_down_ui, unsigned long \
+ : align_down_ul, unsigned long long \
+ : align_down_ull)((x), (y))
-#define DEFINE_ALIGN_DOWN(name, type) \
+#define DEFINE_ALIGN_DOWN(name, type) \
static inline type align_down_##name(type val, type a) \
{ \
if (!a) \
@@ -128,21 +128,21 @@ DEFINE_ALIGN_DOWN(ul, unsigned long);
DEFINE_ALIGN_DOWN(ull, unsigned long long);
#define is_aligned(x, y) \
- _Generic((x), signed char \
+ _Generic((x), signed char \
: is_aligned_c, signed short \
- : is_aligned_s, signed int \
- : is_aligned_i, signed long \
- : is_aligned_l, signed long long \
- : is_aligned_ll,\
+ : is_aligned_s, signed int \
+ : is_aligned_i, signed long \
+ : is_aligned_l, signed long long \
+ : is_aligned_ll, \
\
- unsigned char \
- : is_aligned_uc, unsigned short \
- : is_aligned_us, unsigned int \
- : is_aligned_ui, unsigned long \
- : is_aligned_ul, unsigned long long \
+ unsigned char \
+ : is_aligned_uc, unsigned short \
+ : is_aligned_us, unsigned int \
+ : is_aligned_ui, unsigned long \
+ : is_aligned_ul, unsigned long long \
: is_aligned_ll)((x), (y))
-#define DEFINE_ALIGNED(name, type) \
+#define DEFINE_ALIGNED(name, type) \
static inline bool is_aligned_##name(type val, type a) \
{ \
if (!a) \