summaryrefslogblamecommitdiff
path: root/doc/syscalls.txt
blob: 39982c0e1ad617c2514fd93f5a71fc09bebab50c (plain) (tree)
1
2
3
4
5
6
7
8

                                                                        


              
                                                                                   

                                                                                                                                






                                                                                                                       
                                                                                                                       
 

                                                                                                   
 


























                                                                                                 

                                                                                                          
 
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
  1		thread_exit		none					Signal kernel that current thread has finished
  2		schedule		none					Switch to next thread (might be the current one)
  3		thread_sleep	ebx: time (int) msecs	Tell kernel to put current thread to sleep
  4		process_exit	ebx: return value (int)	Tell kernel to end current process, cleaning up everything
  5		printk			ebx: addr of a string	Print a message to screen
  6		thread_new		ebx: entry point		Creates a new thread
						ecx: data pointer
						edx: stack pointer
  7		irq_wait		ebx: irq number			Waits for an IRQ (requires privilege PL_DRIVER)
  8		proc_priv		none					Returns current process privilege level

  10	sbrk			ebx: size				Allocates some memory
  11	brk				ebx: new_end			Allocates/frees some memory

  12	mmap			(see linux specs)		not implemented
  13	munmap			(see linux specs)		not implemented

  20	open			ebx: char* filename		open a file, returns a descriptor
  						ecx: mode
  21	open_relative	ebx: root				open a file, returns a descriptor
  						ecx: char* filename
						edx: mode
  22	stat			ebx: char* filename		get file info
  						ecx: struct* info
  23	stat_relative	ebx: root				get file info
  						ecx: char* filename
  						edx: struct* info
  24	statf			ebx: file descriptor	get file info
  						ecx: struct* info
  25	close			ebx: file descriptor	close file
  26	read			ebx: file descriptor	read from file
  						ecx: offset
						edx: length
						esi: pointer to data
  27	write			ebx: file descriptor	write to file
  						ecx: offset
						edx: length
						esi: pointer to data
  28	link			ebx: char* from			symlink/hardlink/mount/...
  						ecx: char* to
						edx: mode

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