csu: restore crt1.o symlink
[minix.git] / include / minix / type.h
blob7dc11f1610e5466aca09da635f3e89204c7aff8b
1 #ifndef _TYPE_H
2 #define _TYPE_H
3 #include <machine/multiboot.h>
5 #ifndef _MINIX_SYS_CONFIG_H
6 #include <minix/sys_config.h>
7 #endif
9 #include <sys/types.h>
11 #include <stdint.h>
13 /* Type definitions. */
14 typedef unsigned int vir_clicks; /* virtual addr/length in clicks */
15 typedef unsigned long phys_bytes; /* physical addr/length in bytes */
16 typedef unsigned int phys_clicks; /* physical addr/length in clicks */
17 typedef int endpoint_t; /* process identifier */
18 typedef int32_t cp_grant_id_t; /* A grant ID. */
19 typedef long unsigned int vir_bytes; /* virtual addresses/lengths in bytes */
21 /* Structure for virtual copying by means of a vector with requests. */
22 struct vir_addr {
23 endpoint_t proc_nr_e; /* NONE for phys, otherwise process endpoint */
24 vir_bytes offset;
27 #define phys_cp_req vir_cp_req
28 struct vir_cp_req {
29 struct vir_addr src;
30 struct vir_addr dst;
31 phys_bytes count;
34 /* Structures for SYS_VUMAP. */
35 struct vumap_vir {
36 union {
37 cp_grant_id_t u_grant; /* grant identifier, for non-SELF endpoint */
38 vir_bytes u_addr; /* local virtual address, for SELF endpoint */
39 } vv_u;
40 size_t vv_size; /* size in bytes */
42 #define vv_grant vv_u.u_grant
43 #define vv_addr vv_u.u_addr
45 struct vumap_phys {
46 phys_bytes vp_addr; /* physical address */
47 size_t vp_size; /* size in bytes */
50 /* I/O vector structures used in protocols between services. */
51 typedef struct {
52 vir_bytes iov_addr; /* address of an I/O buffer */
53 vir_bytes iov_size; /* sizeof an I/O buffer */
54 } iovec_t;
56 typedef struct {
57 cp_grant_id_t iov_grant; /* grant ID of an I/O buffer */
58 vir_bytes iov_size; /* sizeof an I/O buffer */
59 } iovec_s_t;
61 /* PM passes the address of a structure of this type to KERNEL when
62 * sys_sigsend() is invoked as part of the signal catching mechanism.
63 * The structure contain all the information that KERNEL needs to build
64 * the signal stack.
66 struct sigmsg {
67 int sm_signo; /* signal number being caught */
68 unsigned long sm_mask; /* mask to restore when handler returns */
69 vir_bytes sm_sighandler; /* address of handler */
70 vir_bytes sm_sigreturn; /* address of _sigreturn in C library */
71 vir_bytes sm_stkptr; /* user stack pointer */
74 /* Load data accounted every this no. of seconds. */
75 #define _LOAD_UNIT_SECS 6 /* Changing this breaks ABI. */
77 /* Load data history is kept for this long. */
78 #define _LOAD_HISTORY_MINUTES 15 /* Changing this breaks ABI. */
79 #define _LOAD_HISTORY_SECONDS (60*_LOAD_HISTORY_MINUTES)
81 /* We need this many slots to store the load history. */
82 #define _LOAD_HISTORY (_LOAD_HISTORY_SECONDS/_LOAD_UNIT_SECS)
84 /* Runnable processes and other load-average information. */
85 struct loadinfo {
86 u16_t proc_load_history[_LOAD_HISTORY]; /* history of proc_s_cur */
87 u16_t proc_last_slot;
88 clock_t last_clock;
91 struct machine {
92 unsigned processors_count; /* how many cpus are available */
93 unsigned bsp_id; /* id of the bootstrap cpu */
94 int padding; /* used to be protected */
95 int apic_enabled; /* does the kernel use APIC or not? */
96 phys_bytes acpi_rsdp; /* where is the acpi RSDP */
99 struct io_range
101 unsigned ior_base; /* Lowest I/O port in range */
102 unsigned ior_limit; /* Highest I/O port in range */
105 struct minix_mem_range
107 phys_bytes mr_base; /* Lowest memory address in range */
108 phys_bytes mr_limit; /* Highest memory address in range */
111 #define PROC_NAME_LEN 16
113 /* List of boot-time processes set in kernel/table.c. */
114 struct boot_image {
115 int proc_nr; /* process number to use */
116 char proc_name[PROC_NAME_LEN]; /* name in process table */
117 endpoint_t endpoint; /* endpoint number when started */
118 phys_bytes start_addr; /* Where it's in memory */
119 phys_bytes len;
122 /* Memory chunks. */
123 struct memory {
124 phys_bytes base;
125 phys_bytes size;
128 #define STATICINIT(v, n) \
129 if(!(v)) { \
130 if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \
131 panic("allocating " #v " failed: %d", n); \
135 /* The kernel outputs diagnostic messages in a circular buffer. */
136 struct kmessages {
137 int km_next; /* next index to write */
138 int km_size; /* current size in buffer */
139 char km_buf[_KMESS_BUF_SIZE]; /* buffer for messages */
140 char kmess_buf[80*25]; /* printable copy of message buffer */
141 int blpos; /* kmess_buf position */
144 #include <minix/config.h>
145 #include <machine/interrupt.h>
147 /* randomness struct: random sources after interrupts: */
148 #define RANDOM_SOURCES 16
149 #define RANDOM_ELEMENTS 64
151 typedef unsigned short rand_t;
153 struct k_randomness {
154 int random_elements, random_sources;
155 struct k_randomness_bin {
156 int r_next; /* next index to write */
157 int r_size; /* number of random elements */
158 rand_t r_buf[RANDOM_ELEMENTS]; /* buffer for random info */
159 } bin[RANDOM_SOURCES];
162 struct minix_kerninfo {
163 /* Binaries will depend on the offsets etc. in this
164 * structure, so it can't be changed willy-nilly. In
165 * other words, it is ABI-restricted.
167 #define KERNINFO_MAGIC 0xfc3b84bf
168 u32_t kerninfo_magic;
169 u32_t minix_feature_flags; /* features in minix kernel */
170 u32_t ki_flags; /* what is present in this struct */
171 u32_t flags_unused2;
172 u32_t flags_unused3;
173 u32_t flags_unused4;
174 struct kinfo *kinfo;
175 struct machine *machine;
176 struct kmessages *kmessages;
177 struct loadinfo *loadinfo;
178 struct minix_ipcvecs *minix_ipcvecs;
179 } __packed;
181 #define MINIX_KIF_IPCVECS (1L << 0)
183 #endif /* _TYPE_H */