previous | start | next

Task Calls for Copying

Copying data from any physical memory location to any other physical memory location is possible when the protection level of the processor (2 bits in the PSW register in the Intel IA32 processor) is at its most privileged of 4 possible levels.

The function:

 PUBLIC void phys_copy(phys_bytes source, 
                       phys_bytes destination, 
                       phys_bytes bytecount);

is compiled into the kernel image.

User level processes and server processes can only use this function indirectly through system/task calls.

For example, the process manager can make a task call to to a kernel routine that uses this function. That is, there is a function in the system library that server processes can call to request the kernel to copy bytes from one virtual memory location to another:

PUBLIC int sys_vircopy(src_proc, src_seg, src_vir,
        dst_proc, dst_seg, dst_vir, bytes)
int src_proc;                   /* source process */
int src_seg;                    /* source memory segment */
vir_bytes src_vir;              /* source virtual address */
int dst_proc;                   /* destination process */
int dst_seg;                    /* destination memory segment */
vir_bytes dst_vir;              /* destination virtual address */
phys_bytes bytes;               /* how many bytes */

The source and destination processes parameters are needed in order for the kernel routine that this system library function sends a message to will be able to translate the virtual addresses to physical addresses and then use the phys_copy function to implement the task call.

The process manager manages (its view) of the process table and so can provide process endpoint values, process number values, etc. to identify the source and destination processes in the message sent to the system task by sys_vircopy. It is the endpoint values that sys_vircopy is expecting or SELF for the source and/or destination processes.



previous | start | next