trunc_page(9r)trunc_page(9r)NAME
trunc_page - General: Truncates the specified address
SYNOPSIS
#include <mach/vm_param.h>
vm_offset_t trunc_page(
vm_offset_t address );
ARGUMENTS
Specifies the address that is being truncated to a page boundary.
DESCRIPTION
The trunc_page routine truncates the specified address to be aligned on a page boundary. This routine shields the driver writer from having
to know the page size of the system, which could vary in different CPU architectures and on different CPU types within the same architec-
ture. Typically, a device driver calls trunc_page in preparation for doing a DMA operation on a user's buffer. The value returned by this
routine is used in the call to the vm_map_pageable routine. To use this routine, the driver writer must include the <mach/vm_param.h>
header file in the driver.
RETURN VALUES
The trunc_page routine returns an address truncated to a page boundary.
SEE ALSO
Routines: current_task(9r), round_page(9r), vm_map_pageable(9r)trunc_page(9r)
Check Out this Related Man Page
svatophys(9r)svatophys(9r)NAME
svatophys - General: Converts a system virtual address to a physical address
SYNOPSIS
kern_return_t svatophys(
vm_offset_t kern_addr,
vm_offset_t *phys_addr );
ARGUMENTS
Specifies the kernel virtual address. Specifies a pointer to the physical address to be filled in.
DESCRIPTION
The svatophys routine converts a system virtual address to the corresponding physical address. All address and data structure manipulation
done within the kernel is performed using system virtual addresses. Typically, system virtual addresses are a means of mapping physical
memory and I/O space, which often consists of device registers and DMA buffers. In contrast to this, devices are usually unaware of any
virtual addressing and for this reason use physical addresses. You use the svatophys routine to perform this address translation.
As an example of where you can use this address translation, a disk device driver can use DMA buffers to transfer blocks of data to the
disk (for the case of a write operation). The data to be written to disk is present in system memory at a system virtual address known to
the driver. To initiate the DMA operation, the disk driver can set up a command packet to specify a write operation to the underlying disk
controller hardware. This write command packet contains (among other things) the location of the DMA buffer as a physical address and the
length of the buffer. Here, the driver calls the svatophys routine to translate the system virtual address of the DMA buffer to a physical
address in the command packet issued to the disk driver.
RETURN VALUES
The svatophys routine returns the following: The address translation has been completed successfully. Unable to perform address transla-
tion. This value indicates that the address specified by the kern_addr argument is not a valid kernel or system virtual address.
svatophys(9r)
Hi Folks,
Today hasn't been the best one of my career in IT.
I've been a contractor for a major utility company for a number of years, on a number of seperate IT contracts mostly Unix. The company had 10 different flavours of unix and multiple different varsions of most of them.
At the... (3 Replies)