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