the k project
play

The K Project VGA SBRK Conclusion LSE Team EPITA May 06, 2019 - PowerPoint PPT Presentation

The K Project LSE Team Memory layout Syscall handler The K Project VGA SBRK Conclusion LSE Team EPITA May 06, 2019 LSE Team (EPITA) The K Project May 06, 2019 1 / 13 User memory layout The K Project LSE Team Memory layout


  1. The K Project LSE Team Memory layout Syscall handler The K Project VGA SBRK Conclusion LSE Team EPITA May 06, 2019 LSE Team (EPITA) The K Project May 06, 2019 1 / 13

  2. User memory layout The K Project LSE Team Memory layout Syscall handler Needed segments VGA Code SBRK Data Conclusion Optional segments Stack LSE Team (EPITA) The K Project May 06, 2019 2 / 13

  3. Sane memory layout The K Project 0xFFFFFFFFFF LSE Team Memory brk layout User Head User Data Segment Syscall handler rw- User Stack VGA SBRK Conclusion User Data phdr .p_memsz + phdr .p_vaddr User Code Segment User Code r-x memory reserved address Kernel Code/Data 0x00000000 Figure: “Simple” example LSE Team (EPITA) The K Project May 06, 2019 3 / 13

  4. What is needed The K Project LSE Team Memory layout Syscall handler For every segments VGA Find enough space using the given memory allocator SBRK Should not overlap with each other Conclusion For the stack segment Should expand down LSE Team (EPITA) The K Project May 06, 2019 4 / 13

  5. Sane memory layout (again) The K Project 0xFFFFFFFFFF LSE Team Memory brk layout User Head User Data Segment Syscall handler rw- User Stack VGA SBRK Conclusion User Data phdr .p_memsz + phdr .p_vaddr User Code Segment User Code r-x memory reserved address Kernel Code/Data 0x00000000 Figure: “Simple” example LSE Team (EPITA) The K Project May 06, 2019 5 / 13

  6. Syscall The K Project LSE Team Kernel­Land Memory layout Specific Syscall Generic Syscall Handler Handler Syscall handler VGA Table of handlers SBRK Conclusion Trap to kernel Return to caller Put syscall # in Register Call Generic Put arguments in Handler Registers Push arguments Userland Figure: Syscall Processing LSE Team (EPITA) The K Project May 06, 2019 6 / 13

  7. Syscall Gate The K Project LSE Team Memory layout Syscall handler VGA A unique syscall gate (0x80) SBRK int 0x80 Conclusion eax : Syscall number ebx , ecx , edx : Syscall parameters LSE Team (EPITA) The K Project May 06, 2019 7 / 13

  8. Implementation advices The K Project LSE Team Memory layout Syscall handler VGA Jump table SBRK Do not forget to translate the user addresses Conclusion Check for invalid user pointers LSE Team (EPITA) The K Project May 06, 2019 8 / 13

  9. VGA Syscalls The K Project LSE Team Memory layout Syscall handler setvideo VGA Swich between VGA text (3h) and graphic mode (13h) SBRK Conclusion swap frontbuffer Loads the user buffer into the graphic framebuffer LSE Team (EPITA) The K Project May 06, 2019 9 / 13

  10. Syscall SBRK The K Project LSE Team Memory layout Syscall handler VGA Implementations advices SBRK man 2 sbrk Conclusion Find some unused memory in the user data segment LSE Team (EPITA) The K Project May 06, 2019 10 / 13

  11. Address space advices The K Project LSE Team Memory layout Syscall handler VGA You can load and exec any ROM in “flat” mode. SBRK You can exec any ROM in kernel land Conclusion GDB will not understand non-zero base address LSE Team (EPITA) The K Project May 06, 2019 11 / 13

  12. Summary The K Project LSE Team Memory layout Implement the syscall handler Syscall handler VGA Wrap and enable each syscall SBRK Implement the VGA syscalls Conclusion Implement sbrk Notes All of these will be needed in order to run the ROMs. LSE Team (EPITA) The K Project May 06, 2019 12 / 13

  13. Contact The K Project LSE Team Memory layout Syscall handler k[at]lse.epita.fr VGA labos.lse with [K] tag SBRK Conclusion #k (irc.rezosup.org) guillaume.pagnoux[at]lse.epita.fr tom.decrette[at]lse.epita.fr LSE Team (EPITA) The K Project May 06, 2019 13 / 13

Recommend


More recommend