aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/kernel.c')
-rw-r--r--src/kernel/kernel.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c
index ef58ade..eb78257 100644
--- a/src/kernel/kernel.c
+++ b/src/kernel/kernel.c
@@ -6,13 +6,13 @@
#include <kernel/paging/paging.h>
#include <kernel/input/input.h>
#include <kernel/acpi/acpi.h>
-#include <kernel/syscall/syscall.h>
#include <kernel/smbios/smbios.h>
#include <kernel/fs/install.h>
#include <kernel/lib/lib.h>
-#include <mlibc/stdio.h>
+#include <kernel/syscall/syscall.h>
+#include <kernel/fs/marfs/marfs.h>
-extern void switch_to_user();
+extern void jump_userspace();
void kernel_main()
{
@@ -41,21 +41,22 @@ void kernel_main()
get_smbios();
// Print total memory
- info("Total memory found: %dMiB", memory_get_all() >> 10);
+ info("Total memory found: %dMiB", (memory_get_all() >> 10) + 1);
uint8_t boot_drive_id = (uint8_t) (*((uint8_t *) 0x9000));
- if (boot_drive_id == 0xE0) {
+ if (boot_drive_id == 0xE0)
install_melvix();
- }
// User mode!
- /* COMMENTED FOR DEVELOPMENT OF KERNEL
info("Switching to user mode...");
syscalls_install();
- switch_to_user();
+ tss_flush();
+ uint32_t userspace = paging_alloc_pages(2);
+ paging_set_user(userspace, 2);
+ marfs_read_whole_file(4, (uint8_t *) (userspace + 4096));
+ jump_userspace(userspace + 4096);
panic("This should NOT happen!");
- */
// asm ("div %0" :: "r"(0)); // Exception testing x/0
loop: