aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-11-22 07:58:15 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-11-22 07:58:15 +0100
commit8231af9d8d759ae89c8214ca2410b0feab9dfb8c (patch)
treef679c721ad1dd3daa5830da6c10425d2d3b699ab /include
parent40ffc517e20c381ce8fdb3a881726a26a52e35db (diff)
downloadfbos-8231af9d8d759ae89c8214ca2410b0feab9dfb8c.tar.gz
fbos-8231af9d8d759ae89c8214ca2410b0feab9dfb8c.zip
Add basic parsing for underlying ELF executables
The given initrd is a CPIO archive of multiple ELF executables. We are already able to parse the CPIO archive to detect where each file is located, this commit adds the mapping for each ELF executable to the corresponding task_struct. Note that this is still heavily under construction, since we cannot simply jump into the entry point of an executable as we have not yet setup the proper layout from performing context switches. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/fbos/compiler.h6
-rw-r--r--include/fbos/init.h4
-rw-r--r--include/fbos/sched.h6
3 files changed, 11 insertions, 5 deletions
diff --git a/include/fbos/compiler.h b/include/fbos/compiler.h
index b88bb0b..c26c05c 100644
--- a/include/fbos/compiler.h
+++ b/include/fbos/compiler.h
@@ -19,16 +19,18 @@
#endif /* __KERNEL__ */
/*
- * Multiple aliases for 32/64-bit integers which have their definition on the
+ * Multiple aliases for integer types which have their definition on the
* standard library.
*/
+typedef short int16_t;
typedef int int32_t;
typedef long ssize_t;
typedef long int64_t;
-typedef unsigned long size_t;
+typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
+typedef unsigned long size_t;
typedef unsigned long uint64_t;
typedef unsigned long uintptr_t;
diff --git a/include/fbos/init.h b/include/fbos/init.h
index c4d0a85..978eebe 100644
--- a/include/fbos/init.h
+++ b/include/fbos/init.h
@@ -3,11 +3,9 @@
#include <fbos/compiler.h>
-extern struct task_struct init_task;
-
// Extract the executables from the initrd that is located at `base_addr` and
// has the given `size`.
-void extract_initrd(const char *const base_addr, uint64_t size);
+void extract_initrd(const unsigned char *const base_addr, uint64_t size);
// The entry point for the kernel.
void start_kernel(void *dtb);
diff --git a/include/fbos/sched.h b/include/fbos/sched.h
index 5cfc2ba..ff56f32 100644
--- a/include/fbos/sched.h
+++ b/include/fbos/sched.h
@@ -1,6 +1,8 @@
#ifndef __FBOS_SCHED_H_
#define __FBOS_SCHED_H_
+#include <fbos/compiler.h>
+
enum task_id {
TASK_UNKNOWN = -1,
TASK_INIT = 0,
@@ -11,6 +13,10 @@ enum task_id {
struct task_struct {
void *stack;
+ const void *addr;
+ uint64_t entry_offset;
};
+extern struct task_struct tasks[4];
+
#endif // __FBOS_SCHED_H_