IBNOS
Enumerations
Syscalls

Enumerations

enum  {
  SYSCALL_YIELD, SYSCALL_EXIT_PROCESS, SYSCALL_EXIT_THREAD, SYSCALL_GET_CURRENT_PROCESS,
  SYSCALL_GET_CURRENT_THREAD, SYSCALL_GET_MONOTONIC_CLOCK, SYSCALL_GET_PROCESS_INFO, SYSCALL_EXECUTE_PROGRAM,
  SYSCALL_GET_THREADLOCAL_STORAGE_BASE = 0x100, SYSCALL_GET_THREADLOCAL_STORAGE_LENGTH, SYSCALL_GET_PROGRAM_ARGUMENTS_BASE, SYSCALL_GET_PROGRAM_ARGUMENTS_LENGTH,
  SYSCALL_GET_ENVIRONMENT_VARIABLES_BASE, SYSCALL_GET_ENVIRONMENT_VARIABLES_LENGTH, SYSCALL_ALLOCATE_MEMORY = 0x200, SYSCALL_RELEASE_MEMORY,
  SYSCALL_FORK = 0x300, SYSCALL_CREATE_THREAD, SYSCALL_CREATE_EVENT, SYSCALL_CREATE_SEMAPHORE,
  SYSCALL_CREATE_PIPE, SYSCALL_CREATE_TIMER, SYSCALL_OBJECT_DUP = 0x400, SYSCALL_OBJECT_DUP2,
  SYSCALL_OBJECT_EXISTS, SYSCALL_OBJECT_COMPARE, SYSCALL_OBJECT_CLOSE, SYSCALL_OBJECT_SHUTDOWN,
  SYSCALL_OBJECT_GET_STATUS, SYSCALL_OBJECT_WAIT, SYSCALL_OBJECT_SIGNAL, SYSCALL_OBJECT_WRITE,
  SYSCALL_OBJECT_READ, SYSCALL_OBJECT_ATTACH_OBJ, SYSCALL_OBJECT_DETACH_OBJ, SYSCALL_CONSOLE_WRITE = 0x500,
  SYSCALL_CONSOLE_WRITE_RAW, SYSCALL_CONSOLE_CLEAR, SYSCALL_CONSOLE_GET_SIZE, SYSCALL_CONSOLE_SET_COLOR,
  SYSCALL_CONSOLE_GET_COLOR, SYSCALL_CONSOLE_SET_CURSOR, SYSCALL_CONSOLE_GET_CURSOR, SYSCALL_CONSOLE_SET_HARDWARE_CURSOR,
  SYSCALL_CONSOLE_GET_HARDWARE_CURSOR, SYSCALL_CONSOLE_SET_FLAGS, SYSCALL_CONSOLE_GET_FLAGS, SYSCALL_FILESYSTEM_SEARCH_FILE = 0x600,
  SYSCALL_FILESYSTEM_SEARCH_DIRECTORY, SYSCALL_FILESYSTEM_OPEN
}
 

Detailed Description

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Syscall table

Enumerator
SYSCALL_YIELD 

Schedule another process.

  • Parameters: None
  • Returns: Nothing
SYSCALL_EXIT_PROCESS 

Exit current process.

  • Parameters:
    • Exitcode
  • Returns: Nothing (never returns)
SYSCALL_EXIT_THREAD 

Exit current thread.

  • Parameters:
    • Exitcode
  • Returns: Nothing (never returns)
SYSCALL_GET_CURRENT_PROCESS 

Allocates a new handle which points to the current process.

  • Parameters: None
  • Returns: Handle to the current process
SYSCALL_GET_CURRENT_THREAD 

Allocates a new handle which points to the current thread.

  • Parameters: None
  • Returns: Handle to the current thread
SYSCALL_GET_MONOTONIC_CLOCK 

Returns the current kernel timestamp (in milliseconds)

  • Parameters: None
  • Returns: Kernel timestamp (lower 32bit)
SYSCALL_GET_PROCESS_INFO 

Returns information about all running processes in the system

  • Parameters:
    • Pointer to an array of processInfo structures
    • Number of entries in the array
  • Returns:
    • Number of processes (can also be greater than the number of entries in the array)
SYSCALL_EXECUTE_PROGRAM 

Replaces the current process with the one specified by the handle.

  • Parameters:
    • Pointer to a file object
    • Argument buffer
    • Length of argument buffer
  • Returns:
    • Nothing
SYSCALL_GET_THREADLOCAL_STORAGE_BASE 

Get thread local storage address.

  • Parameters: None
  • Returns:
    • Pointer to thread local storage
SYSCALL_GET_THREADLOCAL_STORAGE_LENGTH 

Get thread local storage length in bytes.

  • Parameters: None
  • Returns:
    • Length in bytes
SYSCALL_GET_PROGRAM_ARGUMENTS_BASE 

Get the program argument array.

  • Parameters: None
  • Returns:
    • Pointer to the argument array (if any)
SYSCALL_GET_PROGRAM_ARGUMENTS_LENGTH 

Get the length of the memory section reserved for the argument array.

  • Parameters: None
  • Returns:
    • Length in bytes
SYSCALL_GET_ENVIRONMENT_VARIABLES_BASE 

Get the program environment variables.

  • Parameters: None
  • Returns:
    • Pointer to the environment variable array (if any)
SYSCALL_GET_ENVIRONMENT_VARIABLES_LENGTH 

Get the length of the memory section reserved for the environment variables.

  • Parameters: None
  • Returns:
    • Length in bytes
SYSCALL_ALLOCATE_MEMORY 

Allocate virtual pages.

  • Parameters:
    • Number of pages to allocate
  • Returns:
    • Pointer to the first page
SYSCALL_RELEASE_MEMORY 

Free virtual pages.

  • Parameters:
    • Pointer to the first page to free
    • Number of pages to free
  • Returns:
    • True on sucess, otherwise false
SYSCALL_FORK 

Fork process.

  • Parameters: None
  • Returns:
    • 0: you are the forked process
    • >0: pid of the client process (i.e. you are the parent process)
    • <0: error
SYSCALL_CREATE_THREAD 

Create a new thread.

  • Parameters:
    • Pointer to the function which should be started in the new thread.
    • (opt) New value of eax
    • (opt) New value of ebx
    • (opt) New value of ecx
    • (opt) New value of edx
  • Returns:
    • Thread handle
SYSCALL_CREATE_EVENT 

Creates a new event object.

  • Parameters:
    • True if all process should be woken up, otherwise only one process will wake up
  • Returns:
    • Event handle
SYSCALL_CREATE_SEMAPHORE 

Creates a new semaphore object.

  • Parameters:
    • Initial value of the semaphore
  • Returns:
    • Semaphore handle
SYSCALL_CREATE_PIPE 

Creates a new pipe object.

  • Parameters: None
  • Returns:
    • Pipe handle
SYSCALL_CREATE_TIMER 

Creates a new timer object.

  • Parameters:
    • True if all process should be woken up, otherwise only one process will wake up
  • Returns:
    • Timer handle
SYSCALL_OBJECT_DUP 

Duplicates a handle

  • Parameters:
    • any kernel handle
  • Returns:
    • new kernel handle
SYSCALL_OBJECT_DUP2 

Replaces a kernel handle with a new object

  • Parameters:
    • soure kernel handle
    • destination kernel handle
  • Returns:
    • new kernel handle
SYSCALL_OBJECT_EXISTS 

Checks if a given handle exists.

  • Parameters:
    • Handle to a kernel object
  • Returns:
    • True if it exists, otherwise false
SYSCALL_OBJECT_COMPARE 

Checks if two handles point to the same kernel object.

  • Parameters:
    • Handle 1
    • Handle 2
  • Returns:
    • -1 if both handles are invalid
    • True if both handles are equal, otherwise false
SYSCALL_OBJECT_CLOSE 

Closes a specific handle. The object can still remain if other handles also point to it.

  • Parameters:
    • Handle to a kernel object
  • Returns:
    • True on success, otherwise false
SYSCALL_OBJECT_SHUTDOWN 

Forces shutdown of a specific kernel object (for example thread termination, closing pipes, ...)

  • Parameters:
    • Handle to a kernel object
    • (opt) Mode paramter
  • Returns:
    • True on success, otherwise false
SYSCALL_OBJECT_GET_STATUS 

Returns an integer representing the internal state of an object. If an object has multiple states the mode parameter can be used to query each one individually. The exact meaning depends on the type of the object.

  • Parameters:
    • Handle to a kernel object
    • (opt) Mode parameter
  • Returns:
    • True on success, otherwise false
SYSCALL_OBJECT_WAIT 

Waits for a specific action related to the kernel object (thread or process termination, semaphore). The exact meaning depends on the type of the object.

  • Parameters:
    • Handle to a kernel object
    • (opt) Mode parameter
  • Returns:
    • -1: invalid handle or wakeup because of a critical error (for example object deleted)
    • otherwise: result value (depending on the object)
SYSCALL_OBJECT_SIGNAL 

Wakes up a specific kernel object. This is only valid for specific objects like threads, semaphores or events.

  • Parameters:
    • Handle to a kernel object
    • Result
  • Returns:
    • True on success, otherwise false
SYSCALL_OBJECT_WRITE 

Writes some data into a kernel object. This is only valid for specific objects like pipes.

  • Parameters:
    • Handle to a kernel object
    • Buffer
    • Length in bytes
  • Returns:
    • >=0: number of bytes written, 0 means that we have to wait for more data
    • <0: invalid handle or pointer
SYSCALL_OBJECT_READ 

Reads some data from a kernel object. This is only valid for specific objects like pipes.

  • Parameters:
    • Handle to a kernel object
    • Buffer
    • Length in bytes
  • Returns:
    • >=0: number of bytes read, 0 means that we have to wait for more data
    • <0: invalid handle or pointer
SYSCALL_OBJECT_ATTACH_OBJ 

Attaches a second kernel object to the first one. This is only valid for specific objects like events.

  • Parameters:
    • Handle to a kernel object
    • Handle to a second object which should be attached
    • (opt) Mode parameter
    • Identifier
  • Returns:
    • True on sucess, otherwise false
SYSCALL_OBJECT_DETACH_OBJ 

Detaches a second kernel object to the first one. This is only valid for specific objects like events.

  • Parameters:
    • Handle to a kernel object
    • Identifier
  • Returns:
    • True on sucess, otherwise false
SYSCALL_CONSOLE_WRITE 

Displays a string on the terminal

  • Parameters:
    • Buffer
    • Length in bytes
  • Returns:
    • >=0: number of bytes written
    • <0: invalid handle or pointer
SYSCALL_CONSOLE_WRITE_RAW 

Displays raw color and character codes on the terminal

  • Parameters:
    • Buffer (uint16_t)
    • Length in characters (half the size of the memory)
  • Returns:
    • >=0: number of bytes written
    • <0: invalid handle or pointer
SYSCALL_CONSOLE_CLEAR 

Clears the terminal, i.e. removes all text

  • Parameters: None
  • Returns: Nothing
SYSCALL_CONSOLE_GET_SIZE 

Get she size of the terminal

  • Parameters:
    • None
  • Returns:
    • higher 16 bit contain the height and lower 16 bit the width
SYSCALL_CONSOLE_SET_COLOR 

Set color for normal text writes

  • Parameters:
    • Packed color (foreground & background color)
  • Returns:
    • Nothing
SYSCALL_CONSOLE_GET_COLOR 

Get the current color of the terminal

  • Parameters:
    • None
  • Returns:
    • Packed color (foreground & background color)
SYSCALL_CONSOLE_SET_CURSOR 

Set the position of the text cursor

  • Parameters:
    • X position
    • Y position
  • Returns:
    • Nothing
SYSCALL_CONSOLE_GET_CURSOR 

Get the current position of the text cursor

  • Parameters:
    • None
  • Returns:
    • Packed position (X & Y position)
SYSCALL_CONSOLE_SET_HARDWARE_CURSOR 

Set the position of the hardware cursor

  • Parameters:
    • X position
    • Y position
  • Returns:
    • Nothing
SYSCALL_CONSOLE_GET_HARDWARE_CURSOR 

Get the current position of the hardware cursor

  • Parameters:
    • None
  • Returns:
    • Packed position (X & Y position)
SYSCALL_CONSOLE_SET_FLAGS 

Set the flags for the console

  • Parameters:
    • Flags
  • Returns:
    • Nothing
SYSCALL_CONSOLE_GET_FLAGS 

Get the current flags for the console

  • Parameters:
    • None
  • Returns:
    • flags
SYSCALL_FILESYSTEM_SEARCH_FILE 

Searches for a given file, and returns a pointer to the file object

  • Parameters:
    • Parent directory handle or (-1)
    • Filename buffer
    • Filename length
    • Create nonexistent file

Returns:

  • Handle to the file object
SYSCALL_FILESYSTEM_SEARCH_DIRECTORY 

Searches for a given directory, and returns a pointer to the directory object

  • Parameters:
    • Parent directory handle or (-1)
    • Directory buffer
    • Directory length
    • Create nonexistent directory

Returns:

  • Handle to the directory object
SYSCALL_FILESYSTEM_OPEN 

Opens a directory or file.

  • Parameters:
    • Handle to a directory/file object
  • Returns:
    • Handle to a opened directory/file object

Definition at line 39 of file syscall.h.