1 | #ifndef TYPE_H
|
---|
2 | #define TYPE_H
|
---|
3 |
|
---|
4 | typedef _PROTOTYPE( void task_t, (void) );
|
---|
5 |
|
---|
6 | /* Process table and system property related types. */
|
---|
7 | typedef int proc_nr_t; /* process table entry number */
|
---|
8 | typedef short sys_id_t; /* system process index */
|
---|
9 | typedef struct { /* bitmap for system indexes */
|
---|
10 | bitchunk_t chunk[BITMAP_CHUNKS(NR_SYS_PROCS)];
|
---|
11 | } sys_map_t;
|
---|
12 |
|
---|
13 | struct boot_image {
|
---|
14 | proc_nr_t proc_nr; /* process number to use */
|
---|
15 | task_t *initial_pc; /* start function for tasks */
|
---|
16 | int flags; /* process flags */
|
---|
17 | unsigned char quantum; /* quantum (tick count) */
|
---|
18 | int priority; /* scheduling priority */
|
---|
19 | int stksize; /* stack size for tasks */
|
---|
20 | short trap_mask; /* allowed system call traps */
|
---|
21 | bitchunk_t ipc_to; /* send mask protection */
|
---|
22 | long call_mask; /* system call protection */
|
---|
23 | char proc_name[P_NAME_LEN]; /* name in process table */
|
---|
24 | int endpoint; /* endpoint number when started */
|
---|
25 | };
|
---|
26 |
|
---|
27 | struct memory {
|
---|
28 | phys_clicks base; /* start address of chunk */
|
---|
29 | phys_clicks size; /* size of memory chunk */
|
---|
30 | };
|
---|
31 |
|
---|
32 | /* The kernel outputs diagnostic messages in a circular buffer. */
|
---|
33 | struct kmessages {
|
---|
34 | int km_next; /* next index to write */
|
---|
35 | int km_size; /* current size in buffer */
|
---|
36 | char km_buf[KMESS_BUF_SIZE]; /* buffer for messages */
|
---|
37 | };
|
---|
38 |
|
---|
39 | struct randomness {
|
---|
40 | struct {
|
---|
41 | int r_next; /* next index to write */
|
---|
42 | int r_size; /* number of random elements */
|
---|
43 | unsigned short r_buf[RANDOM_ELEMENTS]; /* buffer for random info */
|
---|
44 | } bin[RANDOM_SOURCES];
|
---|
45 | };
|
---|
46 |
|
---|
47 | #if (CHIP == INTEL)
|
---|
48 | typedef unsigned reg_t; /* machine register */
|
---|
49 |
|
---|
50 | /* The stack frame layout is determined by the software, but for efficiency
|
---|
51 | * it is laid out so the assembly code to use it is as simple as possible.
|
---|
52 | * 80286 protected mode and all real modes use the same frame, built with
|
---|
53 | * 16-bit registers. Real mode lacks an automatic stack switch, so little
|
---|
54 | * is lost by using the 286 frame for it. The 386 frame differs only in
|
---|
55 | * having 32-bit registers and more segment registers. The same names are
|
---|
56 | * used for the larger registers to avoid differences in the code.
|
---|
57 | */
|
---|
58 | struct stackframe_s { /* proc_ptr points here */
|
---|
59 | #if _WORD_SIZE == 4
|
---|
60 | u16_t gs; /* last item pushed by save */
|
---|
61 | u16_t fs; /* ^ */
|
---|
62 | #endif
|
---|
63 | u16_t es; /* | */
|
---|
64 | u16_t ds; /* | */
|
---|
65 | reg_t di; /* di through cx are not accessed in C */
|
---|
66 | reg_t si; /* order is to match pusha/popa */
|
---|
67 | reg_t fp; /* bp */
|
---|
68 | reg_t st; /* hole for another copy of sp */
|
---|
69 | reg_t bx; /* | */
|
---|
70 | reg_t dx; /* | */
|
---|
71 | reg_t cx; /* | */
|
---|
72 | reg_t retreg; /* ax and above are all pushed by save */
|
---|
73 | reg_t retadr; /* return address for assembly code save() */
|
---|
74 | reg_t pc; /* ^ last item pushed by interrupt */
|
---|
75 | reg_t cs; /* | */
|
---|
76 | reg_t psw; /* | */
|
---|
77 | reg_t sp; /* | */
|
---|
78 | reg_t ss; /* these are pushed by CPU during interrupt */
|
---|
79 | };
|
---|
80 |
|
---|
81 | struct segdesc_s { /* segment descriptor for protected mode */
|
---|
82 | u16_t limit_low;
|
---|
83 | u16_t base_low;
|
---|
84 | u8_t base_middle;
|
---|
85 | u8_t access; /* |P|DL|1|X|E|R|A| */
|
---|
86 | u8_t granularity; /* |G|X|0|A|LIMT| */
|
---|
87 | u8_t base_high;
|
---|
88 | };
|
---|
89 |
|
---|
90 | typedef unsigned long irq_policy_t;
|
---|
91 | typedef unsigned long irq_id_t;
|
---|
92 |
|
---|
93 | typedef struct irq_hook {
|
---|
94 | struct irq_hook *next; /* next hook in chain */
|
---|
95 | int (*handler)(struct irq_hook *); /* interrupt handler */
|
---|
96 | int irq; /* IRQ vector number */
|
---|
97 | int id; /* id of this hook */
|
---|
98 | int proc_nr_e; /* (endpoint) NONE if not in use */
|
---|
99 | irq_id_t notify_id; /* id to return on interrupt */
|
---|
100 | irq_policy_t policy; /* bit mask for policy */
|
---|
101 | } irq_hook_t;
|
---|
102 |
|
---|
103 | typedef int (*irq_handler_t)(struct irq_hook *);
|
---|
104 |
|
---|
105 | #endif /* (CHIP == INTEL) */
|
---|
106 |
|
---|
107 | #if (CHIP == M68000)
|
---|
108 | /* M68000 specific types go here. */
|
---|
109 | #endif /* (CHIP == M68000) */
|
---|
110 |
|
---|
111 | #endif /* TYPE_H */
|
---|