mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
Add the syscalls j6_futex_wait and j6_futex_wake. Currently marking this as WIP as they need more testing. Added to support futexes: - vm_area and vm_space support for looking up physical address for a virtual address - libj6 mutex implementation using futex system calls
64 lines
1.8 KiB
Modula-2
64 lines
1.8 KiB
Modula-2
import "objects/object.def"
|
|
|
|
import "objects/channel.def"
|
|
import "objects/event.def"
|
|
import "objects/mailbox.def"
|
|
import "objects/process.def"
|
|
import "objects/system.def"
|
|
import "objects/thread.def"
|
|
import "objects/vma.def"
|
|
|
|
interface syscalls [syscall] {
|
|
uid 01d9b6a948961097
|
|
|
|
expose ref object
|
|
expose ref system
|
|
expose ref event
|
|
expose ref process
|
|
expose ref thread
|
|
expose ref mailbox
|
|
expose ref channel
|
|
expose ref vma
|
|
|
|
# Simple no-op syscall for testing
|
|
function noop
|
|
|
|
# Write a message to the kernel log
|
|
function log {
|
|
param message string
|
|
}
|
|
|
|
# Get a list of handles owned by this process. If the
|
|
# supplied list is not big enough, will set the size
|
|
# needed in `size` and return j6_err_insufficient
|
|
function handle_list {
|
|
param handles struct handle_descriptor [list inout zero_ok] # A list of handles to be filled
|
|
}
|
|
|
|
# Create a clone of an existing handle, possibly with
|
|
# some capabilities masked out.
|
|
function handle_clone {
|
|
param orig ref object [handle cap:clone] # The handle to clone
|
|
param clone ref object [out] # The new handle
|
|
param mask uint32 # The capability bitmask
|
|
}
|
|
|
|
# Block waiting on a futex
|
|
function futex_wait [static] {
|
|
param address uint32* # Address of the futex value
|
|
param current uint32 # Current value of the futex
|
|
param timeout uint64 # Wait timeout in nanoseconds
|
|
}
|
|
|
|
# Wake threads waiting on a futex
|
|
function futex_wake [static] {
|
|
param address uint32* # Address of the futex value
|
|
param count uint64 # Number of threads to wake, or 0 for all
|
|
}
|
|
|
|
# Testing mode only: Have the kernel finish and exit QEMU with the given exit code
|
|
function test_finish [test] {
|
|
param exit_code uint32
|
|
}
|
|
}
|