diff options
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/gdt/gdt.c | 4 | ||||
-rw-r--r-- | src/kernel/paging/paging.c | 1 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_alloc.c | 7 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_free.c | 8 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_paging_alloc.c | 9 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_paging_free.c | 8 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.c | 4 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.h | 4 | ||||
-rw-r--r-- | src/kernel/system.c | 2 |
9 files changed, 23 insertions, 24 deletions
diff --git a/src/kernel/gdt/gdt.c b/src/kernel/gdt/gdt.c index ea492b6..49d5ce6 100644 --- a/src/kernel/gdt/gdt.c +++ b/src/kernel/gdt/gdt.c @@ -104,7 +104,7 @@ void gdt_install() void tss_write(int32_t num, uint16_t ss0) { uint32_t base = (uint32_t) &tss_entry; - uint32_t limit = base + sizeof(struct tss_entry_struct); + uint32_t limit = base + sizeof(tss_entry); gdt_set_gate(num, base, limit, 0xE9, 0x00); @@ -119,5 +119,5 @@ void tss_write(int32_t num, uint16_t ss0) void tss_flush(void) { tss_entry.esp0 = 4096 + (uint32_t) kmalloc(4096); - asm volatile ("ltr %%ax": : "a" (0x2A)); + asm volatile ("ltr %%ax": : "a" (0x2B)); }
\ No newline at end of file diff --git a/src/kernel/paging/paging.c b/src/kernel/paging/paging.c index 33c57bd..e23c02c 100644 --- a/src/kernel/paging/paging.c +++ b/src/kernel/paging/paging.c @@ -146,6 +146,7 @@ uint32_t paging_alloc_pages(uint32_t count) { uint32_t ptr = paging_find_pages(count); paging_set_used(ptr, count); + paging_set_user(ptr, count); return ptr; } diff --git a/src/kernel/syscall/actions/sys_alloc.c b/src/kernel/syscall/actions/sys_alloc.c new file mode 100644 index 0000000..6579e0e --- /dev/null +++ b/src/kernel/syscall/actions/sys_alloc.c @@ -0,0 +1,7 @@ +#include <stdint.h> +#include <kernel/lib/stdlib/liballoc.h> + +uint32_t sys_alloc(uint32_t count) +{ + return (uint32_t) umalloc(count); +}
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_free.c b/src/kernel/syscall/actions/sys_free.c new file mode 100644 index 0000000..6c3a82f --- /dev/null +++ b/src/kernel/syscall/actions/sys_free.c @@ -0,0 +1,8 @@ +#include <stdint.h> +#include <kernel/lib/stdlib/liballoc.h> + +uint32_t sys_free(uint32_t ptr) +{ + ufree((void *) ptr); + return 0; +}
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_paging_alloc.c b/src/kernel/syscall/actions/sys_paging_alloc.c deleted file mode 100644 index 57ffd39..0000000 --- a/src/kernel/syscall/actions/sys_paging_alloc.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdint.h> -#include <kernel/paging/paging.h> - -uint32_t sys_paging_alloc(uint32_t count) -{ - uint32_t ptr = paging_alloc_pages((uint32_t) count); - paging_set_user(ptr, count); - return ptr; -}
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_paging_free.c b/src/kernel/syscall/actions/sys_paging_free.c deleted file mode 100644 index cdf7bb1..0000000 --- a/src/kernel/syscall/actions/sys_paging_free.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <stdint.h> -#include <kernel/paging/paging.h> - -uint32_t sys_paging_free(uint32_t virt, uint32_t count) -{ - paging_set_free(virt, count); - return count; -}
\ No newline at end of file diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c index 5f32c42..7ca7f99 100644 --- a/src/kernel/syscall/syscall.c +++ b/src/kernel/syscall/syscall.c @@ -13,8 +13,8 @@ uint32_t (*syscalls[])() = { [3] = (uint32_t (*)()) sys_writec, [4] = sys_readc, [5] = sys_get_pointers, - [6] = sys_paging_alloc, - [7] = sys_paging_free + [6] = sys_alloc, + [7] = sys_free }; void syscall_handler(struct regs *r) diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h index ae69800..229cf04 100644 --- a/src/kernel/syscall/syscall.h +++ b/src/kernel/syscall/syscall.h @@ -15,8 +15,8 @@ uint32_t sys_readc(char *ch); uint32_t sys_get_pointers(); -uint32_t sys_paging_alloc(uint32_t count); +uint32_t sys_alloc(uint32_t count); -uint32_t sys_paging_free(uint32_t virt, uint32_t count); +uint32_t sys_free(uint32_t ptr); #endif
\ No newline at end of file diff --git a/src/kernel/system.c b/src/kernel/system.c index f7c7fc8..c37c890 100644 --- a/src/kernel/system.c +++ b/src/kernel/system.c @@ -18,7 +18,7 @@ void vga_clear() terminal_buffer[y * 80 + x] = 0 | (uint16_t) 0x700; } -static line = 0; +static int line = 0; void vga_log(char *msg) { |