SYSCALLS

Syscall handler functions.

Author

Luca Donno, Antonio Lopez, Samuele Marro, Edoardo Merli

Version

0.2.0

Date

2021-03-14

Copyright

Copyright (c) 2021

Functions

void createProcess(state_t *statep, support_t *supportp)

SYS1: creates a new process using the state and the support structures provided.

If no memory is available an error code -1 is placed in the caller’s v0 register, otherwise 0.

Parameters
  • statep – Initial state of the new process.

  • supportp – Support structure used by the support level.

void termProcess()

SYS2: kills the running process and all its progeny.

void passeren(semaphore *semAdd)

SYS3 (P): performs a P operation on the semaphore provided.

Parameters

semAdd – Pointer to the semaphore to perform the P on.

pcb_t *verhogen(semaphore *semAdd)

SYS4 (V): performs a V operation on the semaphore provided.

Parameters

semAdd – Pointer to the semaphore to perform the V on.

Returns

Pointer to the PCB of the process that was eventually unblocked by the V operation, NULL if there was no process to be unblocked.

void ioWait(int intlNo, int dNum, bool waitForTermRea)

SYS5: waits for an I/O operation.

It performs a P operation on the semaphore of the selected (sub)device. The process state is saved and the scheduler is called.

Parameters
  • intlNo – Interrupt line number in [3, 7].

  • dNum – Device number in [0, 7].

  • waitForTermRead – Terminal read or write.

void getTime(cpu_t *resultAddress)

SYS6: stores the real time since the beginning of the process’ execution in the provided address.

Parameters

resultAddress – Address where the real time will be stored.

void clockWait()

SYS7: blocks the process until the next Interval Timer tick.

void getSupportPtr(support_t **resultAddress)

SYS8: stores the pointer to the process’ support structure in the provided address.

Parameters

resultAddress – Address where the support structure will be stored.