diff options
author | Marvin Borner | 2020-04-29 19:21:29 +0200 |
---|---|---|
committer | Marvin Borner | 2020-04-29 19:21:29 +0200 |
commit | 4546c75d685475d8b9f215b588364e1d1bbd0b79 (patch) | |
tree | 2077f72ad46dfe877f7febdd0692edc139fd7937 /src/kernel | |
parent | 396d7d303d3bf0e796d0c817883ec1dec928352a (diff) |
MUCH work in libc
Also cleaned up some syscalls etc
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/acpi/acpi.c | 8 | ||||
-rw-r--r-- | src/kernel/gdt/gdt.c | 2 | ||||
-rw-r--r-- | src/kernel/graphics/vesa.c | 36 | ||||
-rw-r--r-- | src/kernel/graphics/vesa.h | 39 | ||||
-rw-r--r-- | src/kernel/input/input.h | 4 | ||||
-rw-r--r-- | src/kernel/input/ps2/keyboard.c | 115 | ||||
-rw-r--r-- | src/kernel/interrupts/idt.c | 2 | ||||
-rw-r--r-- | src/kernel/interrupts/irq.c | 2 | ||||
-rw-r--r-- | src/kernel/interrupts/isr.c | 9 | ||||
-rw-r--r-- | src/kernel/io/io.c | 2 | ||||
-rw-r--r-- | src/kernel/kernel.c | 8 | ||||
-rw-r--r-- | src/kernel/lib/stdio.h | 2 | ||||
-rw-r--r-- | src/kernel/lib/stdio/getch.c | 11 | ||||
-rw-r--r-- | src/kernel/memory/alloc.c | 13 | ||||
-rw-r--r-- | src/kernel/memory/paging.c | 11 | ||||
-rw-r--r-- | src/kernel/memory/paging.h | 2 | ||||
-rw-r--r-- | src/kernel/multiboot.c | 5 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_getch.c | 11 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_pointers.c | 11 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_scancode.c | 11 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.c | 6 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.h | 2 | ||||
-rw-r--r-- | src/kernel/system.c | 35 | ||||
-rw-r--r-- | src/kernel/system.h | 11 | ||||
-rw-r--r-- | src/kernel/tasks/process.c | 2 |
25 files changed, 79 insertions, 281 deletions
diff --git a/src/kernel/acpi/acpi.c b/src/kernel/acpi/acpi.c index 3e07171..1fced51 100644 --- a/src/kernel/acpi/acpi.c +++ b/src/kernel/acpi/acpi.c @@ -29,13 +29,15 @@ int check_sum(struct sdt_header *header) void acpi_init(struct rsdp *rsdp) { + // TODO: Fix ACPI table discovering (HPET & MADT missing) + // TODO: Fix ACPI breaking VESA (why?!) + struct sdt_header *header = (struct sdt_header *)kmalloc(sizeof(struct sdt_header)); rsdt = (struct rsdt *)kmalloc(sizeof(struct rsdt)); fadt = (struct fadt *)kmalloc(sizeof(struct fadt)); hpet = (struct hpet *)kmalloc(sizeof(struct hpet)); madt = (struct madt *)kmalloc(sizeof(struct madt)); - // TODO: Fix ACPI table discovering (HPET & MADT missing) if (strncmp(rsdp->signature, "RSD PTR ", 8) == 0) { memcpy(rsdt, rsdp->rsdt_address, sizeof(struct rsdt) + 32); debug("Found RSDT"); @@ -75,12 +77,12 @@ void acpi_init(struct rsdp *rsdp) void acpi_old_init(struct multiboot_tag_old_acpi *tag) { - acpi_init((struct rsdp *)tag->rsdp); + // acpi_init((struct rsdp *)tag->rsdp); } void acpi_new_init(struct multiboot_tag_new_acpi *tag) { - acpi_init((struct rsdp *)tag->rsdp); + // acpi_init((struct rsdp *)tag->rsdp); } void acpi_poweroff() diff --git a/src/kernel/gdt/gdt.c b/src/kernel/gdt/gdt.c index 79ea51c..4e8428f 100644 --- a/src/kernel/gdt/gdt.c +++ b/src/kernel/gdt/gdt.c @@ -104,7 +104,7 @@ void gdt_install() gdt_flush(); tss_flush(); - vga_log("Installed Global Descriptor Table"); + info("Installed Global Descriptor Table"); } void tss_write(int32_t num, uint16_t ss0, uint32_t esp0) diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c index b92f171..8213c12 100644 --- a/src/kernel/graphics/vesa.c +++ b/src/kernel/graphics/vesa.c @@ -6,32 +6,11 @@ #include <kernel/memory/alloc.h> #include <kernel/memory/paging.h> -void switch_to_vga() +void vbe_error() { - log("Force switch to VGA!"); - uint16_t *terminal_buffer = (uint16_t *)0xB8000; - char *error = "Melvix does not support this graphics hardware!"; - for (size_t i = 0; i < strlen(error); i++) - terminal_buffer[24 * 80 + i] = (uint16_t)error[i] | (uint16_t)0x700; - panic("No VESA support!"); -} - -struct edid_data get_edid() -{ - regs16_t regs; - regs.ax = 0x4F15; - regs.bx = 0x1; // BL - regs.es = 0; - regs.di = 0x7E00; - v86(0x10, ®s); - - if ((regs.ax & 0xFF) != 0x4F) { - warn("No EDID available!"); - } - - struct edid_data *edid = (struct edid_data *)0x7E00; - - return *edid; + log("Error in VESA detection script!"); + warn(RED "Melvix can't work without VESA Support!" RES); + halt_loop(); } void vbe_set_mode(unsigned short mode) @@ -43,7 +22,7 @@ void vbe_set_mode(unsigned short mode) v86(0x10, ®s); if (regs.ax != 0x004F) - switch_to_vga(); + vbe_error(); } uint16_t *vbe_get_modes() @@ -62,7 +41,7 @@ uint16_t *vbe_get_modes() struct vbe_info *info = (struct vbe_info *)info_address; if (regs.ax != 0x004F || strcmp(info->signature, "VESA") != 0) - switch_to_vga(); + vbe_error(); // Get number of modes uint16_t *mode_ptr = (uint16_t *)info->video_modes; @@ -178,7 +157,7 @@ void set_optimal_resolution() // Everything else failed :( if (highest == 0) - switch_to_vga(); + vbe_error(); } else { log("Mode detection succeeded"); } @@ -248,6 +227,7 @@ void vesa_draw_rectangle(int x1, int y1, int x2, int y2, const uint32_t color[3] void vesa_clear() { + log("%dx%dx%d at %x", vbe_width, vbe_height, vbe_bpl << 3, fb); vesa_draw_rectangle(0, 0, vbe_width - 1, vbe_height - 1, terminal_background); terminal_x = 0; terminal_y = 0; diff --git a/src/kernel/graphics/vesa.h b/src/kernel/graphics/vesa.h index bbe5aaf..cdbd45a 100644 --- a/src/kernel/graphics/vesa.h +++ b/src/kernel/graphics/vesa.h @@ -4,33 +4,6 @@ #include <stdint.h> #include <kernel/system.h> -struct edid_data { - uint8_t padding[8]; - uint16_t manufacture_id; - uint16_t product_code; - uint32_t serial_number; - uint8_t manufacture_week; - uint8_t manufacture_year; - uint8_t edid_version; - uint8_t edid_revision; - uint8_t video_input_type; - uint8_t max_horizontal_size; - uint8_t max_vertical_size; - uint8_t gamma_factor; - uint8_t dpms_flags; // power management features - uint8_t chroma_information[10]; - uint8_t timings_1; - uint8_t timings_2; - uint8_t reserved_timings; - uint32_t timing_identification[8]; - uint8_t timing_description_1[18]; - uint8_t timing_description_2[18]; - uint8_t timing_description_3[18]; - uint8_t timing_description_4[18]; - uint8_t unused; - uint8_t checksum; -}; - /** * The CPUs response to the 0x4F00 call * Used to receive the supported video modes @@ -103,18 +76,6 @@ struct vbe_mode_info { } __attribute__((packed)); /** - * Get the monitors EDID information - * TODO: Add EDID/VBE resolution mode verification - * @return The EDID information - */ -struct edid_data get_edid(); - -/** - * Forces switch to VGA, displays an error and halts the CPU - */ -void switch_to_vga(); - -/** * Set the video mode to a specified resolution using * a video mode code * @param mode The requested video mode code from 0x4F00 call diff --git a/src/kernel/input/input.h b/src/kernel/input/input.h index 172f0ae..d387172 100644 --- a/src/kernel/input/input.h +++ b/src/kernel/input/input.h @@ -1,6 +1,8 @@ #ifndef MELVIX_INPUT_H #define MELVIX_INPUT_H +#include <stdint.h> + /** * Initialize the mouse IRQ handler */ @@ -12,6 +14,6 @@ void mouse_install(); */ void keyboard_install(); -char keyboard_char_buffer; +char wait_scancode(); #endif
\ No newline at end of file diff --git a/src/kernel/input/ps2/keyboard.c b/src/kernel/input/ps2/keyboard.c index 2056045..cc0e03d 100644 --- a/src/kernel/input/ps2/keyboard.c +++ b/src/kernel/input/ps2/keyboard.c @@ -5,113 +5,11 @@ #include <kernel/lib/string.h> #include <kernel/memory/alloc.h> -int shift_pressed; -int control_pressed; - -char keymap[128] = { - 0 /*E*/, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', - '\b', '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', - '\n', 17 /*C*/, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', - 14 /*LS*/, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 14 /*RS*/, '*', - 0, // Alt key - ' ', // Space bar - 15, // Caps lock - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // F keys - 0, // Num lock - 0, // Scroll lock - 0, // Home key - 0, // Up arrow - 0, // Page up - '-', - 0, // Left arrow - 0, - 0, // Right arrow - '+', - 0, // End key - 0, // Down arrow - 0, // Page down - 0, // Insert key - 0, // Delete key - 0, 0, 0, - 0, // F11 - 0, // F12 - 0, // Other keys -}; - -char shift_keymap[128] = { - 0 /*E*/, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', - '\b', '\t', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', - '\n', 17 /*C*/, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', - 14 /*LS*/, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 14 /*RS*/, '*', - 0, // Alt key - ' ', // Space bar - 15, // Caps lock - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // F keys - 0, // Num lock - 0, // Scroll lock - 0, // Home key - 0, // Up arrow - 0, // Page up - '-', - 0, // Left arrow - 0, - 0, // Right arrow - '+', - 0, // End key - 0, // Down arrow - 0, // Page down - 0, // Insert key - 0, // Delete key - 0, 0, 0, - 0, // F11 - 0, // F12 - 0, // Other keys -}; - -char *handle_shift(int scan_code) -{ - char *current_keymap = keymap; - if (shift_pressed) - current_keymap = shift_keymap; - - if ((scan_code & 0x80) == 0) { // PRESS - // TODO: Fix caps lock deactivation when pressing shift while (locked) shifted - if (current_keymap[scan_code] == 14 || - (current_keymap[scan_code] == 15 && !shift_pressed)) { - shift_pressed = 1; - } else if (current_keymap[scan_code] == 15 && shift_pressed) { - shift_pressed = 0; - } - } else { // RELEASE - char key = current_keymap[scan_code]; - if (key == 14) - shift_pressed = 0; - } - - return current_keymap; -} +uint8_t scancode; void keyboard_handler(struct regs *r) { - unsigned char scan_code; - - scan_code = inb(0x60); - char *current_keymap = handle_shift(scan_code); - - if ((scan_code & 0x80) == 0) { // PRESS - if (current_keymap[scan_code] == 17) - control_pressed = 1; - - if (control_pressed && current_keymap[scan_code] == 'l') { - vesa_clear(); - return; - } - - keyboard_char_buffer = current_keymap[scan_code]; - } else { // RELEASE - if (current_keymap[scan_code] == (int)0xffffffb5) // TODO: IDK WHY -107?! - control_pressed = 0; - } + scancode = inb(0x60); } void keyboard_acknowledge() @@ -127,10 +25,17 @@ void keyboard_rate() outb(0x60, 0x0); // Rate{00000} Delay{00} 0 } +char wait_scancode() +{ + scancode = 0; + while (scancode == 0) { + }; + return scancode; +} + void keyboard_install() { keyboard_rate(); irq_install_handler(1, keyboard_handler); - shift_pressed = 0; info("Installed keyboard handler"); }
\ No newline at end of file diff --git a/src/kernel/interrupts/idt.c b/src/kernel/interrupts/idt.c index 7c762b3..4be3d7c 100644 --- a/src/kernel/interrupts/idt.c +++ b/src/kernel/interrupts/idt.c @@ -44,5 +44,5 @@ void idt_install() memset(&idt, 0, sizeof(struct idt_entry) * 256); idt_load(); - vga_log("Installed Interrupt Descriptor Table"); + info("Installed Interrupt Descriptor Table"); }
\ No newline at end of file diff --git a/src/kernel/interrupts/irq.c b/src/kernel/interrupts/irq.c index f23e14a..ad35346 100644 --- a/src/kernel/interrupts/irq.c +++ b/src/kernel/interrupts/irq.c @@ -89,7 +89,7 @@ void irq_install() idt_set_gate(45, (unsigned)irq13, 0x08, 0x8E); idt_set_gate(46, (unsigned)irq14, 0x08, 0x8E); idt_set_gate(47, (unsigned)irq15, 0x08, 0x8E); - vga_log("Installed Interrupt Requests"); + info("Installed Interrupt Requests"); } // Handle IRQ ISRs diff --git a/src/kernel/interrupts/isr.c b/src/kernel/interrupts/isr.c index 9d92529..880c23a 100644 --- a/src/kernel/interrupts/isr.c +++ b/src/kernel/interrupts/isr.c @@ -49,7 +49,7 @@ void isrs_install() idt_set_gate(0x80, (unsigned)isr128, 0x08, 0xEE); - vga_log("Installed Interrupt Service Routines"); + info("Installed Interrupt Service Routines"); } irq_handler_t isr_routines[256] = { 0 }; @@ -133,7 +133,12 @@ void fault_handler(struct regs *r) scheduler(r); sti(); } else { - panic("Page fault before multitasking started!"); + if (faulting_address != (uint32_t)fb) { + panic("Page fault before multitasking started!"); + } else { + debug(RED "Fatal video error!" RES); + halt_loop(); + } } } }
\ No newline at end of file diff --git a/src/kernel/io/io.c b/src/kernel/io/io.c index cd03408..fb95464 100644 --- a/src/kernel/io/io.c +++ b/src/kernel/io/io.c @@ -61,7 +61,7 @@ void init_serial() outb(0x3f8 + 3, 0x03); outb(0x3f8 + 2, 0xC7); outb(0x3f8 + 4, 0x0B); - vga_log("Installed serial connection"); + info("Installed serial connection"); } int is_transmit_empty() diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index ffde014..c5b063a 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -26,16 +26,16 @@ void kernel_main(uint32_t magic, uint32_t multiboot_address, uint32_t esp) stack_hold = esp; if (magic != MULTIBOOT_BOOTLOADER_MAGIC) { - vga_log("Invalid boot magic!"); + warn("Invalid boot magic!"); halt_loop(); } if (multiboot_address & 7) { - vga_log("Unaligned mbi!"); + warn("Unaligned mbi!"); halt_loop(); } - vga_log("Installing basic features of Melvix..."); + info("Installing basic features of Melvix..."); // Install features gdt_install(); @@ -44,7 +44,7 @@ void kernel_main(uint32_t magic, uint32_t multiboot_address, uint32_t esp) isrs_install(); irq_install(); - // multiboot_parse(multiboot_address); // TODO: Why does this break graphics? + multiboot_parse(multiboot_address); paging_install(); // Install drivers diff --git a/src/kernel/lib/stdio.h b/src/kernel/lib/stdio.h index 7dae60e..26b9ce8 100644 --- a/src/kernel/lib/stdio.h +++ b/src/kernel/lib/stdio.h @@ -3,8 +3,6 @@ #include <stdarg.h> -char getch(); - void putch(char c); void vprintf(const char *fmt, va_list args); diff --git a/src/kernel/lib/stdio/getch.c b/src/kernel/lib/stdio/getch.c deleted file mode 100644 index 4f6ed39..0000000 --- a/src/kernel/lib/stdio/getch.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <kernel/input/input.h> -#include <kernel/timer/timer.h> -#include <kernel/system.h> - -char getch() -{ - keyboard_char_buffer = 0; - while (keyboard_char_buffer == 0) { - }; - return keyboard_char_buffer; -}
\ No newline at end of file diff --git a/src/kernel/memory/alloc.c b/src/kernel/memory/alloc.c index fd00cc7..f03c0f5 100644 --- a/src/kernel/memory/alloc.c +++ b/src/kernel/memory/alloc.c @@ -100,7 +100,7 @@ void free_internal(struct heap_header *heap, void *address) } if ((head->magic != KHEAP_MAGIC) || (head->magic2 != KHEAP_MAGIC2)) { - //warn("Invalid header in heap"); + warn("Invalid header in heap"); return; } @@ -110,7 +110,7 @@ void free_internal(struct heap_header *heap, void *address) foot = (struct heap_footer *)((uint32_t)head - sizeof(struct heap_footer)); if ((foot->magic != KHEAP_MAGIC) || (foot->magic2 != KHEAP_MAGIC2)) { - //warn("Invalid footer in heap"); + warn("Invalid footer in heap"); return; } @@ -126,14 +126,7 @@ void free_internal(struct heap_header *heap, void *address) foot = (struct heap_footer *)((uint32_t)heap + (heap->size + head->size + HEAP_TOTAL) + HEAP_S); if ((foot->magic != KHEAP_MAGIC) || (foot->magic2 != KHEAP_MAGIC2)) { - /*vga_puts("Footer with size of "); - vga_puts_hex(foot->size); - vga_puts(" / head size of "); - vga_puts_hex(heap->size); - vga_puts("\n"); - dump_struct(foot, sizeof(struct heap_footer)); - warn("fatal arithmetic error in free() call"); - */ + panic("Fatal arithmetic error in free() call"); return; } diff --git a/src/kernel/memory/paging.c b/src/kernel/memory/paging.c index 9075d1d..ed06004 100644 --- a/src/kernel/memory/paging.c +++ b/src/kernel/memory/paging.c @@ -43,6 +43,17 @@ void set_cr0(uint32_t cr0) asm volatile("movl %%eax, %%cr0" ::"a"(cr0)); } +void paging_disable() +{ + set_cr0(get_cr0() | 0x7fffffff); +} + +void paging_enable() +{ + set_cr3(paging_current_directory); + set_cr0(get_cr0() | 0x80000000); +} + void paging_switch_directory(struct page_directory *dir) { set_cr3(dir); diff --git a/src/kernel/memory/paging.h b/src/kernel/memory/paging.h index b4881a9..1941cb9 100644 --- a/src/kernel/memory/paging.h +++ b/src/kernel/memory/paging.h @@ -29,6 +29,8 @@ uint32_t get_cr0(); void set_cr3(struct page_directory *dir); void set_cr0(uint32_t new_cr0); +void paging_disable(); +void paging_enable(); void paging_switch_directory(struct page_directory *dir); struct page_directory *paging_make_directory(); diff --git a/src/kernel/multiboot.c b/src/kernel/multiboot.c index e922ee7..a39c661 100644 --- a/src/kernel/multiboot.c +++ b/src/kernel/multiboot.c @@ -1,4 +1,5 @@ #include <stdint.h> +#include <kernel/graphics/vesa.h> #include <kernel/system.h> #include <kernel/multiboot.h> #include <kernel/smbios/smbios.h> @@ -37,10 +38,10 @@ void multiboot_parse(uint32_t multiboot_address) memory_mmap_init((struct multiboot_tag_mmap *)tag); break; case MULTIBOOT_TAG_TYPE_VBE: - debug("Got VBE debug"); + debug("Got VBE"); break; case MULTIBOOT_TAG_TYPE_FRAMEBUFFER: - debug("Got framebuffer debug"); + debug("Got framebuffer"); break; case MULTIBOOT_TAG_TYPE_APM: debug("Got APM table"); diff --git a/src/kernel/syscall/actions/sys_getch.c b/src/kernel/syscall/actions/sys_getch.c deleted file mode 100644 index 3ce1f8c..0000000 --- a/src/kernel/syscall/actions/sys_getch.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <stdint.h> -#include <kernel/lib/stdio.h> -#include <kernel/io/io.h> - -uint32_t sys_getch() -{ - sti(); - uint32_t key = getch(); - cli(); - return key; -}
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_pointers.c b/src/kernel/syscall/actions/sys_pointers.c index ced95de..6cf50ae 100644 --- a/src/kernel/syscall/actions/sys_pointers.c +++ b/src/kernel/syscall/actions/sys_pointers.c @@ -12,17 +12,8 @@ struct pointers { uint32_t sys_pointers() { - struct vbe_mode_info *ret = (struct vbe_mode_info *)umalloc(sizeof(struct vbe_mode_info)); - ret->attributes = current_mode_info->attributes; - ret->pitch = current_mode_info->pitch; - ret->width = current_mode_info->width; - ret->height = current_mode_info->height; - ret->bpp = current_mode_info->bpp; - ret->memory_model = current_mode_info->memory_model; - ret->framebuffer = current_mode_info->framebuffer; - struct pointers *pointers = umalloc(sizeof(struct pointers)); - pointers->current_mode_info = ret; + pointers->current_mode_info = current_mode_info; pointers->font = font; return pointers; diff --git a/src/kernel/syscall/actions/sys_scancode.c b/src/kernel/syscall/actions/sys_scancode.c new file mode 100644 index 0000000..612326a --- /dev/null +++ b/src/kernel/syscall/actions/sys_scancode.c @@ -0,0 +1,11 @@ +#include <stdint.h> +#include <kernel/input/input.h> +#include <kernel/io/io.h> + +uint32_t sys_scancode() +{ + sti(); + uint32_t key = wait_scancode(); + cli(); + return key; +}
\ No newline at end of file diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c index dec3d38..7433799 100644 --- a/src/kernel/syscall/syscall.c +++ b/src/kernel/syscall/syscall.c @@ -11,7 +11,7 @@ typedef uint32_t (*syscall_func)(uint32_t, ...); uint32_t (*syscalls[])() = { [0] = (uint32_t(*)())halt_loop, // DEBUG! [1] = sys_exec, [2] = (uint32_t(*)())sys_putch, - [3] = sys_getch, + [3] = sys_scancode, [4] = sys_malloc, [5] = sys_free, [6] = sys_pointers }; @@ -27,8 +27,8 @@ void syscall_handler(struct regs *r) if (!location) return; - log("[SYSCALL] %s called %d with 0x%x 0x%x 0x%x 0x%x 0x%x", current_proc->name, r->eax, - location, r->ebx, r->ecx, r->edx, r->esi, r->edi); + log("[SYSCALL] %d at [0x%x] with 0x%x 0x%x 0x%x 0x%x", r->eax, location, r->ebx, r->ecx, + r->edx, r->esi, r->edi); r->eax = location(r->ebx, r->ecx, r->edx, r->esi, r->edi); diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h index b0a15c4..502064b 100644 --- a/src/kernel/syscall/syscall.h +++ b/src/kernel/syscall/syscall.h @@ -11,7 +11,7 @@ uint32_t sys_exec(char *path); uint32_t sys_putch(char ch); -uint32_t sys_getch(); +uint32_t sys_scancode(); uint32_t sys_malloc(uint32_t count); diff --git a/src/kernel/system.c b/src/kernel/system.c index 6d5afca..37c81c4 100644 --- a/src/kernel/system.c +++ b/src/kernel/system.c @@ -7,37 +7,6 @@ #include <kernel/lib/stdio.h> #include <stdarg.h> -char *vga_buffer = (char *)0x500; - -void vga_clear() -{ - uint16_t *terminal_buffer = (uint16_t *)0xB8000; - for (size_t y = 0; y < 25; y++) - for (size_t x = 0; x < 80; x++) - terminal_buffer[y * 80 + x] = 0 | (uint16_t)0x700; -} - -static int line = 0; - -void vga_log(char *msg) -{ - if (line == 0) - vga_clear(); - uint16_t *terminal_buffer = (uint16_t *)0xB8000; - for (size_t i = 0; i < strlen(msg); i++) - terminal_buffer[line * 80 + i] = (uint16_t)msg[i] | (uint16_t)0x700; - info("%s", msg); - char string[80]; - strcpy(string, "["); - strcat(string, itoa((int)get_time())); - strcat(string, "] "); - strcat(string, "INF: "); - strcat(string, msg); - strcat(string, "\n"); - strcat(vga_buffer, string); - line++; -} - void _debug(const char *f, const char *fmt, ...) { serial_printf(MAG "[%s] " RES, f); @@ -119,7 +88,7 @@ loop: void v86(uint8_t code, regs16_t *regs) { - /* paging_disable(); */ + paging_disable(); int32(code, regs); - /* paging_enable(); */ + paging_enable(); }
\ No newline at end of file diff --git a/src/kernel/system.h b/src/kernel/system.h index eff7925..06a2378 100644 --- a/src/kernel/system.h +++ b/src/kernel/system.h @@ -26,17 +26,6 @@ typedef struct __attribute__((packed)) { extern void int32(unsigned char intnum, regs16_t *regs); /** - * The vga log buffer to transfer the logs to VESA - */ -char *vga_buffer; - -/** - * Log a message before VESA has been initialized - * @param msg The message - */ -void vga_log(char *msg); - -/** * Display a general log message * @param fmt The message */ diff --git a/src/kernel/tasks/process.c b/src/kernel/tasks/process.c index d45ab50..a3bb8d0 100644 --- a/src/kernel/tasks/process.c +++ b/src/kernel/tasks/process.c @@ -170,7 +170,7 @@ uint32_t process_fork(uint32_t pid) proc->pid = current_proc->pid; process_spawn(proc);*/ - return pid++; + return 0; //pid++; } struct process *process_from_pid(uint32_t pid) |