Skip to content

Robbe7730/RCPU_OS

Repository files navigation

RCPU_OS

Kernel implementation running RCPU based on Writing an OS in Rust

Implementation notes

  • All numbers are unsigned 16 bit (u16)
    • Integer overflows can occur
      • For Add, Subtract, Multiply and Divide, the number wraps around (mod 2^16)
      • For Left and Right Shifts, the number gets padded with zeroes
  • The program expects a 16bit addressable memory space with the program loaded starting at 0
  • The binary contains pre-allocated space, which will be loaded with the program
  • All strings are ASCII (7 bit), not Latin-1
  • RCPU_OS stack grows upwards instead of downwards. RCPU has no way of reading from/writing to SP, so this should not matter to the programs.
  • RCPU syscalls "return" by pushing the result to the stack
  • RCPU stream_num is 0 for stdin, 1 for stdout
    • Reading from or writing to an invalid stream (everything except 0 and 1 respectively) causes a panic
  • If Getc cannot read a character, it returns u16::MAX (aka -1 wrapped)
  • Fgets reads blocking until a null-byte is found or num_characters are read
    • If no nullbyte is found, one is put at str_ptr + num_read, so the target string needs to be at least size+1 big if size characters are read
    • To enter a nullbyte the F1 key can be pressed

About

Kernel implementation running RCPU

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published