forked from rcore-os/zCore
updated zircon-syscall's commits
This commit is contained in:
parent
902ffd1e3e
commit
289cd8f097
|
@ -1,15 +1,13 @@
|
|||
use super::*;
|
||||
|
||||
/// Draw random bytes from the kernel CPRNG.
|
||||
/// This data should be suitable for cryptographic applications.
|
||||
|
||||
Clients that require a large volume of randomness should consider using these bytes to seed a user-space random number generator for better performance.
|
||||
/// Draw random bytes from the kernel CPRNG.
|
||||
/// This data should be suitable for cryptographic applications.
|
||||
/// > Clients that require a large volume of randomness should consider using these bytes to seed a user-space random number generator for better performance.
|
||||
impl Syscall<'_> {
|
||||
pub fn sys_cprng_draw_once(&self, mut buf: UserOutPtr<u8>, len: usize) -> ZxResult {
|
||||
info!("cprng_draw_once: buf=({:?}; {:?})", buf, len);
|
||||
let mut res = vec![0u8; len];
|
||||
/// Fill random bytes to the buffer
|
||||
kernel_hal::fill_random(&mut res);
|
||||
kernel_hal::fill_random(&mut res);// Fill random bytes to the buffer
|
||||
buf.write_array(&res)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -38,10 +38,10 @@ impl Syscall<'_> {
|
|||
out.write(handle)?;
|
||||
Ok(())
|
||||
}
|
||||
/// Creates a new bus transaction initiator.
|
||||
/// iommu: HandleValue, a handle to an IOMMU
|
||||
/// options: u32, must be 0 (reserved for future definition of creation flags).
|
||||
/// bti_id: u64, a hardware transaction identifier for a device downstream of that IOMMU.
|
||||
/// Creates a new bus transaction initiator.
|
||||
/// iommu: HandleValue, a handle to an IOMMU
|
||||
/// options: u32, must be 0 (reserved for future definition of creation flags).
|
||||
/// bti_id: u64, a hardware transaction identifier for a device downstream of that IOMMU.
|
||||
pub fn sys_bti_create(
|
||||
&self,
|
||||
iommu: HandleValue,
|
||||
|
@ -146,7 +146,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Creates an interrupt object which represents a physical or virtual interrupt.
|
||||
/// Creates an interrupt object which represents a physical or virtual interrupt.
|
||||
pub fn sys_interrupt_create(
|
||||
&self,
|
||||
resource: HandleValue,
|
||||
|
@ -175,7 +175,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Binds or unbinds an interrupt object to a port.
|
||||
/// Binds or unbinds an interrupt object to a port.
|
||||
/// The key used when binding the interrupt will be present in the key field of the ```zx_port_packet_t.```
|
||||
pub fn sys_interrupt_bind(
|
||||
&self,
|
||||
|
@ -221,7 +221,7 @@ impl Syscall<'_> {
|
|||
interrupt.trigger(timestamp)
|
||||
}
|
||||
|
||||
/// Acknowledge an interrupt and re-arm it.
|
||||
/// Acknowledge an interrupt and re-arm it.
|
||||
/// causing it to be eligible to trigger again (and delivering a packet to the port it is bound to).
|
||||
pub fn sys_interrupt_ack(&self, interrupt: HandleValue) -> ZxResult {
|
||||
info!("interupt.ack: interrupt={:?}", interrupt);
|
||||
|
|
|
@ -3,9 +3,9 @@ use zircon_object::dev::*;
|
|||
|
||||
impl Syscall<'_> {
|
||||
|
||||
/// Write debug info to the serial port
|
||||
/// To use the zx_debug_write() function,
|
||||
/// you must specify ```kernel.enable-serial-syscalls=true``` or ```kernel.enable-serial-syscalls=output-only``` on the kernel command line.
|
||||
/// Write debug info to the serial port
|
||||
/// To use the zx_debug_write() function,
|
||||
/// you must specify ```kernel.enable-serial-syscalls=true``` or ```kernel.enable-serial-syscalls=output-only``` on the kernel command line.
|
||||
/// Otherwise, the function returns ZX_ERR_NOT_SUPPORTED.
|
||||
pub fn sys_debug_write(&self, buf: UserInPtr<u8>, len: usize) -> ZxResult {
|
||||
info!("debug.write: buf=({:?}; {:#x})", buf, len);
|
||||
|
|
|
@ -52,8 +52,8 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Create a handle for the exception's thread.
|
||||
/// The exception handle out will be filled with a new handle to the exception thread.
|
||||
/// Create a handle for the exception's thread.
|
||||
/// The exception handle out will be filled with a new handle to the exception thread.
|
||||
pub fn sys_exception_get_thread(
|
||||
&self,
|
||||
exception: HandleValue,
|
||||
|
@ -68,10 +68,10 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Create a handle for the exception's process.
|
||||
/// The exception handle out will be filled with a new handle to the exception process.
|
||||
/// > Only available for job and process exception channels,
|
||||
/// > thread exceptions cannot access their parent process handles.
|
||||
/// Create a handle for the exception's process.
|
||||
/// The exception handle out will be filled with a new handle to the exception process.
|
||||
/// > Only available for job and process exception channels,
|
||||
/// > thread exceptions cannot access their parent process handles.
|
||||
pub fn sys_exception_get_process(
|
||||
&self,
|
||||
exception: HandleValue,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use {super::*, zircon_object::task::ThreadState};
|
||||
|
||||
impl Syscall<'_> {
|
||||
/// Wait on a futex.
|
||||
/// This system call function atomically verifies that ```value_ptr``` still contains the value ```current_value```
|
||||
/// Wait on a futex.
|
||||
/// This system call function atomically verifies that ```value_ptr``` still contains the value ```current_value```
|
||||
/// and sleeps until the futex is made available by a call to ```zx_futex_wake```
|
||||
pub async fn sys_futex_wait(
|
||||
&self,
|
||||
|
@ -73,7 +73,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Wake some number of threads waiting on a futex, optionally transferring ownership to the thread which was woken in the process.
|
||||
/// Wake some number of threads waiting on a futex, optionally transferring ownership to the thread which was woken in the process.
|
||||
/// > Waking up zero threads is not an error condition. Passing in an unallocated address for value_ptr is not an error condition.
|
||||
pub fn sys_futex_wake(&self, value_ptr: UserInPtr<AtomicI32>, count: u32) -> ZxResult {
|
||||
info!("futex.wake: value_ptr={:?}, count={:#x}", value_ptr, count);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use {super::*, core::convert::TryFrom};
|
||||
|
||||
impl Syscall<'_> {
|
||||
/// Creates a duplicate of handle
|
||||
/// Creates a duplicate of handle
|
||||
/// Referring to the same underlying object, with new access rights rights.
|
||||
pub fn sys_handle_duplicate(
|
||||
&self,
|
||||
|
@ -64,7 +64,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Creates a replacement for handle
|
||||
/// Creates a replacement for handle
|
||||
/// Referring to the same underlying object, with new access rights rights.
|
||||
pub fn sys_handle_replace(
|
||||
&self,
|
||||
|
|
|
@ -10,7 +10,7 @@ use {
|
|||
};
|
||||
|
||||
impl Syscall<'_> {
|
||||
/// Creates a guest, which is a virtual machine that can be run within the hypervisor,
|
||||
/// Creates a guest, which is a virtual machine that can be run within the hypervisor,
|
||||
/// with ```vmar_handle``` used to represent the physical address space of the guest.
|
||||
pub fn sys_guest_create(
|
||||
&self,
|
||||
|
@ -51,7 +51,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Sets a trap within a guest.
|
||||
/// Sets a trap within a guest.
|
||||
pub fn sys_guest_set_trap(
|
||||
&self,
|
||||
handle: HandleValue,
|
||||
|
@ -155,7 +155,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Write the state of a VCPU.
|
||||
/// Write the state of a VCPU.
|
||||
/// > It is only valid to write the state of handle when execution has been paused.
|
||||
pub fn sys_vcpu_write_state(
|
||||
&self,
|
||||
|
|
|
@ -7,9 +7,9 @@ use {
|
|||
};
|
||||
|
||||
impl Syscall<'_> {
|
||||
/// Ask for various properties of various kernel objects.
|
||||
/// handle_value: HandleValue, indicates the target kernel object.
|
||||
/// property: u32, indicates which property to get/set.
|
||||
/// Ask for various properties of various kernel objects.
|
||||
/// handle_value: HandleValue, indicates the target kernel object.
|
||||
/// property: u32, indicates which property to get/set.
|
||||
/// buffer: usize, holds the property value, and must be a pointer to a buffer of value_size bytes.
|
||||
pub fn sys_object_get_property(
|
||||
&self,
|
||||
|
@ -223,8 +223,8 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Query information about an object.
|
||||
/// topic: u32, indicates what specific information is desired.
|
||||
/// Query information about an object.
|
||||
/// topic: u32, indicates what specific information is desired.
|
||||
/// buffer: usize, a pointer to a buffer of size buffer_size to return the information.
|
||||
pub fn sys_object_get_info(
|
||||
&self,
|
||||
|
@ -407,7 +407,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Signal an object.
|
||||
/// Signal an object.
|
||||
/// Asserts and deasserts the userspace-accessible signal bits on an object.
|
||||
pub fn sys_object_signal(
|
||||
&self,
|
||||
|
@ -459,7 +459,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Given a kernel object with children objects,
|
||||
/// Given a kernel object with children objects,
|
||||
/// obtain a handle to the child specified by the provided kernel object id.
|
||||
pub fn sys_object_get_child(
|
||||
&self,
|
||||
|
|
|
@ -5,7 +5,7 @@ use {
|
|||
};
|
||||
|
||||
impl Syscall<'_> {
|
||||
/// Create a timer.
|
||||
/// Create a timer.
|
||||
/// This is an object that can signal when a specified point in time has been reached
|
||||
pub fn sys_timer_create(
|
||||
&self,
|
||||
|
@ -67,8 +67,8 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Start a timer.
|
||||
/// To fire the timer immediately pass a deadline less than or equal to 0.
|
||||
/// Start a timer.
|
||||
/// To fire the timer immediately pass a deadline less than or equal to 0.
|
||||
/// The slack parameter specifies a range from deadline - slack to deadline + slack during which the timer is allowed to fire.
|
||||
pub fn sys_timer_set(&self, handle: HandleValue, deadline: Deadline, slack: i64) -> ZxResult {
|
||||
info!(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use {super::*, zircon_object::ipc::Socket, zircon_object::ipc::SocketFlags};
|
||||
|
||||
impl Syscall<'_> {
|
||||
/// Create a socket.
|
||||
/// Create a socket.
|
||||
/// Socket, a connected pair of bidirectional stream transports, that can move only data, and that have a maximum capacity.
|
||||
pub fn sys_socket_create(
|
||||
&self,
|
||||
|
@ -19,7 +19,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Write data to a socket.
|
||||
/// Write data to a socket.
|
||||
/// Attempts to write ```count: usize``` bytes to the socket specified by ```handle_value```.
|
||||
pub fn sys_socket_write(
|
||||
&self,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use {super::*, bitflags::bitflags, zircon_object::vm::*};
|
||||
|
||||
impl Syscall<'_> {
|
||||
/// Create a stream from a VMO.
|
||||
/// Create a stream from a VMO.
|
||||
/// For reads and writes the data in an underlying VMO.
|
||||
pub fn sys_stream_create(
|
||||
&self,
|
||||
|
@ -156,7 +156,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Modify the seek offset.
|
||||
/// Modify the seek offset.
|
||||
/// Sets the seek offset of the stream to ```offset``` relative to ```whence```.
|
||||
pub fn sys_stream_seek(
|
||||
&self,
|
||||
|
|
|
@ -5,9 +5,9 @@ use {
|
|||
};
|
||||
|
||||
impl Syscall<'_> {
|
||||
/// Retrieve a handle to a system event.
|
||||
/// root_job: HandleValue, must be a handle to the root job of the system.
|
||||
/// kind: u32, must be one of the following:
|
||||
/// Retrieve a handle to a system event.
|
||||
/// root_job: HandleValue, must be a handle to the root job of the system.
|
||||
/// kind: u32, must be one of the following:
|
||||
/// ```rust
|
||||
/// const EVENT_OUT_OF_MEMORY: u32 = 1;
|
||||
/// const EVENT_MEMORY_PRESSURE_CRITICAL: u32 = 2;
|
||||
|
|
|
@ -3,7 +3,7 @@ use {super::*, zircon_object::task::*};
|
|||
|
||||
impl Syscall<'_> {
|
||||
|
||||
/// Create a new process.
|
||||
/// Create a new process.
|
||||
/// Upon success, handles for the new process and the root of its address space are returned.
|
||||
pub fn sys_process_create(
|
||||
&self,
|
||||
|
@ -44,7 +44,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Creates a thread within the specified process.
|
||||
/// Creates a thread within the specified process.
|
||||
/// Upon success a handle for the new thread is returned.
|
||||
pub fn sys_thread_create(
|
||||
&self,
|
||||
|
@ -68,7 +68,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Start execution on a process.
|
||||
/// Start execution on a process.
|
||||
/// This system call is similar to ```zx_thread_start()```, but is used for the purpose of starting the first thread in a process.
|
||||
pub fn sys_process_start(
|
||||
&self,
|
||||
|
@ -101,7 +101,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Write one aspect of thread state.
|
||||
/// Write one aspect of thread state.
|
||||
/// The thread state may only be written when the thread is halted for an exception or the thread is suspended.
|
||||
pub fn sys_thread_write_state(
|
||||
&self,
|
||||
|
@ -122,7 +122,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Sets process as critical to job.
|
||||
/// Sets process as critical to job.
|
||||
/// When process terminates, job will be terminated as if ```zx_task_kill()``` was called on it.
|
||||
pub fn sys_job_set_critical(
|
||||
&self,
|
||||
|
@ -170,7 +170,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Terminate the current running thread.
|
||||
/// Terminate the current running thread.
|
||||
/// Causes the currently running thread to cease running and exit.
|
||||
pub fn sys_thread_exit(&mut self) -> ZxResult {
|
||||
info!("thread.exit:");
|
||||
|
@ -179,7 +179,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Suspend the given task.
|
||||
/// Suspend the given task.
|
||||
/// > This function replaces task_suspend. When all callers are updated, ```zx_task_suspend()``` will be deleted and this function will be renamed ```zx_task_suspend()```.
|
||||
pub fn sys_task_suspend_token(
|
||||
&self,
|
||||
|
|
|
@ -87,7 +87,7 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// High resolution sleep.
|
||||
/// High resolution sleep.
|
||||
/// A ```deadline``` value less than or equal to 0 immediately yields the thread.
|
||||
pub async fn sys_nanosleep(&self, deadline: Deadline) -> ZxResult {
|
||||
info!("nanosleep: deadline={:?}", deadline);
|
||||
|
|
|
@ -13,7 +13,7 @@ fn amount_of_alignments(options: u32) -> ZxResult<usize> {
|
|||
}
|
||||
|
||||
impl Syscall<'_> {
|
||||
/// Allocate a new subregion.
|
||||
/// Allocate a new subregion.
|
||||
/// Creates a new VMAR within the one specified by ```parent_vmar```.
|
||||
pub fn sys_vmar_allocate(
|
||||
&self,
|
||||
|
@ -75,7 +75,7 @@ impl Syscall<'_> {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
/// Add a memory mapping.
|
||||
/// Add a memory mapping.
|
||||
/// Maps the given VMO into the given virtual memory address region.
|
||||
pub fn sys_vmar_map(
|
||||
&self,
|
||||
|
@ -162,8 +162,8 @@ impl Syscall<'_> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Destroy a virtual memory address region.
|
||||
/// Unmaps all mappings within the given region, and destroys all sub-regions of the region.
|
||||
/// Destroy a virtual memory address region.
|
||||
/// Unmaps all mappings within the given region, and destroys all sub-regions of the region.
|
||||
/// > This operation is logically recursive.
|
||||
pub fn sys_vmar_destroy(&self, handle_value: HandleValue) -> ZxResult {
|
||||
info!("vmar.destroy: handle={:?}", handle_value);
|
||||
|
|
Loading…
Reference in New Issue