mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
In preparation for the new mailbox IPC model, blocking threads needed an overhaul. The `wait_on_*` and `wake_on_*` methods are gone, and the `block()` and `wake()` calls on threads now pass a value between the waker and the blocked thread. As part of this change, the concept of signals on the base kobject class was removed, along with the queue of blocked threads waiting on any given object. Signals are now exclusively the domain of the event object type, and the new wait_queue utility class helps manage waiting threads when an object does actually need this functionality. In some cases (eg, logger) an event object is used instead of the lower-level wait_queue. Since this change has a lot of ramifications, this large commit includes the following additional changes: - The j6_object_wait, j6_object_wait_many, and j6_thread_pause syscalls have been removed. - The j6_event_clear syscall has been removed - events are "cleared" by reading them now. A new j6_event_wait syscall has been added to read events. - The generic close() method on kobject has been removed. - The on_no_handles() method on kobject now deletes the object by default, and needs to be overridden by classes that should not be. - The j6_system_bind_irq syscall now takes an event handle, as well as a signal that the IRQ should set on the event. IRQs will cause a waiting thread to be woken with the appropriate bit set. - Threads waking due to timeout is simplified to just having a wake_timeout() accessor that returns a timestamp. - The new wait_queue uses util::deque, which caused the disovery of two bugs in the deque implementation: empty deques could still have a single array allocated and thus return true for empty(), and new arrays getting allocated were not being zeroed first. - Exposed a new erase() method on util::map that takes a node pointer instead of a key, skipping lookup.
44 lines
1.5 KiB
Modula-2
44 lines
1.5 KiB
Modula-2
import "objects/endpoint.def"
|
|
import "objects/vma.def"
|
|
|
|
# The system object represents a handle to kernel functionality
|
|
# needed by drivers and other priviledged services
|
|
object system : object {
|
|
uid fa72506a2cf71a30
|
|
|
|
capabilities [
|
|
get_log
|
|
bind_irq
|
|
map_phys
|
|
change_iopl
|
|
]
|
|
|
|
# Get a log line from the kernel log
|
|
method get_log [cap:get_log] {
|
|
param buffer buffer [out zero_ok] # Buffer for the log message data structure
|
|
}
|
|
|
|
# Ask the kernel to send this process messages whenever
|
|
# the given IRQ fires
|
|
method bind_irq [cap:bind_irq] {
|
|
param dest ref event # Event object that will receive messages
|
|
param irq uint # IRQ number to bind
|
|
param signal uint # Signal number on the event to bind to
|
|
}
|
|
|
|
# Create a VMA and map an area of physical memory into it,
|
|
# also mapping that VMA into the current process
|
|
method map_phys [cap:map_phys] {
|
|
param area ref vma [out] # Receives a handle to the VMA created
|
|
param phys address # The physical address of the area
|
|
param size size # Size of the area, in pages
|
|
param flags uint32 # Flags to apply to the created VMA
|
|
}
|
|
|
|
# Request the kernel change the IOPL for this process. The only values
|
|
# that make sense are 0 and 3.
|
|
method request_iopl [cap:change_iopl] {
|
|
param iopl uint # The IOPL to set for this process
|
|
}
|
|
}
|