From e8c6577617bffa4402c07c7aa20e3c24f03c1c20 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 6 Sep 2020 00:48:07 -0400 Subject: program loading, others big kernel additions: paging, elf loading, separate kernel and user page allocation it now properly loads and runs sd0:bin/init.elf still need to determine which disk was booted from, and start the init on that disk --- src/user/include/pland.h | 157 ----------------------------------------------- 1 file changed, 157 deletions(-) delete mode 100644 src/user/include/pland.h (limited to 'src/user/include/pland.h') diff --git a/src/user/include/pland.h b/src/user/include/pland.h deleted file mode 100644 index f174a51..0000000 --- a/src/user/include/pland.h +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef PLAND_H -#define PLAND_H - -#include -#include - -typedef uint8_t fs_handle; -typedef uint8_t task_handle; - -static inline void exit() __attribute__ ((noreturn)) { - asm volatile ("int $0x30"); - __builtin_unreachable(); -} - -static inline void yield() { - asm volatile ("int $0x31"); -} - -static inline uint32_t data_extend(uint32_t amount) { - uint32_t actual_amount; - asm volatile ( - "int $0x33" - : "eax" (actual_amount) : "eax" (amount)); - return actual_amount; -} - -static inline void vga_blank() { - asm volatile ( - "xor %%eax, %%eax\n" - "int $0x32" - : : : "eax"); -} - -static inline void vga_set_color(uint8_t color) { - asm volatile ( - "mov $0x1, %%eax\n" - "int $0x32" - : : "ebx" (color) : "eax"); -} - -static inline void vga_printch(uint8_t ch) { - asm volatile ( - "mov $0x2, %%eax\n" - "int $0x32" - : : "ebx" (ch) : "eax"); -} - -static inline void vga_printsz(uint8_t *sz) { - asm volatile ( - "mov $0x3, %%eax\n" - "int $0x32" - : : "ebx" (sz) : "eax"); -} - -static inline void vga_printsn(uint8_t *sn, uint8_t length) { - asm volatile ( - "mov $0x4, %%eax\n" - "int $0x32" - : : "ebx" (sn), "ecx" (length) : "eax"); -} - -static inline fs_handle fs_open(uint8_t *path) { - fs_handle handle; - asm volatile ( - "mov $0x5, %%eax\n" - "int $0x32" - : "eax" (handle) : "ebx" (path)); - return handle; -} - -static inline fs_handle fs_open_root() { - fs_handle handle; - asm volatile ( - "mov $0x6, %%eax\n" - "int $0x32" - : "eax" (handle)); - return handle; -} - -static inline fs_handle fs_new(uint8_t *path) { - fs_handle handle; - asm volatile ( - "mov $0x7, %%eax\n" - "int $0x32" - : "eax" (handle) : "ebx" (path)); - return handle; -} - -static inline void fs_close(fs_handle handle) { - asm volatile ( - "mov $0x8, %%eax\n" - "int $0x32" - : : "ebx" (handle) : "eax"); -} - -static inline void fs_delete(uint8_t *path) { - asm volatile ( - "mov $0x9, %%eax\n" - "int $0x32" - : : "ebx" (path) : "eax"); -} - -static inline bool fs_exists(uint8_t *path) { - bool does; - asm volatile ( - "mov $0xa, %%eax\n" - "int $0x32" - : "eax" (does) : "ebx" (path)); - return does; -} - -static inline int32_t fs_seek(fs_handle handle, int32_t by) { - int32_t seeked_by; - asm volatile ( - "mov $0xb, %%eax\n" - "int $0x32" - : "eax" (seeked_by) : "ebx" (handle), "ecx" (by)); - return seeked_by; -} - -static inline uint32_t fs_tell(fs_handle handle) { - uint32_t position; - asm volatile ( - "mov $0xc, %%eax\n" - "int $0x32" - : "eax" (position) : "ebx" (handle)); - return position; -} - -static inline uint32_t fs_read(fs_handle handle, uint32_t max, void *buffer) { - uint32_t read; - asm volatile ( - "mov %0xd, %%eax\n" - "int $0x32" - : "eax" (read) : "ebx" (handle), "ecx" (max), "edx" (buffer) : "memory"); - return read; -} - -static inline uint32_t fs_write(fs_handle handle, uint32_t max, void *buffer) { - uint32_t written; - asm volatile ( - "mov %0xe, %%eax\n" - "int $0x32" - : "eax" (written) : "ebx" (handle), "ecx" (max), "edx" (buffer)); - return written; -} - -static inline task_handle plef_run(uint8_t *image_path) { - task_handle handle; - asm volatile ( - "mov %0xf, %%eax\n" - "int $0x32" - : "eax" (handle) : "ebx" (image_path)); - return handle; -} - -#endif -- cgit v1.2.3