Seamless task switching
This commit is contained in:
parent
b0bcc697ce
commit
5d9a3055b7
|
@ -25,7 +25,7 @@ void run_program(uint8_t* code, size_t code_length, uint8_t* data, size_t data_l
|
||||||
struct CPUState target = {
|
struct CPUState target = {
|
||||||
.eip = (size_t) userland_code,
|
.eip = (size_t) userland_code,
|
||||||
.esp = 0x00400800,
|
.esp = 0x00400800,
|
||||||
.eax = 0x00400800,
|
.eax = 0x00400000,
|
||||||
.ebx = 0,
|
.ebx = 0,
|
||||||
.ecx = 0,
|
.ecx = 0,
|
||||||
.edx = 0,
|
.edx = 0,
|
||||||
|
|
|
@ -15,12 +15,13 @@
|
||||||
|
|
||||||
uint8_t program[] = {
|
uint8_t program[] = {
|
||||||
0xcd, 0x80, // int $0x80
|
0xcd, 0x80, // int $0x80
|
||||||
0xb9, 0x02, 0x00, 0x00, 0x00, // mov $0, %ecx
|
|
||||||
0xff, 0xe1, // jmp *%ecx
|
0xff, 0xe1, // jmp *%ecx
|
||||||
};
|
};
|
||||||
|
|
||||||
// uint8_t data[] = "Hello From Userspace\n";
|
uint8_t data[] = "Hello From Userspace\n";
|
||||||
uint8_t data[] = {};
|
|
||||||
|
uint8_t kernel_data[] = "Hello From Kernelspace\n";
|
||||||
|
// uint8_t data[] = {};
|
||||||
|
|
||||||
void irq0();
|
void irq0();
|
||||||
|
|
||||||
|
@ -50,6 +51,8 @@ void kernel_main(void)
|
||||||
while (true) {
|
while (true) {
|
||||||
i += 1;
|
i += 1;
|
||||||
if (i == 1 << 16) {
|
if (i == 1 << 16) {
|
||||||
|
asm("mov %0, %%eax" :: "r" (kernel_data) );
|
||||||
|
asm("mov $0, %ecx");
|
||||||
asm("int $0x80");
|
asm("int $0x80");
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ static void input(char* buffer)
|
||||||
|
|
||||||
void _syscall(uint32_t a, uint32_t b, uint32_t c)
|
void _syscall(uint32_t a, uint32_t b, uint32_t c)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
print((char*) a);
|
print((char*) a);
|
||||||
|
@ -34,6 +33,4 @@ void _syscall(uint32_t a, uint32_t b, uint32_t c)
|
||||||
input((char*) a);
|
input((char*) a);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
terminal_writestring("waow :3\n");
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue