#include #include struct cpu_state* syscall(struct cpu_state* cpu) { switch (cpu->eax) { case 0: /* putc */ kprintf("%c", cpu->ebx); break; case 1: /* clear_screen */ clear_screen(); break; case 2: /* set_color */ color = cpu->ebx; break; case 3: /* getch() */ cpu->ebx = keyboard_buffer; keyboard_buffer = 0; break; case 4: /* shutdown/reboot/(hibernate) */ switch(cpu->ebx) { case 0: // shutdown kprintf("\nDo you realy want to shutdown the computer NOW? N"); wait_key(); int c = wait_key(); if(c == 'y' || c == 'Y') { shutdown(); } break; case 1: // reboot kprintf("\nDo you realy want to reboot the computer NOW? N"); wait_key(); c = wait_key(); if(c == 'y' || c == 'Y') { outb(0x64, 0xFE); } break; } break; case 5: /* aktuelle cursorposition setzen */ switch(cpu->edx) { case 0: /* absolute position */ /* -1 = unverändert */ if(cpu->ebx != -1) posX = cpu->ebx; if(cpu->ecx != -1) posY = cpu->ecx; break; case 1: /* x position relativ */ /* 1 = ++, -1 = --; */ posX += cpu->ebx; break; case 2: /* y position relativ */ /* 1 = ++, -1 = --; */ posY += cpu->ebx; break; } move_cursor(posX, posY); break; case 6: /* get_message(); */ cpu->eax = current_task->message; cpu->ebx = current_task->msgparams; current_task->message = 0; current_task->msgparams = 0; break; case 7: /* get date */ cpu->eax = system_time.tm_mday; cpu->ebx = system_time.tm_mon; cpu->ecx = system_time.tm_year; break; case 8: /* get time */ cpu->eax = system_time.tm_hour; cpu->ebx = system_time.tm_min; cpu->ecx = system_time.tm_sec; break; case 9: /* putpixel() */ putpixel(cpu->ebx, cpu->ecx, cpu->edx, cpu->esi); break; case 10: /* draw system content */ draw_system_data(); break; case 11: /* get video resolution */ cpu->eax = lfb_width; cpu->ebx = lfb_height; cpu->ecx = lfb_depth; break; case 12: /* get char from serial port */ cpu->eax = inb(0x3F8); break; case 13: cpu->eax = (int)kalloc(cpu->ebx); break; } return cpu; }