Skip to content
This repository has been archived by the owner on May 29, 2018. It is now read-only.
VladVP edited this page Mar 21, 2013 · 6 revisions

API Draft

Process functions

  • (INT 0x8000) void exit(word exit_code) - terminates the current process
  • (INT 0x8001) uword exec(uword* path, uword* args, uword** env) - executes the process specified by path with the argument args (one string!) and the environment env (multiple strings), returns the PID
  • (INT 0x8002) uword* arg() - returns the arguments provided as one (1) string
  • (INT 0x8003) uword** env() - returns a list of strings specifing the environment variables (eg. *"PATH=/bin/", *"PORT=8080", 0x0000)

String functions

  • uword strlen(uword* str) - calculates the length of an uncompressed C-string
  • void strcpy(uword* from, uword* to) - copies a string from a source address to a destination address (insecure, use strncpy!)
  • void strncpy(uword* from, uword* to, uword max) - copies a string form a source address to a destination address (with length limitation)

Memory functions

  • void mem_copy(uword* from, uword* to, uword words) - copies memory from source to destination
  • void mem_set(uword* start, uword* len, uword set) - sets the memory to the specified value
  • void mem_clear(uword* start, uword* len) - -> mem_set(start, len, 0x0000)

Memory management

  • void mm_setup(uword* start, uword* len) - Sets up a memory management table for the specified memory
  • uword* mm_alloc(uword* mmt, uword size) - allocates memory and returns a pointer
  • void mm_free(uword* mem) - frees reserved memory
  • uword mm_count(uword* mmt) - counts the amount of free memory

Useful links (for dicussing)

Clone this wiki locally