[9] | 1 | #ifndef _TYPE_H
|
---|
| 2 | #define _TYPE_H
|
---|
| 3 |
|
---|
| 4 | #ifndef _MINIX_SYS_CONFIG_H
|
---|
| 5 | #include <minix/sys_config.h>
|
---|
| 6 | #endif
|
---|
| 7 |
|
---|
| 8 | #ifndef _TYPES_H
|
---|
| 9 | #include <sys/types.h>
|
---|
| 10 | #endif
|
---|
| 11 |
|
---|
| 12 | /* Type definitions. */
|
---|
| 13 | typedef unsigned int vir_clicks; /* virtual addr/length in clicks */
|
---|
| 14 | typedef unsigned long phys_bytes; /* physical addr/length in bytes */
|
---|
| 15 | typedef unsigned int phys_clicks; /* physical addr/length in clicks */
|
---|
| 16 |
|
---|
| 17 | #if (_MINIX_CHIP == _CHIP_INTEL)
|
---|
| 18 | typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */
|
---|
| 19 | #endif
|
---|
| 20 |
|
---|
| 21 | #if (_MINIX_CHIP == _CHIP_M68000)
|
---|
| 22 | typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
|
---|
| 23 | #endif
|
---|
| 24 |
|
---|
| 25 | #if (_MINIX_CHIP == _CHIP_SPARC)
|
---|
| 26 | typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
|
---|
| 27 | #endif
|
---|
| 28 |
|
---|
| 29 | /* Memory map for local text, stack, data segments. */
|
---|
| 30 | struct mem_map {
|
---|
| 31 | vir_clicks mem_vir; /* virtual address */
|
---|
| 32 | phys_clicks mem_phys; /* physical address */
|
---|
| 33 | vir_clicks mem_len; /* length */
|
---|
| 34 | };
|
---|
| 35 |
|
---|
| 36 | /* Memory map for remote memory areas, e.g., for the RAM disk. */
|
---|
| 37 | struct far_mem {
|
---|
| 38 | int in_use; /* entry in use, unless zero */
|
---|
| 39 | phys_clicks mem_phys; /* physical address */
|
---|
| 40 | vir_clicks mem_len; /* length */
|
---|
| 41 | };
|
---|
| 42 |
|
---|
| 43 | /* Structure for virtual copying by means of a vector with requests. */
|
---|
| 44 | struct vir_addr {
|
---|
| 45 | int proc_nr_e;
|
---|
| 46 | int segment;
|
---|
| 47 | vir_bytes offset;
|
---|
| 48 | };
|
---|
| 49 |
|
---|
| 50 | /* Memory allocation by PM. */
|
---|
| 51 | struct hole {
|
---|
| 52 | struct hole *h_next; /* pointer to next entry on the list */
|
---|
| 53 | phys_clicks h_base; /* where does the hole begin? */
|
---|
| 54 | phys_clicks h_len; /* how big is the hole? */
|
---|
| 55 | };
|
---|
| 56 |
|
---|
| 57 | /* Memory info from PM. */
|
---|
| 58 | struct pm_mem_info {
|
---|
| 59 | struct hole pmi_holes[_NR_HOLES];/* memory (un)allocations */
|
---|
| 60 | u32_t pmi_hi_watermark; /* highest ever-used click + 1 */
|
---|
| 61 | };
|
---|
| 62 |
|
---|
| 63 | #define phys_cp_req vir_cp_req
|
---|
| 64 | struct vir_cp_req {
|
---|
| 65 | struct vir_addr src;
|
---|
| 66 | struct vir_addr dst;
|
---|
| 67 | phys_bytes count;
|
---|
| 68 | };
|
---|
| 69 |
|
---|
| 70 | typedef struct {
|
---|
| 71 | vir_bytes iov_addr; /* address of an I/O buffer */
|
---|
| 72 | vir_bytes iov_size; /* sizeof an I/O buffer */
|
---|
| 73 | } iovec_t;
|
---|
| 74 |
|
---|
| 75 | /* PM passes the address of a structure of this type to KERNEL when
|
---|
| 76 | * sys_sendsig() is invoked as part of the signal catching mechanism.
|
---|
| 77 | * The structure contain all the information that KERNEL needs to build
|
---|
| 78 | * the signal stack.
|
---|
| 79 | */
|
---|
| 80 | struct sigmsg {
|
---|
| 81 | int sm_signo; /* signal number being caught */
|
---|
| 82 | unsigned long sm_mask; /* mask to restore when handler returns */
|
---|
| 83 | vir_bytes sm_sighandler; /* address of handler */
|
---|
| 84 | vir_bytes sm_sigreturn; /* address of _sigreturn in C library */
|
---|
| 85 | vir_bytes sm_stkptr; /* user stack pointer */
|
---|
| 86 | };
|
---|
| 87 |
|
---|
| 88 | /* This is used to obtain system information through SYS_GETINFO. */
|
---|
| 89 | struct kinfo {
|
---|
| 90 | phys_bytes code_base; /* base of kernel code */
|
---|
| 91 | phys_bytes code_size;
|
---|
| 92 | phys_bytes data_base; /* base of kernel data */
|
---|
| 93 | phys_bytes data_size;
|
---|
| 94 | vir_bytes proc_addr; /* virtual address of process table */
|
---|
| 95 | phys_bytes kmem_base; /* kernel memory layout (/dev/kmem) */
|
---|
| 96 | phys_bytes kmem_size;
|
---|
| 97 | phys_bytes bootdev_base; /* boot device from boot image (/dev/boot) */
|
---|
| 98 | phys_bytes bootdev_size;
|
---|
| 99 | phys_bytes ramdev_base; /* boot device from boot image (/dev/boot) */
|
---|
| 100 | phys_bytes ramdev_size;
|
---|
| 101 | phys_bytes params_base; /* parameters passed by boot monitor */
|
---|
| 102 | phys_bytes params_size;
|
---|
| 103 | int nr_procs; /* number of user processes */
|
---|
| 104 | int nr_tasks; /* number of kernel tasks */
|
---|
| 105 | char release[6]; /* kernel release number */
|
---|
| 106 | char version[6]; /* kernel version number */
|
---|
| 107 | #if DEBUG_LOCK_CHECK
|
---|
| 108 | int relocking; /* interrupt locking depth (should be 0) */
|
---|
| 109 | #endif
|
---|
| 110 | };
|
---|
| 111 |
|
---|
| 112 | /* Load data accounted every this no. of seconds. */
|
---|
| 113 | #define _LOAD_UNIT_SECS 6
|
---|
| 114 |
|
---|
| 115 | /* Load data history is kept for this long. */
|
---|
| 116 | #define _LOAD_HISTORY_MINUTES 15
|
---|
| 117 | #define _LOAD_HISTORY_SECONDS (60*_LOAD_HISTORY_MINUTES)
|
---|
| 118 |
|
---|
| 119 | /* We need this many slots to store the load history. */
|
---|
| 120 | #define _LOAD_HISTORY (_LOAD_HISTORY_SECONDS/_LOAD_UNIT_SECS)
|
---|
| 121 |
|
---|
| 122 | /* Runnable processes and other load-average information. */
|
---|
| 123 | struct loadinfo {
|
---|
| 124 | u16_t proc_load_history[_LOAD_HISTORY]; /* history of proc_s_cur */
|
---|
| 125 | u16_t proc_last_slot;
|
---|
| 126 | clock_t last_clock;
|
---|
| 127 | };
|
---|
| 128 |
|
---|
| 129 | struct machine {
|
---|
| 130 | int pc_at;
|
---|
| 131 | int ps_mca;
|
---|
| 132 | int processor;
|
---|
| 133 | int prot;
|
---|
| 134 | int vdu_ega;
|
---|
| 135 | int vdu_vga;
|
---|
| 136 | };
|
---|
| 137 |
|
---|
| 138 | struct io_range
|
---|
| 139 | {
|
---|
| 140 | unsigned ior_base; /* Lowest I/O port in range */
|
---|
| 141 | unsigned ior_limit; /* Highest I/O port in range */
|
---|
| 142 | };
|
---|
| 143 |
|
---|
| 144 | struct mem_range
|
---|
| 145 | {
|
---|
| 146 | phys_bytes mr_base; /* Lowest memory address in range */
|
---|
| 147 | phys_bytes mr_limit; /* Highest memory address in range */
|
---|
| 148 | };
|
---|
| 149 |
|
---|
| 150 | #endif /* _TYPE_H */
|
---|