Skip to content
  • 王振恺's avatar
    OS Lab Part 1: shutdown + getcwd/write/getpid/times/uname · 243c2e8a
    王振恺 authored
    - Align syscall numbers with the contest ABI (exit 93, read 63, write 64,
      close 57, getpid 172, getcwd 17, times 153, uname 160) and add shutdown (29).
      SYS_remove moves 17 -> 28 to free 17 for getcwd.
    - sys_getcwd now returns the buffer address, as the contest tests expect.
    - Implement sys_times (clock ticks -> struct tms) and sys_uname (struct utsname).
    - Implement sys_shutdown via sbi_shutdown() so QEMU exits by itself.
    - init.c becomes a test runner (fork/exec/wait the five test cases, then shut
      down). The Makefile compiles it standalone and embeds it into the kernel as
      initcode[], so it also runs on the grader, whose sdcard.img has its own /init.
    - uvminit() no longer panics above one page; userinit() maps stack for it.
    - Makefile: generate kernel/initcode.h, add `all` target producing kernel-qemu
      and sbi-qemu, and copy the contest test cases into the fs.img root.
    243c2e8a