usermode switch func takes params

This commit is contained in:
rami 2024-07-03 12:17:32 -04:00
parent 28cd9deb9b
commit c35191e819
3 changed files with 5 additions and 5 deletions

View File

@ -20,7 +20,7 @@ ISO := Hazel.iso
CFLAGS := -ffreestanding -Wall -Wextra -Werror -I $(INCLUDEDIR) -I lib CFLAGS := -ffreestanding -Wall -Wextra -Werror -I $(INCLUDEDIR) -I lib
LDFLAGS := -ffreestanding -nostdlib -lgcc -T kernel/kernel.ld LDFLAGS := -ffreestanding -nostdlib -lgcc -T kernel/kernel.ld
QEMUFLAGS := -cdrom $(BUILDDIR)/$(ISO) \ QEMUFLAGS := -cdrom $(BUILDDIR)/$(ISO) \
-d int -s -d int \
-m 512M \ -m 512M \
-serial stdio -serial stdio

View File

@ -65,7 +65,8 @@ jmp_user_mode:
mov fs, ax mov fs, ax
mov gs, ax ; SS is handled by iret mov gs, ax ; SS is handled by iret
mov eax, esp mov eax, [esp+4] ; esp arg
mov edx, [esp+8] ; eip arg
push (4*8) | 3 push (4*8) | 3
push eax push eax
pushf pushf

View File

@ -12,10 +12,9 @@ struct idtr idtr = {0};
extern uint32_t isr_stub_table[32]; extern uint32_t isr_stub_table[32];
extern void pit_isr(void); extern void pit_isr(void);
extern void jmp_user_mode(void); extern void jmp_user_mode(uint32_t esp, uint32_t eip);
void test_entry(void) { void test_entry(void) {
asm volatile ("cli" ::);
for (;;) {} for (;;) {}
} }
@ -59,7 +58,7 @@ void kernel(multiboot_info_t *info) {
ctx.ticks = 0; ctx.ticks = 0;
//pit_init(); //pit_init();
jmp_user_mode(); jmp_user_mode(0x5000, (uint32_t)test_entry);
halt: halt:
for (;;) {} for (;;) {}