summaryrefslogtreecommitdiff
path: root/doc/syscalls.txt
blob: 28eb636644854168810e301c5b298b395e9348f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Syscalls pass by int64. The identifier of the called function is in eax, parameters
are in ebx, ecx, edx, esi, edi.

Syscall list :

id=eax	Name			Parameters				Description
  0		thread_exit		none					Signal kernel that current thread has finished
  1		schedule		none					Switch to next thread (might be the current one)
  2		thread_sleep	ebx: time (int) msecs	Tell kernel to put current thread to sleep
  3		process_exit	ebx: return value (int)	Tell kernel to end current process, cleaning up everything
  4		printk			ebx: addr of a string	Print a message to screen
  5		thread_new		ebx: entry point		Creates a new thread
						ecx: data pointer
						edx: stack pointer
  6		irq_wait		ebx: irq number			Waits for an IRQ (requires privilege PL_DRIVER)
  7		proc_priv		none					Returns current process privilege level
  8		proc_setheap
  9		shm_create		ebx: offset				Create a shared memory segment at offset (ret = errcode)
						ecx: length
  10	shm_delete		ebx: offset				Delete a shared memory segment at offset (ret = errcode)
  11	msg_register	ebx: service id			Registers current process as owner of a system channel (ret = errcode)
  12	msg_send		ebx: receiver pid		Sends a message to pid or owner of system channel
  						ecx: message data ptr
						edx: message length
  13	msg_info		ebx: answer struct ptr	Get info on the first message of the queue for this process
  						ecx: wait?
  14	msg_get			ebx: pointer to data	Gets the data for first message on the queue; deletes message from queue


If a processes wishes to exit with an error code, it HAS to use process_exit. thread_exit will do nothing.

====== SYSCALL DESCRIPTION ======

= msg_register (10)
Parameters: requested system channel id (int)
Returns: errorcode or 0 on success
Registers current process as owner of given system channel.

= msg_send (11)
Parameters: receiver pid (signed! int), data ptr (void*), data len (unsigned)
Returns: errorcode or 0 on success
Sends a message to given PID or owner of given system channel.

= msg_info (12)
Parameters: pointer to answer struct (msg_info_answer*), wait for request? (bool)
Returns: nothing (all is in answer struct)
Gets info on waiting messages for current process.

= msg_get (13)
Parameters: pointer to data struct (void*)
Returns: errorcode or 0 on failure
Gets the data for a message that is in the queue.