Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

round_page(9r) [osf1 man page]

round_page(9r)															    round_page(9r)

NAME
round_page - General: Rounds the specified address SYNOPSIS
#include <mach/vm_param.h> vm_offset_t round_page( vm_offset_t address ); ARGUMENTS
Specifies the address (or byte count) that is being rounded. DESCRIPTION
The round_page routine rounds the specified address (or byte count) to a multiple of the page size. For example, round_page would round a 1-byte count to be equal to the size of one page. 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 architecture. Typically, a device driver calls round_page in preparation for doing a DMA operation to 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 round_page routine returns the rounded address or byte count. SEE ALSO
Routines: current_task(9r), trunc_page(9r), vm_map_pageable(9r) round_page(9r)

Check Out this Related Man Page

hat_getkpfnum(9F)					   Kernel Functions for Drivers 					 hat_getkpfnum(9F)

NAME
hat_getkpfnum - get page frame number for kernel address SYNOPSIS
#include <sys/types.h> #include <sys/ddi.h> #include <sys/sunddi.h> pfn_t hat_getkpfnum(caddr_t addr); INTERFACE LEVEL
This interface is obsolete. A driver devmap(9E) entry point should be provided instead. PARAMETERS
addr The kernel virtual address for which the page frame number is to be returned. DESCRIPTION
hat_getkpfnum() returns the page frame number corresponding to the kernel virtual address, addr. addr must be a kernel virtual address which maps to device memory. ddi_map_regs(9F) can be used to obtain this address. For example, ddi_map_regs(9F) can be called in the driver's attach(9E) routine. The resulting kernel virtual address can be saved by the driver (see ddi_soft_state(9F)) and used in mmap(9E). The corresponding ddi_unmap_regs(9F) call can be made in the driver's detach(9E) routine. Refer to mmap(9E) for more information. RETURN VALUES
The page frame number corresponding to the valid, device-mapped virtual address addr. Otherwise the return value is undefined. CONTEXT
hat_getkpfnum() can be called only from user or kernel context. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface stability |Obsolete | +-----------------------------+-----------------------------+ SEE ALSO
attach(9E), detach(9E), devmap(9E), mmap(9E), ddi_map_regs(9F), ddi_soft_state(9F), ddi_unmap_regs(9F) Writing Device Drivers NOTES
For some devices, mapping device memory in the driver's attach(9E) routine and unmapping device memory in the driver's detach(9E) routine is a sizeable drain on system resources. This is especially true for devices with a large amount of physical address space. Refer to mmap(9E) for alternative methods. SunOS 5.11 13 June 2004 hat_getkpfnum(9F)
Man Page