The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/kernel/const.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /* General macros and constants used by the kernel. */
    2 #ifndef CONST_H
    3 #define CONST_H
    4 
    5 #include <ibm/interrupt.h>      /* interrupt numbers and hardware vectors */
    6 #include <ibm/ports.h>          /* port addresses and magic numbers */
    7 #include <ibm/bios.h>           /* BIOS addresses, sizes and magic numbers */
    8 #include <ibm/cpu.h>            /* BIOS addresses, sizes and magic numbers */
    9 #include <minix/config.h>
   10 #include "config.h"
   11 
   12 /* To translate an address in kernel space to a physical address.  This is
   13  * the same as umap_local(proc_ptr, D, vir, sizeof(*vir)), but less costly.
   14  */
   15 #define vir2phys(vir)   (kinfo.data_base + (vir_bytes) (vir))
   16 
   17 /* Map a process number to a privilege structure id. */
   18 #define s_nr_to_id(n)   (NR_TASKS + (n) + 1)
   19 
   20 /* Translate a pointer to a field in a structure to a pointer to the structure
   21  * itself. So it translates '&struct_ptr->field' back to 'struct_ptr'.
   22  */
   23 #define structof(type, field, ptr) \
   24         ((type *) (((char *) (ptr)) - offsetof(type, field)))
   25 
   26 /* Constants used in virtual_copy(). Values must be 0 and 1, respectively. */
   27 #define _SRC_   0
   28 #define _DST_   1
   29 
   30 /* Number of random sources */
   31 #define RANDOM_SOURCES  16
   32 
   33 /* Constants and macros for bit map manipulation. */
   34 #define BITCHUNK_BITS   (sizeof(bitchunk_t) * CHAR_BIT)
   35 #define BITMAP_CHUNKS(nr_bits) (((nr_bits)+BITCHUNK_BITS-1)/BITCHUNK_BITS)  
   36 #define MAP_CHUNK(map,bit) (map)[((bit)/BITCHUNK_BITS)]
   37 #define CHUNK_OFFSET(bit) ((bit)%BITCHUNK_BITS))
   38 #define GET_BIT(map,bit) ( MAP_CHUNK(map,bit) & (1 << CHUNK_OFFSET(bit) )
   39 #define SET_BIT(map,bit) ( MAP_CHUNK(map,bit) |= (1 << CHUNK_OFFSET(bit) )
   40 #define UNSET_BIT(map,bit) ( MAP_CHUNK(map,bit) &= ~(1 << CHUNK_OFFSET(bit) )
   41 
   42 #define get_sys_bit(map,bit) \
   43         ( MAP_CHUNK(map.chunk,bit) & (1 << CHUNK_OFFSET(bit) )
   44 #define set_sys_bit(map,bit) \
   45         ( MAP_CHUNK(map.chunk,bit) |= (1 << CHUNK_OFFSET(bit) )
   46 #define unset_sys_bit(map,bit) \
   47         ( MAP_CHUNK(map.chunk,bit) &= ~(1 << CHUNK_OFFSET(bit) )
   48 #define NR_SYS_CHUNKS   BITMAP_CHUNKS(NR_SYS_PROCS)
   49 
   50 #if (CHIP == INTEL)
   51 
   52 /* Program stack words and masks. */
   53 #define INIT_PSW      0x0200    /* initial psw */
   54 #define INIT_TASK_PSW 0x1200    /* initial psw for tasks (with IOPL 1) */
   55 #define TRACEBIT      0x0100    /* OR this with psw in proc[] for tracing */
   56 #define SETPSW(rp, new)         /* permits only certain bits to be set */ \
   57         ((rp)->p_reg.psw = (rp)->p_reg.psw & ~0xCD5 | (new) & 0xCD5)
   58 #define IF_MASK 0x00000200
   59 #define IOPL_MASK 0x003000
   60 
   61 /* Disable/ enable hardware interrupts. The parameters of lock() and unlock()
   62  * are used when debugging is enabled. See debug.h for more information.
   63  */
   64 #define lock(c, v)      intr_disable(); 
   65 #define unlock(c)       intr_enable(); 
   66 
   67 /* Sizes of memory tables. The boot monitor distinguishes three memory areas, 
   68  * namely low mem below 1M, 1M-16M, and mem after 16M. More chunks are needed
   69  * for DOS MINIX.
   70  */
   71 #define NR_MEMS            8    
   72 
   73 #endif /* (CHIP == INTEL) */
   74 
   75 #if (CHIP == M68000)
   76 /* M68000 specific constants go here. */
   77 #endif /* (CHIP == M68000) */
   78 
   79 #endif /* CONST_H */

Cache object: 419f540a967013520173f298c601aedd


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.