make includes fix from trunk
[minix.git] / include / minix / type.h
blob508c48dc458c575e0b3df771a5bad1bf86d1a825
1 #ifndef _TYPE_H
2 #define _TYPE_H
4 #ifndef _MINIX_SYS_CONFIG_H
5 #include <minix/sys_config.h>
6 #endif
8 #ifndef _TYPES_H
9 #include <minix/types.h>
10 #endif
12 #include <stdint.h>
14 /* Type definitions. */
15 typedef unsigned int vir_clicks; /* virtual addr/length in clicks */
16 typedef unsigned long phys_bytes; /* physical addr/length in bytes */
17 typedef unsigned int phys_clicks; /* physical addr/length in clicks */
18 typedef int endpoint_t; /* process identifier */
20 typedef int32_t cp_grant_id_t; /* A grant ID. */
22 #if (_MINIX_CHIP == _CHIP_INTEL)
23 typedef long unsigned int vir_bytes; /* virtual addresses/lengths in bytes */
24 #endif
26 #if (_MINIX_CHIP == _CHIP_M68000)
27 typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
28 #endif
30 #if (_MINIX_CHIP == _CHIP_SPARC)
31 typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
32 #endif
34 /* Memory map for local text, stack, data segments. */
35 struct mem_map {
36 vir_clicks mem_vir; /* virtual address */
37 phys_clicks mem_phys; /* physical address */
38 vir_clicks mem_len; /* length */
41 /* Memory map for remote memory areas, e.g., for the RAM disk. */
42 struct far_mem {
43 int in_use; /* entry in use, unless zero */
44 phys_clicks mem_phys; /* physical address */
45 vir_clicks mem_len; /* length */
48 /* Structure for virtual copying by means of a vector with requests. */
49 struct vir_addr {
50 endpoint_t proc_nr_e;
51 int segment;
52 vir_bytes offset;
55 #define phys_cp_req vir_cp_req
56 struct vir_cp_req {
57 struct vir_addr src;
58 struct vir_addr dst;
59 phys_bytes count;
62 typedef struct {
63 vir_bytes iov_addr; /* address of an I/O buffer */
64 vir_bytes iov_size; /* sizeof an I/O buffer */
65 } iovec_t;
67 typedef struct {
68 cp_grant_id_t iov_grant; /* grant ID of an I/O buffer */
69 vir_bytes iov_size; /* sizeof an I/O buffer */
70 } iovec_s_t;
72 /* PM passes the address of a structure of this type to KERNEL when
73 * sys_sigsend() is invoked as part of the signal catching mechanism.
74 * The structure contain all the information that KERNEL needs to build
75 * the signal stack.
77 struct sigmsg {
78 int sm_signo; /* signal number being caught */
79 unsigned long sm_mask; /* mask to restore when handler returns */
80 vir_bytes sm_sighandler; /* address of handler */
81 vir_bytes sm_sigreturn; /* address of _sigreturn in C library */
82 vir_bytes sm_stkptr; /* user stack pointer */
85 /* This is used to obtain system information through SYS_GETINFO. */
86 struct kinfo {
87 phys_bytes code_base; /* base of kernel code */
88 phys_bytes code_size;
89 phys_bytes data_base; /* base of kernel data */
90 phys_bytes data_size;
91 vir_bytes proc_addr; /* virtual address of process table */
92 phys_bytes _kmem_base; /* kernel memory layout (/dev/kmem) */
93 phys_bytes _kmem_size;
94 phys_bytes bootdev_base; /* boot device from boot image (/dev/boot) */
95 phys_bytes bootdev_size;
96 phys_bytes ramdev_base; /* boot device from boot image (/dev/boot) */
97 phys_bytes ramdev_size;
98 phys_bytes _params_base; /* parameters passed by boot monitor */
99 phys_bytes _params_size;
100 int nr_procs; /* number of user processes */
101 int nr_tasks; /* number of kernel tasks */
102 char release[6]; /* kernel release number */
103 char version[6]; /* kernel version number */
106 /* Load data accounted every this no. of seconds. */
107 #define _LOAD_UNIT_SECS 6 /* Changing this breaks ABI. */
109 /* Load data history is kept for this long. */
110 #define _LOAD_HISTORY_MINUTES 15 /* Changing this breaks ABI. */
111 #define _LOAD_HISTORY_SECONDS (60*_LOAD_HISTORY_MINUTES)
113 /* We need this many slots to store the load history. */
114 #define _LOAD_HISTORY (_LOAD_HISTORY_SECONDS/_LOAD_UNIT_SECS)
116 /* Runnable processes and other load-average information. */
117 struct loadinfo {
118 u16_t proc_load_history[_LOAD_HISTORY]; /* history of proc_s_cur */
119 u16_t proc_last_slot;
120 clock_t last_clock;
123 struct machine {
124 int pc_at;
125 int ps_mca;
126 int processor;
127 int padding; /* used to be protected */
128 int vdu_ega;
129 int vdu_vga;
132 struct io_range
134 unsigned ior_base; /* Lowest I/O port in range */
135 unsigned ior_limit; /* Highest I/O port in range */
138 struct mem_range
140 phys_bytes mr_base; /* Lowest memory address in range */
141 phys_bytes mr_limit; /* Highest memory address in range */
144 /* For EXEC_NEWMEM */
145 struct exec_newmem
147 vir_bytes text_bytes;
148 vir_bytes data_bytes;
149 vir_bytes bss_bytes;
150 vir_bytes tot_bytes;
151 vir_bytes args_bytes;
152 int sep_id;
153 dev_t st_dev;
154 ino_t st_ino;
155 time_t st_ctime;
156 uid_t new_uid;
157 gid_t new_gid;
158 char progname[16]; /* Should be at least PROC_NAME_LEN */
161 /* Memory chunks. */
162 struct memory {
163 phys_bytes base;
164 phys_bytes size;
167 #define STATICINIT(v, n) \
168 if(!(v)) { \
169 if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \
170 panic("allocating " #v " failed: %d", n); \
174 /* The kernel outputs diagnostic messages in a circular buffer. */
175 struct kmessages {
176 int km_next; /* next index to write */
177 int km_size; /* current size in buffer */
178 char km_buf[_KMESS_BUF_SIZE]; /* buffer for messages */
181 #include <minix/config.h>
182 #include <machine/interrupt.h>
184 /* randomness struct: random sources after interrupts: */
185 #define RANDOM_SOURCES NR_IRQ_VECTORS
186 #define RANDOM_ELEMENTS 64
188 typedef unsigned short rand_t;
190 struct k_randomness {
191 int random_elements, random_sources;
192 struct k_randomness_bin {
193 int r_next; /* next index to write */
194 int r_size; /* number of random elements */
195 rand_t r_buf[RANDOM_ELEMENTS]; /* buffer for random info */
196 } bin[RANDOM_SOURCES];
199 /* information on PCI devices */
201 #define PCIINFO_ENTRY_SIZE 80
203 struct pciinfo_entry {
204 u16_t pie_vid;
205 u16_t pie_did;
206 char pie_name[PCIINFO_ENTRY_SIZE];
209 struct pciinfo {
210 size_t pi_count;
211 struct pciinfo_entry pi_entries[NR_PCIDEV];
214 #endif /* _TYPE_H */