libstd/syscalls.68k

89 lines
1.8 KiB
Plaintext

section .text,text
public syscall_exit
; Exits the process
syscall_exit:
move.l #0, d0
trap #0
rts
public syscall_yield
; Yields to the next process
syscall_yield:
move.l #1, d0
rts
public syscall_print
; Prints the string pointed to by d0
syscall_print:
move.l d0, d1
move.l #2, d0
trap #0
rts
public syscall_println
; Prints the string pointed to by d0 followed by a newline
syscall_println:
move.l d0, d1
move.l #3, d0
trap #0
rts
public syscall_vmem_map
; Maps the range of pages starting at address a0 with length d0 to free physical frames
; Permission flags in d1
syscall_vmem_map:
move.l d2, -(a7)
move.l d1, d2
move.l d0, d1
move.l #4, d0
trap #0
move.l (a7)+, d2
rts
public syscall_vmem_map_free
; Map a free range of pages with length d0 to free physical frames
; Returns the range start in a0
; Permission flags in d1
syscall_vmem_map_free:
move.l d2, -(a7)
move.l d1, d2
move.l d0, d1
move.l #5, d0
trap #0
move.l (a7)+, d2
rts
public syscall_vmem_map_free_to
; Maps a free range of virtual pages with length d1 to the range of physical frames starting at d0
; Returns the range start in a0
; Permission flags in d2
syscall_vmem_map_free_to:
move.l d3, -(a7)
move.l d2, d3
move.l d1, d2
move.l d0, d1
move.l #6, d0
trap #0
move.l (a7)+, d3
rts
public syscall_vmem_set_flags
; Sets the permission flags of the range of virtual pages starting at address a0 with length d1 to d0
syscall_vmem_set_flags:
move.l d2, -(a7)
move.l d1, d2
move.l d0, d1
move.l #7, d0
trap #0
move.l (a7)+, d2
rts
public syscall_vmem_copy_to_secondary
; Copies the range of page mappings at address a0 in the primary space with length d0 to the secondary space starting at address a1
syscall_vmem_copy_to_secondary:
move.l d0, d1
move.l #8, d0
trap #0
rts