This document gives an overview on the GeckOS V2 kernel interface.
I try to keep this documentation as correct and up-to-date as possible, but if in doubt, read the source…
There are comments like "this need not be available in all OS implementations". These comments mostly refer to the embedded versions of the OS where the kernel can be shortened to (almost) 2k in size by leaving out some stuff not necessary for the particular application.
Most kernel routines return an error code in the accumlator (a), if the carry flag is reset upon return. Otherwise the ac might contain data.
Please note that, in the real system the address could be basically anywhere depending on the architecture. The loader relocates them on the basis of the OSA2KERNEL label: the file contains it as undefined label, and the loader relocates the kernel addresses that are stored as offset to this base as appropriate. In this table only the offsets to the kernel jump table label OSA2KERNEL are given.
- +$00 RESET
-
System reset
For more information on MMU memory management handling see MMU.
The stream handling is described further in section Streams.
- +$09 GETSTR
-
Get a free stream. increase read and write task counter
- +$0c FRESTR
-
decreases read and write task counter, thus freeing the stream, if both result in zero.
- +$0f PUTC
-
puts a byte on the stream.
- +$12 GETC
-
Get a byte from the stream.
- +$15 UNGETC
-
Gives byte from stream back.
- +$18 STRCMD
-
executes a stream command.
The scheduler is further described in section Scheduler.
- +$1e FORK
-
start a new task.
- +$21 TERM
-
ends the current thread.
- +$24 KILL
-
ends a complete task, with all threads in them.
- +$27 YIELD
-
just give control back to the scheduler.
- +$2a FORKT
-
forks a new thread in the current task.
- +$30 GETINFO2
-
returns process information about all (up to 16) running tasks
- +$33 DUP
-
set new STD* stream
- +$5a GETPID
-
returns the current task ID in x and the current thread ID
- +$5d SLOCK
-
locks scheduler to actual task.
- +$60 RENICE
-
changes the priority of the current task.
- +$63 CHECKCHLD
-
returns status of terminates children (if SIG_CHLD is set)
- +$66 SETINFO
-
setinfo updates the task table
Semaphores are further described in section Semaphores.
The interprocess communication using SEND and RECEIVE is further described in section SEND/RECEIVE.
Signals are further described in section Signals.
- +$5a GETPID
-
Get thread and task IDs for the current thread.
- +$5d SLOCK
-
Lock the scheduler to the own thread (deprecated)
- +$60 RENICE
-
Change the task priority
- +$63 CHECKCHLD
-
Check the status of terminated or suspended child tasks
- +$66 SETINFO
-
Set fields in the task table
- +$69 LOCKSEM
-
Lock a semaphore to the current task (even after doing VSEM)
- +$6c JOBCMD
-
Job control functions
Error codes are described in section Errors.
The boot process is further discussed in section Startup.
For file handling see the section Filesystems.
For accessing the internet, see section SLIP.
The change from kernel 1.3 to kernel 2.0 is radical in some things, but conservative in others. The complete environment handling has been rewritten to make it easier to port to different platforms. Also threads have been introduced. Therefore all the memory management and interprocess communication calls have changed as well. The scheduler is now a lot faster, as no more checks are done for threads in the waiting list.
Although most routines have been rewritten, many of these calls still have the same parameters and behave the same way. Also the PCBUF is still used (unfortunately). This is the general communications buffer needed for filesystem operation and some kernel calls. It is a global buffer, and as such it is protected by the SEM_SENDBUF system semaphore. Each task that wants to use has to allocate this semaphore with PSEM before using the buffer.
Also there still is no block oriented communication, although the stream based communication has been improved by the out-of-band error, brk and push/pull flags.