updated package versions
[minix.git] / include / minix / type.h
blobd5a526c3bf9cbd5968e4ee87131fb53ab395d06b
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 /* 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 typedef int endpoint_t; /* process identifier */
18 #if (_MINIX_CHIP == _CHIP_INTEL)
19 typedef long unsigned int vir_bytes; /* virtual addresses/lengths in bytes */
20 #endif
22 #if (_MINIX_CHIP == _CHIP_M68000)
23 typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
24 #endif
26 #if (_MINIX_CHIP == _CHIP_SPARC)
27 typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
28 #endif
30 /* Memory map for local text, stack, data segments. */
31 struct mem_map {
32 vir_clicks mem_vir; /* virtual address */
33 phys_clicks mem_phys; /* physical address */
34 vir_clicks mem_len; /* length */
37 /* Memory map for remote memory areas, e.g., for the RAM disk. */
38 struct far_mem {
39 int in_use; /* entry in use, unless zero */
40 phys_clicks mem_phys; /* physical address */
41 vir_clicks mem_len; /* length */
44 /* Structure for virtual copying by means of a vector with requests. */
45 struct vir_addr {
46 int proc_nr_e;
47 int segment;
48 vir_bytes offset;
51 #define phys_cp_req vir_cp_req
52 struct vir_cp_req {
53 struct vir_addr src;
54 struct vir_addr dst;
55 phys_bytes count;
58 typedef struct {
59 vir_bytes iov_addr; /* address of an I/O buffer */
60 vir_bytes iov_size; /* sizeof an I/O buffer */
61 } iovec_t;
63 typedef struct {
64 int iov_grant; /* grant ID of an I/O buffer */
65 vir_bytes iov_size; /* sizeof an I/O buffer */
66 } iovec_s_t;
68 /* PM passes the address of a structure of this type to KERNEL when
69 * sys_sigsend() is invoked as part of the signal catching mechanism.
70 * The structure contain all the information that KERNEL needs to build
71 * the signal stack.
73 struct sigmsg {
74 int sm_signo; /* signal number being caught */
75 unsigned long sm_mask; /* mask to restore when handler returns */
76 vir_bytes sm_sighandler; /* address of handler */
77 vir_bytes sm_sigreturn; /* address of _sigreturn in C library */
78 vir_bytes sm_stkptr; /* user stack pointer */
81 /* This is used to obtain system information through SYS_GETINFO. */
82 struct kinfo {
83 phys_bytes code_base; /* base of kernel code */
84 phys_bytes code_size;
85 phys_bytes data_base; /* base of kernel data */
86 phys_bytes data_size;
87 vir_bytes proc_addr; /* virtual address of process table */
88 phys_bytes _kmem_base; /* kernel memory layout (/dev/kmem) */
89 phys_bytes _kmem_size;
90 phys_bytes bootdev_base; /* boot device from boot image (/dev/boot) */
91 phys_bytes bootdev_size;
92 phys_bytes ramdev_base; /* boot device from boot image (/dev/boot) */
93 phys_bytes ramdev_size;
94 phys_bytes _params_base; /* parameters passed by boot monitor */
95 phys_bytes _params_size;
96 int nr_procs; /* number of user processes */
97 int nr_tasks; /* number of kernel tasks */
98 char release[6]; /* kernel release number */
99 char version[6]; /* kernel version number */
102 /* Load data accounted every this no. of seconds. */
103 #define _LOAD_UNIT_SECS 6 /* Changing this breaks ABI. */
105 /* Load data history is kept for this long. */
106 #define _LOAD_HISTORY_MINUTES 15 /* Changing this breaks ABI. */
107 #define _LOAD_HISTORY_SECONDS (60*_LOAD_HISTORY_MINUTES)
109 /* We need this many slots to store the load history. */
110 #define _LOAD_HISTORY (_LOAD_HISTORY_SECONDS/_LOAD_UNIT_SECS)
112 /* Runnable processes and other load-average information. */
113 struct loadinfo {
114 u16_t proc_load_history[_LOAD_HISTORY]; /* history of proc_s_cur */
115 u16_t proc_last_slot;
116 clock_t last_clock;
119 struct machine {
120 int pc_at;
121 int ps_mca;
122 int processor;
123 int padding; /* used to be protected */
124 int vdu_ega;
125 int vdu_vga;
128 struct io_range
130 unsigned ior_base; /* Lowest I/O port in range */
131 unsigned ior_limit; /* Highest I/O port in range */
134 struct mem_range
136 phys_bytes mr_base; /* Lowest memory address in range */
137 phys_bytes mr_limit; /* Highest memory address in range */
140 /* For EXEC_NEWMEM */
141 struct exec_newmem
143 vir_bytes text_bytes;
144 vir_bytes data_bytes;
145 vir_bytes bss_bytes;
146 vir_bytes tot_bytes;
147 vir_bytes args_bytes;
148 int sep_id;
149 dev_t st_dev;
150 ino_t st_ino;
151 time_t st_ctime;
152 uid_t new_uid;
153 gid_t new_gid;
154 char progname[16]; /* Should be at least PROC_NAME_LEN */
157 /* Memory chunks. */
158 struct memory {
159 phys_bytes base;
160 phys_bytes size;
163 #define STATICINIT(v, n) \
164 if(!(v)) { \
165 if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \
166 panic(__FILE__, "allocating " #v " failed", n); \
170 /* The kernel outputs diagnostic messages in a circular buffer. */
171 struct kmessages {
172 int km_next; /* next index to write */
173 int km_size; /* current size in buffer */
174 char km_buf[_KMESS_BUF_SIZE]; /* buffer for messages */
177 #include <minix/config.h>
178 #include <ibm/interrupt.h>
180 /* randomness struct: random sources after interrupts: */
181 #define RANDOM_SOURCES NR_IRQ_VECTORS
182 #define RANDOM_ELEMENTS 64
184 typedef unsigned short rand_t;
186 struct k_randomness {
187 int random_elements, random_sources;
188 struct k_randomness_bin {
189 int r_next; /* next index to write */
190 int r_size; /* number of random elements */
191 rand_t r_buf[RANDOM_ELEMENTS]; /* buffer for random info */
192 } bin[RANDOM_SOURCES];
195 /* information on PCI devices */
197 #define PCIINFO_ENTRY_SIZE 80
199 struct pciinfo_entry {
200 u16_t pie_vid;
201 u16_t pie_did;
202 char pie_name[PCIINFO_ENTRY_SIZE];
205 struct pciinfo {
206 size_t pi_count;
207 struct pciinfo_entry pi_entries[NR_PCIDEV];
210 #endif /* _TYPE_H */