MINIX 3 Kernel API

来源:互联网 发布:java big5编码 编辑:程序博客网 时间:2024/05/01 06:59
Abstract
In general, kernel calls allow system processes to request kernel
services, for example, to perform for privileged operations. This document
briefly discusses the organization of kernel calls in MINIX 3 and
provides an overview of all kernel calls.
Organization of kernel calls
A kernel call means that a request is sent to a kernel where it is handled by
one of the kernel tasks. The details of assembling a request message, sending
it to the kernel, and awaiting the response are conveniently hidden in a
system library. The header file of this library is src/include/minix/syslib.h
and its implementation is found in src/lib/syslib.
The actual implementation of the kernel calls is defined in one of the
kernel tasks. In contrast to MINIX 2, the CLOCK task no longer accepts system
calls. Instead, all calls are now directed to the SYSTEM task. Suppose
that a program makes a sys call() system call. By convention, this call is
transformed into a request message with type SYS CALL that is sent to the
kernel task SYSTEM. The SYSTEM task handles the request in a function
named do call() and returns the result.
The mapping of kernel call numbers and handler functions is done during
the SYSTEM task’s intialization in src/kernel/system.c. The prototypes
of the handler functions are declared in src/kernel/system.h. Their implementation
is contained in separate files in the directory src/kernel/system/.
These files are compiled into a library src/kernel/system/system.a that is
linked with the kernel.
The kernel call numbers and their request and response parameters are
defined in src/include/minix/com.h. Unfortunately, MINIX 2 does not follow
a strict naming scheme. Therefore, numerous message types and parameters
have been renamed in MINIX 3. Kernel calls now all start with SYS and all
parameters that belong to the same kernel call now share a common prefix.
1
2
Overview of kernel calls in MINIX 3
A concise overview of the kernel calls in MINIX 3 is given in Figure 1. The
status of each call compared to MINIX 2 is given in the last column.
Kernel call Purpose Status
process management
SYS FORK Fork a process; copy parent process
SYS EXEC Execute a process; initialize registers
SYS EXIT Exit a user process; clear process slot U
SYS NICE Change priority of a user process N
SYS PRIVCTL Change system process privileges N
SYS TRACE Trace or control process execution
signal handling
SYS KILL Send a signal to a process U
SYS GETKSIG Check for pending kernel signals N
SYS ENDKSIG Tell kernel signal has been processed
SYS SIGSEND Start POSIX-style signal handler
SYS SIGRETURN Return from POSIX-style signal
memory management
SYS NEWMAP Install new or updated memory map
SYS SEGCTL Add extra, remote memory segment N
SYS MEMSET Write a pattern into physical memory area N
copying data
SYS UMAP Map virtual to physical address U
SYS VIRCOPY Copy data using virtual addressing U
SYS PHYSCOPY Copy data using physical addressing U
SYS VIRVCOPY Handle vector with virtual copy requests U
SYS PHYSVCOPY Handle vector with physical copy requests N
device i/o
SYS DEVIO Read or write a single device register N
SYS SDEVIO Input or output an entire data buffer N
SYS VDEVIO Process vector with multiple requests N
SYS IRQCTL Set or reset an interrupt policy N
SYS INT86 Make a real-mode BIOS call N
SYS IOPENABLE Give process I/O privilege N
system control
SYS ABORT Abort MINIX: shutdown the system U
SYS GETINFO Get a copy system info or kernel data N
clock functionality
SYS SETALARM Set or reset a synchronous alarm timer U
SYS TIMES Get process times and uptime since boot U
Figure 1: This figure provides an overview of the kernel calls in MINIX 3. The
legenda for the status is: to be New or Updated (i.e., fully revised—all calls got
minor updates) since MINIX 2.
3
MINIX 3 kernel call interface
MINIX’ kernel call interface is detailed below. For each kernel call the message
type, the purpose, message type, request and/ or response parameters,
and return value are specified. The shorthand Additional remarks about
the future status of the call also may be provided.
Legenda
CONSTANT: defined constant; a number indicating the request type or status
PARAMETER: message parameter; a field in the request or response message
void sys call(arguments): system library function; shorthand to make a kernel call
Alphabetical overview
SYS ABORT: Shutdown MINIX and return to the boot monitor—if possible. This is used
by PM, FS and TTY. Normal aborts usually are initiated by the user, for example,
by means of the ‘shutdown’ command or typing a ‘Ctrl-Alt-Del’. MINIX will
also be taken down if a fatal error occurs in the PM or FS.
request parameters
ABRT HOW: How to abort. One of the values defined in src/include/unistd.h:
• RBT HALT Halt MINIX and return to the boot monitor.
• RBT REBOOT Reboot MINIX.
• RBT PANIC A kernel panic occurred.
• RBT MONITOR Run the specified code at the boot monitor.
• RBT RESET Hard reset the system.
ABRT MON PROC: Process to get the boot monitor parameters from.
ABRT MON LEN: Length of the boot monitor parameters.
ABRT MON ADDR: Virtual address of the parameters.
return value
OK: The shutdown sequence was started.
ENIVAL: Invalid process number.
EFAULT: Illegal monitor parameters address.
E2BIG: Monitor parameters exceed maximum length.
library functions
int sys abort(int shutdown status, ...);
SYS DEVIO: Perform device I/O on behalf of a user-space device driver. The driver can
request a single port to be read or written with this call. Also see the SYS SDEVIO
and SYS VDEVIO kernel calls.
request parameters
DIO REQUEST: Input or output.
• DIO INPUT Read a value from DIO PORT.
4
• DIO OUTPUT Write DIO VALUE to DIO PORT.
DIO TYPE: A flag indicating the type of values.
• DIO BYTE Byte type.
• DIO WORD Word type.
• DIO LONG Long type.
DIO PORT: The port to be read or written.
DIO VALUE: Value to write to the given port. For DIO OUTPUT only.
response parameters
DIO VALUE: Value that was read from the given port. For DIO INPUT only.
return value
OK: The port I/O was successfully done.
EINVAL: An invalid DIO REQUEST or DIO TYPE was provided.
library functions
int sys in(port t port, unsigned long value, int io type);
int sys inb(port t port, u8 t *byte);
int sys inw(port t port, u16 t *word);
int sys inl(port t port, u32 t *long);
int sys out(port t port, unsigned long *value, int io type);
int sys outb(port t port, u8 t byte);
int sys outw(port t port, u16 t word);
int sys outl(port t port, u32 t long);
SYS ENDKSIG: Finish a kernel signal. The PM uses this call to indicate it has processed
the kernel signals in the map obtained through a SYS GETKSIG kernel call.
response parameters
SIG PROC: The process that it concerns.
return value
EINVAL: The process had no pending signals or already exited.
OK: The kernel cleared all pending signals.
library functions
int sys endksig(int proc nr);
SYS EXEC: Update a process’ registers after a successfull exec() POSIX-call. After the FS
has copied the binary image into memory, the PM informs the kernel about the
new register details.
request parameters
PR PROC NR: Process that executed a program.
PR STACK PTR: New stack pointer.
PR IP PTR: New program counter.
PR NAME PTR: Pointer to name of program.
return value
OK: This call always succeeds.
5
library functions
int sys exec(int proc, char *stack ptr, char *prog name, vir bytes pc);
SYS EXIT: Clear a process slot. This is usually called by the PM to clean up after a
user process exited. System processes, including the PM, can also directly call this
function to exit themselves.
request parameters
PR PROC NR: Slot number of exiting process if caller is PM. Use SELF to exit the
PM.
return value
OK: The cleanup succeeded.
EINVAL: Incorrect process number.
EDONTREPLY: This call does not return if a system process exited.
library functions
int sys exit(int proc nr);
SYS FORK: Allocate a new (child) process in the kernel process table and initialize it based
on the prototype (parent) process. The PM has found a free process slot for the
child process in its own process table and now requests the kernel to update the
kernel’s process table.
request parameters
PR PROC NR: Child’s process table slot.
PR PPROC NR: Parent, the process that forked.
return value
OK: A new process slot was successfully assigned.
EINVAL: Invalid parent process number or child slot in use.
library functions
int sys fork(int parent proc nr, int child proc nr);
SYS GETINFO: Obtain a copy of a kernel data structure. This call supports user-space
device drivers and servers that need certain system information.
request parameters
I REQUEST: The type of system information that is requested.
• GET IMAGE Copy boot image table.
• GET IRQHOOKS Copy table with interrupt hooks.
• GET KINFO Copy kernel information structure.
• GET KMESSAGES Copy buffer with diagnostic kernel messages.
• GET LOCKTIMING Copy lock times—if DEBUG TIME LOCKS is set.
• GET MACHINE Copy system environment.
• GET MONPARAMS Copy parameters set by the boot monitor.
• GET PRIVTAB Copy system privileges table.
• GET PROCTAB Copy entire kernel process table.
• GET PROC Copy single process table slot.
• GET RANDOMNESS Copy randomness gathered by kernel events.
6
• GET SCHEDINFO Copy ready queues and process table.
I VAL PTR: Virtual address where the information should be copied to.
I VAL LEN: Maximum length that the caller can handle.
I VAL PTR2: Optional, second address. Used when copying scheduling data.
I VAL LEN2: Optional, second length. Overloaded for process number.
return value
OK: The information request succeeded.
EFAULT: An illegal memory address was detected.
E2BIG: Requested data exceeds the maximum provided by the caller.
library functions
int sys getinfo(int request, void *ptr, int len, void *ptr2, int len2);
int sys getirqhooks(struct irq hook *ptr);
int sys getimage(struct boot image *ptr);
int sys getkinfo(struct kinfo *ptr);
int sys getkmessages(struct kmessages *ptr);
int sys getlocktimings(struct lock timingdata *ptr);
int sys getmachine(struct machine *ptr);
int sys getmonparams(char *ptr, int max len);
int sys getprivtab(struct priv *ptr);
int sys getproctab(struct proc *ptr);
int sys getproc(struct proc *ptr, int proc nr);
int sys getrandomness(struct randomness *ptr);
int sys getschedinfo(struct proc* ptr, struct proc *ptr2);
SYS GETKSIG: Checks whether there is a process that must be signaled. This is repeatedly
done by the PM after receiving a notification that there are kernel signals pending.
response parameters
SIG PROC: Return next process with pending signals or NONE.
SIG MAP: Bit map with pending kernel signals.
return value
OK: This call always succeeds.
library functions
int sys getksig(int *proc nr, sigset t *sig map);
SYS INT86: Make a real-mode BIOS on behalf of a user-space device driver. This temporarily
switches from 32-bit protected mode to 16-bit real-mode to access the
BIOS calls. It is here to support the BIOS WINI device driver.
request parameters
INT86 REG86: Address of request at the caller.
return value
OK: BIOS call successfully done.
EFAULT: Invalid request address.
library functions
-
7
SYS IOPENABLE: Enable the CPU’s I/O privilege level bits for to the given process, so
that is is allowed to directly perform I/O in user space.
request parameters
PROC NR: The process to give I/O privileges.
return value
OK: Always succeeds.
library functions
-
SYS IRQCTL: Set or reset a hardware interrupt policy for a given IRQ line and enable or
disable interrupts for this line. This call allows user-space device drivers to grab
a hook for use with the kernel’s generic interrupt handler. The kernel’s interrupt
handler merely notifies the driver about the interrupt with a HARD INT message and
reenables the IRQ line if the policy says so. The notification message will contain
the ’id’ provided by the caller as an argument. Once a policy is in place, drivers
can enable and disable interrupts.
request parameters
IRQ REQUEST: Interrupt control request to perform.
• IRQ SETPOLICY Set interrupt policy for the generic interrupt handler.
• IRQ RMPOLICY Remove a previously set interrupt policy.
• IRQ ENABLE Enable IRQs for the given IRQ line.
• IRQ DISABLE Disable IRQs for the given IRQ line.
IRQ VECTOR: IRQ line that must be controlled.
IRQ POLICY : Bit map with flags indicating IRQ policy.
IRQ HOOK ID: When setting a policy this provides index sent to caller upon interrupt.
For other requests it is the kernel hook identifier returned by the kernel.
response parameters
IRQ HOOK ID: Kernel hook identifier associated with the driver.
return value
EINVAL: Invalid request, IRQ line, hook id, or process number.
EPERM: Only owner of hook can toggle interrupts or release the hook.
ENOSPC: No free IRQ hook could be found.
OK: The request was successfully handled.
library functions
int sys irqctl(int request, int irq vec, int policy, int *hook id);
int sys irqsetpolicy(int irq vec, int policy, int *hook id);
int sys irqrmpolicy(int irq vec, int *hook id);
int sys irqenable(int hook id);
int sys irqdisable(int hook id);
SYS KILL: Signal a process on behalf of a system server. A system process can signal
another process with this call. The kernel notifies the PM about the pending
signal for further processing. (Note that the kill() POSIX-call is directly handled
at the PM.) The PM uses this call to indirectly send a signal message to a system
process. This happens when a signal arrives for a system process that set the special
SIG MESS signal handler with the sigaction() POSIX-call.
8
request parameters
SIG PROC NR: Process to be signaled.
SIG NUMBER: Signal number. Range from 0 to NSIG.
return value
OK: Call succeeded.
EINVAL: Illegal process or signal number.
EPERM: Cannot send a signal to a kernel task. PM cannot signal a user process
with a notification message.
library functions
int sys kill(int proc nr, int sig nr);
SYS MEMSET: Write a 4-byte pattern into the indicated memory area. The call is used
by the PM to zero the BSS segment on an exec() POSIX-call. The kernel is ask to
do the work for performance reasons.
request parameters
MEM PTR: Physical base address of the memory area.
MEM COUNT: Length in bytes of the memory area.
MEM PATTERN: The 4-byte pattern to be written.
return value
OK: Call always succeeds.
library functions
int sys memset(long pattern, phys bytes base, phys bytes length);
SYS NEWMAP: Install a new memory map for a newly forked process or if a process’
memory map is changed. The kernel fetches the new memory map from PM and
updates its data structures.
request parameters
PR PROC NR: Install new map for this process.
PR MEM PTR: Pointer to memory map at PM.
return value
OK: New map was successfully installed.
EFAULT: Incorrect address for new memory map.
EINVAL: Invalid process number.
library functions
int sys newmap(int proc nr, struct mem map *ptr);
SYS NICE: Change a process’ priority. This is done by passing a nice values between
PRIO MIN (negative) and PRIO MAX (positive). A nice value of zero resets the priority
to the default.
request parameters
PR PROC NR: Process who’s priority should be changed
PR PRIORITY : New nice value for process’ priority
9
return value
OK: New priority was successfully set.
EINVAL: Invalid process number or priority.
EPERM: Cannot change priority of kernel task.
library functions
int sys nice(int proc nr, int priority);
SYS PHYSCOPY: Copy data using physical addressing. The source and/ or destination
address can be virtual like with SYS VIRCOPY, but in addition an arbitrary physical
address is accepted with PHYS SEG.
request parameters
CP SRC SPACE: Source segment.
CP SRC ADDR: Virtual source address
CP SRC PROC NR: Process number of the source process.
CP DST SPACE: Destination segment.
CP DST ADDR: Virtual destination address
CP DST PROC NR: Process number of the destination process.
CP NR BYTES: Number of bytes to copy.
return value
OK: The copying was done.
EDOM: Invalid copy count.
EFAULT: Virtual to physical mapping failed.
EINVAL: Incorrect segment type or process number.
EPERM: Only owner of REMOTE SEG can copy to or from it.
library functions
int sys abscopy(phys bytes src phys, phys bytes dst phys, phys bytes count);
int sys physcopy(int src proc, int src seg, vir bytes src vir, int dst proc, int dst seg, vir bytes
dst vir, phys bytes count);
SYS PHYSVCOPY: Copy multiple block of data using physical addressing. The request vector
is fetched from the caller, and each element is handled like a regular SYS PHYSCOPY
request. Copying continues until all elements have been processed or an error occurs.
request parameters
VCP VEC SIZE: Number of elements in request vector.
VCP VEC ADDR: Virtual address of request vector at caller.
response parameters
VCP NR OK: Number of elements successfully copied.
return value
OK: The copying was done.
EDOM: Invalid copy count.
EFAULT: Virtual to physical mapping failed.
EINVAL: Copy vector too large, incorrect segment or invalid process.
EPERM: Only owner of REMOTE SEG can copy to or from it.
10
library functions
int sys physvcopy(phys cp req *copy vec, int vec size, int *nr ok);
SYS PRIVCTL: Get a private privilege structure and update a process’ privileges. This is
used to dynamically start system services.
request parameters
CTL PROC NR: Process who’s privileges should be updated.
return value
OK: The calls succeeded.
EINVAL: Invalid process number.
ENOSPC: No free privilege structure found.
remarks
This system call will be extended to provide both better support and security checks
for servers or device drivers that must be dynamically loaded. This is future work.
library functions
-
SYS SDEVIO: Perform device I/O on behalf of a user-space device driver. Note that this
call supports only byte and word granularity. The driver can request input or
output of an entire buffer. Also see the SYS DEVIO and SYS VDEVIO kernel calls.
request parameters
DIO REQUEST: Input or output.
• DIO INPUT Read a value from DIO PORT.
• DIO OUTPUT Write DIO VALUE to DIO PORT.
DIO TYPE: A flag indicating the type of values.
• DIO BYTE Byte type.
• DIO WORD Word type.
DIO PORT: The port to be read or written.
DIO PROC NR: Process number where buffer is.
DIO VEC ADDR: Virtual address of buffer.
DIO VEC SIZE: Number of elements to input or output.
response parameters
DIO VALUE: Value that was read from the given port. For DIO INPUT only.
return value
OK: The port I/O was successfully done.
EINVAL: Invalid request or port granularity.
EPERM: Cannot do I/O for kernel tasks.
EFAULT: Invalid virtual address of buffer.
library functions
int sys insb(port t port, u8 t buffer, int count);
int sys insw(port t port, u16 t buffer, int count);
int sys outsb(port t port, u8 t buffer, int count);
int sys outsw(port t port, u16 t buffer, int count);
int sys sdevio(int req, long port, int io type, void *buffer, int count);
11
SYS SEGCTL: Add a memory segment to the process’ LDT and its remote memory map.
The call returns a selector and offset that can be used to directly reach the remote
segment, as well as an index into the remote memory map that can be used with
the SYS VIRCOPY kernel call.
request parameters
SEG PHYS: Physical base address of segment.
SEG SIZE: Size of segment.
response parameters
SEG INDEX: Index into remote memory map.
SEG SELECT: Segment selector for LDT entry.
SEG OFFSET: Offset within segment. Zero, unless 4K granularity is used.
return value
ENOSPC: No free slot in remote memory map and LDT.
OK: Segment descriptor successfully added.
library functions
int sys segctl(int *index, u16 t *seg, vir bytes *off, phys bytes phys, vir bytes size);
SYS SIGRETURN: Return from a POSIX-style signal handler. The PM requests the kernel
to put things in order before the signalled process can resume execution. Also see
the SYS SIGSEND kernel call that pushes a signal context frame onto the stack.
request parameters
SIG PROC: Indicates the process that was signaled.
SIG CTXT PTR: Pointer to context structure for POSIX-style signal handling.
response parameters
SIG PROC: Return next process with pending signals or NONE.
return value
OK: Signal handling action successfully performed.
EINVAL: Invalid process number or context structure.
EFAULT: Invalid context structure address, or could not copy signal frame.
library functions
int sys sigreturn(int proc nr, struct sigmsg *sig context);
SYS SIGSEND: Signal a process on behalf of the PM by placing the context structure onto
the stack. The kernel fetches the structure, initializes it, and copies it to the user’s
stack.
request parameters
SIG PROC: Indicates the process that was signaled.
SIG CTXT PTR: Pointer to context structure for POSIX-style signal handling.
response parameters
SIG PROC: Return next process with pending signals or NONE.
12
return value
OK: Signal handling action successfully performed.
EINVAL: Invalid process number.
EPERM: Cannot signal kernel tasks.
EFAULT: Invalid context structure address, or could not copy signal frame.
library functions
int sys sigsend(int proc nr, struct sigmsg *sig context);
SYS SETALARM : Set or reset a synchronous alarm timer. When the timer expires it causes
a SYN ALARM notification message with the current uptime as an argument to be
sent to the caller. Only system processes can request synchronous alarms.
request parameters
ALRM EXP TIME: Absolute or relative expiration time in ticks for this alarm.
ALRM ABS TIME: Zero if expire time is relative to the current uptime.
response parameters
ALRM TIME LEFT: Ticks left on the previous alarm.
return value
OK: The alarm was successfully set.
EPERM: User processes cannot request alarms.
library functions
int sys setalarm(clock t expire time, int abs flag);
SYS TIMES: Get the kernel’s uptime since boot and process execution times.
request parameters
T PROC NR: The process to get the time information for, or NONE.
response parameters
T USER TIME: Process’ user time in ticks, if valid number.
T SYSTEM TIME: Process’ system time in ticks, if valid number.
T BOOT TICKS: Number of ticks since MINIX boot.
return value
OK: Always succeeds.
library functions
int sys times(int proc nr, clock t *ptr);
SYS TRACE: Monitor or control execution of the given process. Handle the debugging
commands supported by the ptrace() system call.
request parameters
CTL REQUEST: The tracing request.
• T STOP Stop the process.
• T GETINS Return value from instruction space.
• T GETDATA Return value from data space.
• T GETUSER Return value from user process table.
13
• T SETINS Set value from instruction space.
• T SETDATA Set value from data space.
• T SETUSER Set value in user process table.
• T RESUME Resume execution.
• T STEP Set trace bit.
CTL PROC NR: The process number that is being traced.
CTL ADDRESS: Virtual address in the traced process’ space.
CTL DATA: Data to be written.
response parameters
CTL DATA: Data be returned.
return value
OK: Trace operation succeeded.
EIO: Set or get value failed.
EINVAL: Unsupported trace request.
PERM: Can only trace user processes.
library functions
int sys trace(int request, int proc nr, long addr, long *data ptr);
SYS UMAP: Map a virtual address to a physical address and return the physical address.
The virtual address can be in LOCAL SEG, REMOTE SEG, or BIOS SEG. An offset in
bytes can be passed to verify whether this also falls within the segment.
request parameters
CP SRC PROC NR: Process number of the address relates to.
CP SRC SPACE: Segment identifier.
CP SRC ADDR: Offset within segment.
CP NR BYTES: Number of bytes from start.
response parameters
CP DST ADDR: Physical address if mapping succeeded.
return value
OK: The copying was done.
EFAULT: Virtual to physical mapping failed.
EINVAL: Incorrect segment type or process number.
remarks
Address zero within BIOS SEG returns EFAULT, while it the zeroth BIOS interrupt
vector in fact is a valid address.
library functions
int sys umap(int proc nr, int seg, vir bytes vir addr, vir bytes count, phys bytes *phys addr);
SYS VDEVIO: Perform a series of device I/O on behalf of a user process. The call accepts
a pointer to an array of (port,value)-pairs that is to be handeld at once. Hardware
interrupts are temporarily disabled to prevented the bactch of I/O calls to be
interrupted. Also see SYS DEVIO and SYS SDEVIO.
request parameters
DIO REQUEST: Input or output.
14
• DIO INPUT Read a value from DIO PORT.
• DIO OUTPUT Write DIO VALUE to DIO PORT.
DIO TYPE: A flag indicating the type of values.
• DIO BYTE Byte type.
• DIO WORD Word type.
• DIO LONG Long type.
DIO VEC SIZE: The number of ports to be handled.
DIO VEC ADDR: Virtual address of the (port,value)-pairs in the caller’s space.
return value
OK: The port I/O was successfully done.
EINVAL: Invalid request or granularity.
E2BIG: Vector size exceeds maximum that can be handled.
EFAULT: The address of the (port,value)-pairs is erroneous.
library functions
int sys voutb(pvb pair t *pvb vec, int vec size);
int sys voutw(pvw pair t *pvw vec, int vec size);
int sys voutl(pvl pair t *pvl vec, int vec size);
int sys vinb(pvb pair t *pvb vec, int vec size);
int sys vinw(pvw pair t *pvw vec, int vec size);
int sys vinl(pvl pair t *pvl vec, int vec size);
SYS VIRCOPY: Copy data using virtual addressing. The virtual can be in three segments:
LOCAL SEG (text, stack, data segments), REMOTE SEG (e.g., RAM disk, video memory),
and the BIOS SEG (BIOS interrupt vectors, BIOS data area). This is the most
common system call relating to copying.
request parameters
CP SRC SPACE: Source segment.
CP SRC ADDR: Virtual source address
CP SRC PROC NR: Process number of the source process.
CP DST SPACE: Destination segment.
CP DST ADDR: Virtual destination address
CP DST PROC NR: Process number of the destination process.
CP NR BYTES: Number of bytes to copy.
return value
OK: The copying was done.
EDOM: Invalid copy count.
EFAULT: Virtual to physical mapping failed.
EPERM: No permission to use PHYS SEG.
EINVAL: Incorrect segment type or process number.
EPERM: Only owner of REMOTE SEG can copy to or from it.
library functions
int sys biosin(vir bytes bios vir, vir bytes dst vir, vir bytes bytes);
int sys biosout(vir bytes src vir, vir bytes bios vir, vir bytes bytes);
int sys datacopy(vir bytes src proc, vir bytes src vir, dst proc, dst vir, vir bytes bytes);
int sys textcopy(vir bytes src proc, vir bytes src vir, dst proc, dst vir, vir bytes bytes);
15
int sys stackcopy(vir bytes src proc, vir bytes src vir, dst proc, dst vir, vir bytes bytes);
int sys vircopy(int src proc, int src seg, vir bytes src vir, int dst proc, int dst seg, vir bytes dst vir,
phys bytes bytes);
SYS VIRVCOPY: Copy multiple blocks of data using virtual addressing. The request vector
is fetched from the caller, and each element is handled like a regular SYS VIRCOPY
request. Copying continues until all elements have been processed or an error
occurs.
request parameters
VCP VEC SIZE: Number of elements in request vector.
VCP VEC ADDR: Virtual address of request vector at caller.
response parameters
VCP VEC OK: Number of elements successfully copied.
return value
OK: The copying was done.
EDOM: Invalid copy count.
EFAULT: Virtual to physical mapping failed.
EPERM: No permission to use PHYS SEG.
EINVAL: Copy vector too large, incorrect segment or invalid process.
EPERM: Only owner of REMOTE SEG can copy to or from it.
library functions
int sys virvcopy(vir cp req *copy vec, int vec size, int *nr ok); 
原创粉丝点击