1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:47:35 +00:00

Lots of hacking:

- Turn Keyboard into a CharacterDevice (85,1) at /dev/keyboard.
- Implement MM::unmapRegionsForTask() and MM::unmapRegion()
- Save SS correctly on interrupt.
- Add a simple Spawn syscall for launching another process.
- Move a bunch of IO syscall debug output behind DEBUG_IO.
- Have ASSERT do a "cli" immediately when failing.
  This makes the output look proper every time.
- Implement a bunch of syscalls in LibC.
- Add a simple shell ("sh"). All it can do now is read a line
  of text from /dev/keyboard and then try launching the specified
  executable by calling spawn().

There are definitely bugs in here, but we're moving on forward.
This commit is contained in:
Andreas Kling 2018-10-23 10:12:50 +02:00
parent 72514c8b97
commit fe237ee215
29 changed files with 276 additions and 32 deletions

View file

@ -28,6 +28,7 @@ asm(
" pushw %ss\n"
" pushw %ss\n"
" pushw %ss\n"
" pushw %ss\n"
" popw %ds\n"
" popw %es\n"
" popw %fs\n"
@ -35,6 +36,7 @@ asm(
" mov %esp, state_dump\n"
" call clock_handle\n"
" popw %gs\n"
" popw %gs\n"
" popw %fs\n"
" popw %es\n"
" popw %ds\n"
@ -117,13 +119,18 @@ void clock_handle()
// If this IRQ occurred while in a user task, wouldn't that also push the stack ptr?
current->tss().esp = regs.esp + 12;
// FIXME: Is this really safe? What if the interrupted process didn't have SS==DS?
current->tss().ss = regs.ds;
current->tss().ss = regs.ss;
if ((current->tss().cs & 3) != 0) {
// What do I do now?
kprintf("clk'ed across to ring0\n");
HANG;
#if 0
kprintf("clock'ed across to ring0\n");
kprintf("code: %w:%x\n", current->tss().cs, current->tss().eip);
kprintf(" stk: %w:%x\n", current->tss().ss, current->tss().esp);
kprintf("astk: %w:%x\n", regs.ss_if_crossRing, regs.esp_if_crossRing);
//HANG;
#endif
current->tss().ss = regs.ss_if_crossRing;
current->tss().esp = regs.esp_if_crossRing;
}
// Prepare a new task to run;