diff options
Diffstat (limited to 'src/user/include/pland.h')
-rw-r--r-- | src/user/include/pland.h | 157 |
1 files changed, 0 insertions, 157 deletions
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 <stdint.h> -#include <stdbool.h> - -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 |