diff options
author | Marvin Borner | 2020-01-26 18:38:36 +0100 |
---|---|---|
committer | Marvin Borner | 2020-01-26 18:38:36 +0100 |
commit | bb2a6b4d93512e8afc1b1999eb58f1f506cc27ae (patch) | |
tree | ea30b53ac6043faddd1cdb2fdea17f37178b1cc7 /src/kernel/fs | |
parent | b8630d78a15a69f50dac747e41e84b143dd99b08 (diff) |
Magic commit
Some things work, others don't.
Diffstat (limited to 'src/kernel/fs')
-rw-r--r-- | src/kernel/fs/install.c | 2 | ||||
-rw-r--r-- | src/kernel/fs/load.c | 34 | ||||
-rw-r--r-- | src/kernel/fs/load.h | 19 |
3 files changed, 54 insertions, 1 deletions
diff --git a/src/kernel/fs/install.c b/src/kernel/fs/install.c index daeb91b..f7e2489 100644 --- a/src/kernel/fs/install.c +++ b/src/kernel/fs/install.c @@ -7,7 +7,7 @@ #include <kernel/lib/stdio.h> #include <kernel/timer/timer.h> #include <kernel/memory/kheap.h> -#include <kernel/graphics/font.h> +#include <kernel/fs/load.h> void install_melvix() { diff --git a/src/kernel/fs/load.c b/src/kernel/fs/load.c new file mode 100644 index 0000000..be7d5b8 --- /dev/null +++ b/src/kernel/fs/load.c @@ -0,0 +1,34 @@ +#include <kernel/fs/load.h> +#include <kernel/fs/marfs/marfs.h> +#include <kernel/fs/ata_pio.h> +#include <kernel/fs/atapi_pio.h> +#include <kernel/system.h> +#include <kernel/fs/iso9660/iso9660.h> +#include <kernel/memory/kheap.h> + +void load_binaries() +{ + userspace = kmalloc(10000); + font = (struct font *) kmalloc(100000);; // High quality shit + + uint8_t boot_drive_id = (uint8_t) (*((uint8_t *) 0x9000)); + if (boot_drive_id != 0xE0) { + struct ata_interface *primary_master = new_ata(1, 0x1F0); + marfs_init(primary_master); + marfs_read_whole_file(4, (uint8_t *) userspace); + marfs_read_whole_file(5, (uint8_t *) font); + } else { + char *font_p[] = {"FONT.BIN"}; + struct iso9660_entity *font_e = ISO9660_get(font_p, 1); + if (!font_e) panic("Font not found!"); + ATAPI_granular_read(1 + (font_e->length / 2048), font_e->lba, (uint8_t *) font); + kfree(font_e); + + char *user_p[] = {"USER.BIN"}; + struct iso9660_entity *user_e = ISO9660_get(user_p, 1); + if (!user_e) panic("Userspace binary not found!"); + ATAPI_granular_read(1 + (user_e->length / 2048), user_e->lba, (uint8_t *) userspace); + kfree(user_e); + } + vga_log("Successfully loaded binaries"); +}
\ No newline at end of file diff --git a/src/kernel/fs/load.h b/src/kernel/fs/load.h new file mode 100644 index 0000000..7a0ec06 --- /dev/null +++ b/src/kernel/fs/load.h @@ -0,0 +1,19 @@ +#ifndef MELVIX_LOAD_H +#define MELVIX_LOAD_H + +#include <stdint.h> + +uint32_t userspace; + +struct font *font; + +struct font { + uint16_t font_32[758][32]; + uint16_t font_24[758][24]; + uint8_t font_16[758][16]; + uint16_t cursor[19]; +}; + +void load_binaries(); + +#endif |