summaryrefslogtreecommitdiff
path: root/src/kernel/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/main.c')
-rw-r--r--src/kernel/main.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/kernel/main.c b/src/kernel/main.c
index 97226bd..2c4a24f 100644
--- a/src/kernel/main.c
+++ b/src/kernel/main.c
@@ -80,23 +80,14 @@ enum error_codes {
NO_BOOT_DEVICE = 0x00000000,
NO_MMAP = 0x00000001,
INSUFF_MEMORY = 0x00000002,
- MMAP_TOO_SMALL = 0x00000003
+ MMAP_TOO_SMALL = 0x00000003,
+ MISSING_RC = 0x00000004,
+ BAD_RC_LINE = 0x00000005
};
struct tag_start *tag_pointer;
uint32_t main(void) {
- clear();
-
- /*
- uint32_t *debug_ptr = (uint32_t *)tag_pointer - 2;
- uint32_t debug_size = *debug_ptr / 4;
- for (uint32_t i = 0; i < debug_size; ++i) {
- put_32_hex(debug_ptr[i]);
- put_char(' ');
- }
- */
-
put_sz("Multiboot info:\n");
while (tag_pointer->type) {
put_sz(" Tag type 0x");
@@ -231,12 +222,30 @@ uint32_t main(void) {
put_32_hex(sizeof(struct file_info) * 65536);
put_char('\n');
- put_sz("\nWelcome to Portland version 0.0.9!\n");
- while (1)
- asm ("hlt");
+ uint8_t rc_buffer[4096];
+
+ uint16_t rc_handle = open_file("/cfg/init/once.rc");
+ if (!rc_handle)
+ return MISSING_RC;
+ while (read_line_file(rc_handle, 4095, (void *)rc_buffer))
+ if ((*rc_buffer != (uint8_t)'#') && !new_proc(rc_buffer))
+ return BAD_RC_LINE;
+ close_file(rc_handle);
+
+ rc_handle = open_file("/cfg/init/repeat.rc");
+ if (!rc_handle)
+ return MISSING_RC;
+ while (1) {
+ while (read_line_file(rc_handle, 4095, (void *)rc_buffer))
+ if ((*rc_buffer != (uint8_t)'#') && !new_proc(rc_buffer))
+ return BAD_RC_LINE;
+ seek_file(rc_handle, -0x80000000);
+ seek_file(rc_handle, -0x80000000);
+ }
}
void wrapped_main(void) {
+ clear();
uint32_t error = main();
set_color(0x47);
clear();