From ef805e9373fd946bf1fe667bf18a54dfed6d1045 Mon Sep 17 00:00:00 2001 From: Alejandro Sior Date: Sat, 23 Jul 2022 22:53:47 +0200 Subject: kernel: add basic modules: arch, mem, rt --- rt/README | 5 +++++ rt/assert.h | 6 ++++++ rt/meson.build | 1 + rt/rt.h | 8 ++++++++ rt/stddef.h | 8 ++++++++ rt/stdint.h | 21 +++++++++++++++++++++ 6 files changed, 49 insertions(+) create mode 100644 rt/README create mode 100644 rt/assert.h create mode 100644 rt/meson.build create mode 100644 rt/rt.h create mode 100644 rt/stddef.h create mode 100644 rt/stdint.h (limited to 'rt') diff --git a/rt/README b/rt/README new file mode 100644 index 0000000..2cfdd3f --- /dev/null +++ b/rt/README @@ -0,0 +1,5 @@ +The [rt] module contains definitions and declarations of things +that are used very commonly throughout the codebase. + +The module notably exposes the rt.h header importing the most +common files within this module for convenience. \ No newline at end of file diff --git a/rt/assert.h b/rt/assert.h new file mode 100644 index 0000000..f000d70 --- /dev/null +++ b/rt/assert.h @@ -0,0 +1,6 @@ +#ifndef RT_ASSERT_H +#define RT_ASSERT_H + +#define static_assert _Static_assert + +#endif \ No newline at end of file diff --git a/rt/meson.build b/rt/meson.build new file mode 100644 index 0000000..86de68f --- /dev/null +++ b/rt/meson.build @@ -0,0 +1 @@ +kernel_inc += include_directories('.') \ No newline at end of file diff --git a/rt/rt.h b/rt/rt.h new file mode 100644 index 0000000..c3670d5 --- /dev/null +++ b/rt/rt.h @@ -0,0 +1,8 @@ +#ifndef RT_RT_H +#define RT_RT_H + +#include "assert.h" +#include "stdint.h" +#include "stddef.h" + +#endif \ No newline at end of file diff --git a/rt/stddef.h b/rt/stddef.h new file mode 100644 index 0000000..83d9957 --- /dev/null +++ b/rt/stddef.h @@ -0,0 +1,8 @@ +#ifndef RT_STDDEF_H +#define RT_STDDEF_H + +#define nil ((void*)0) + +#define ALIGN_UP(X, F) ((X) - (X) % (F) + (F)) + +#endif \ No newline at end of file diff --git a/rt/stdint.h b/rt/stdint.h new file mode 100644 index 0000000..f7ee056 --- /dev/null +++ b/rt/stdint.h @@ -0,0 +1,21 @@ +#ifndef RT_STDINT_H +#define RT_STDINT_H + +#include "assert.h" + +typedef unsigned char uchar; + +typedef unsigned short int ushort; + +typedef unsigned int uint; + +typedef unsigned long int ulong; + +typedef long long int vlong; +typedef unsigned long long int uvlong; + +// Machine specific types + +#include + +#endif \ No newline at end of file -- cgit v1.2.3