Seamless task switching

This commit is contained in:
vanten-s 2025-06-30 06:17:56 +02:00
parent b0bcc697ce
commit 5d9a3055b7
Signed by: vanten-s
GPG key ID: DE3060396884D3F2
3 changed files with 7 additions and 7 deletions

View file

@ -25,7 +25,7 @@ void run_program(uint8_t* code, size_t code_length, uint8_t* data, size_t data_l
struct CPUState target = {
.eip = (size_t) userland_code,
.esp = 0x00400800,
.eax = 0x00400800,
.eax = 0x00400000,
.ebx = 0,
.ecx = 0,
.edx = 0,

View file

@ -15,12 +15,13 @@
uint8_t program[] = {
0xcd, 0x80, // int $0x80
0xb9, 0x02, 0x00, 0x00, 0x00, // mov $0, %ecx
0xff, 0xe1, // jmp *%ecx
};
// uint8_t data[] = "Hello From Userspace\n";
uint8_t data[] = {};
uint8_t data[] = "Hello From Userspace\n";
uint8_t kernel_data[] = "Hello From Kernelspace\n";
// uint8_t data[] = {};
void irq0();
@ -50,6 +51,8 @@ void kernel_main(void)
while (true) {
i += 1;
if (i == 1 << 16) {
asm("mov %0, %%eax" :: "r" (kernel_data) );
asm("mov $0, %ecx");
asm("int $0x80");
i = 0;
}

View file

@ -25,7 +25,6 @@ static void input(char* buffer)
void _syscall(uint32_t a, uint32_t b, uint32_t c)
{
/*
switch (c) {
case 0x00:
print((char*) a);
@ -34,6 +33,4 @@ void _syscall(uint32_t a, uint32_t b, uint32_t c)
input((char*) a);
break;
}
*/
terminal_writestring("waow :3\n");
}