contig_malloc man page on DigitalUNIX

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
DigitalUNIX logo
[printable version]

contig_malloc(9r)					     contig_malloc(9r)

NAME
       contig_malloc - General: Allocates physically contiguous memory

SYNOPSIS
       #include <sys/malloc.h>

       void * contig_malloc(
	       u_long size,
	       u_long alignment,
	       u_long addrlimit,
	       int type,
	       int flag );

ARGUMENTS
       Specifies the size of the memory (in bytes) to allocate.	 Specifies the
       alignment of the memory to be allocated. For example,  for  a  256-byte
       alignment,  you should pass the value 256. A 0 (zero) value means there
       is no alignment requirement.  Specifies that the	 address  of  all  the
       allocated  memory  should  be  less  than or equal to this address. A 0
       (zero) value means that there is no address limit requirement.	Speci‐
       fies  the  purpose  for which the memory is being allocated (or freed).
       The   memory   type    constants	   are	  defined    in	   the	  file
       /usr/sys/include/sys/malloc.h.	Examples  of memory type constants are
       M_DEVBUF	 (device  driver  memory),  M_KTABLE  (kernel  table  memory),
       M_RTABLE	 (routing  tables  memory),  M_EXEMPT  (exempt memory), and so
       forth.	 Specifies   one   of	the   following	  flags	  defined   in
       /usr/sys/include/sys/malloc.h: Signifies that contig_malloc should zero
       the allocated memory.  Signifies that contig_malloc can block.	Signi‐
       fies that contig_malloc cannot block.

DESCRIPTION
       The contig_malloc routine allocates physically contiguous memory during
       the boot process (before single-user mode). The routine carves  out  an
       area  of	 physically  contiguous memory from a contiguous memory buffer
       and allocates memory from this buffer with proper alignment.  The  call
       to  contig_malloc  is the same for statically or dynamically configured
       kernel modules. However, the point or points in time in which the stat‐
       ically or dynamically configured kernel module requests the memory dif‐
       fer.

       A statically configured kernel module  typically	 needs	to  call  con‐
       tig_malloc  only	 before	 single-user mode. In this case, contig_malloc
       obtains the memory from the contiguous memory buffer.   When  a	stati‐
       cally  configured kernel module frees this physically contiguous memory
       (by calling the contig_free routine), the memory	 is  returned  to  the
       virtual memory subsystem.

       A  dynamically configured kernel module typically needs physically con‐
       tiguous memory after  single-user  mode.	 As  stated  previously,  con‐
       tig_malloc  carves  out	an area of physically contiguous memory from a
       contiguous memory buffer before single-user  mode.  Thus,  this	memory
       would  not  be  available  to  the dynamically configured kernel module
       after single-user mode. To solve this problem, a dynamically configured
       kernel  module calls contig_malloc by defining the CMA_Option attribute
       in the sysconfigtab file fragment.

       The cma_dd subsystem calls contig_malloc on behalf of dynamically  con‐
       figured	kernel	modules	 and  obtains  the memory allocation size (and
       other information) from the CMA_Option attribute field. In  this	 case,
       contig_malloc  allocates physically contiguous memory from the contigu‐
       ous memory buffer and places it in a saved memory pool. When a  dynami‐
       cally  configured  kernel module needs to call contig_malloc after sin‐
       gle-user mode, the physically contiguous memory comes from  this	 saved
       memory  pool.  When  a  dynamically configured kernel module frees this
       physically contiguous memory (by calling the contig_free routine),  the
       memory  is returned to the saved memory pool (not to the virtual memory
       subsystem). Thus, this physically contiguous memory is available to the
       dynamically  configured	kernel	module upon subsequent reload requests
       that occur after single-user mode.

       An exempt region of memory can be allocated through the	 use  of  con‐
       tig_malloc.  This can be done in a pseudo device driver in the postcon‐
       fig_callback routine. ( Exempt  memory is memory managed by  UNIX,  but
       not included in testing and  core dumps.)

       Allocating exempt memory follows the same guidelines that a normal con‐
       tiguous malloc would follow except: The type field would	 be  M_EXEMPT,
       trackable  with	vmstat -M.  The addrlimit field has been overloaded to
       allow specification of a starting address. (The starting address	 is  a
       physical	 address.)  If	an address is specified and not available, the
       call will  return a failure. Use of the alignment parameter is  useless
       in this case.  A call would look like:

	      addr  =  contig_malloc(size,  alignment,	start_addr,  M_EXEMPT,
	      flags);

	      Where: Indicates the allocation size  in	bytes  (this  must  be
	      specified)  Indicates  the allocation alignment if no start_addr
	      or zero to default to base page size.  Indicates the base	 start
	      address to allocate from or 0 if no preference.

       This can also be done using the sysconfigtab entry.  Under cma_dd:

       CMA_option  = size - 0x40000, alignment - 0, Addrlimit - 0, Type - 143,
       Flag - 1

       The arguments are the same as in the example call. 143  corresponds  to
       what  is in malloc.h. Note that the returned addr will have the low bit
       set if there is a bad page in  the allocated region.

RETURN VALUES
       Upon successful completion, contig_malloc  returns  a  pointer  to  the
       allocated  memory.  If contig_malloc cannot allocate the requested mem‐
       ory, it returns a null pointer.

SEE ALSO
       Routines: contig_free(9r)

							     contig_malloc(9r)
[top]

List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net