Modestus Moon OS  R4
CS 450 project
mpx_supt.h
Go to the documentation of this file.
1 #ifndef _MPX_SUPT_H
2 #define _MPX_SUPT_H
3 
4 #include <system.h>
5 
6 #define EXIT 0
7 #define IDLE 1
8 #define READ 2
9 #define WRITE 3
10 
11 #define MODULE_R1 0
12 #define MODULE_R2 1
13 #define MODULE_R3 2
14 #define MODULE_R4 4
15 #define MODULE_R5 8
16 
17 
18 typedef struct {
19  int op_code;
20  int device_id;
21 } param;
22 
23 /*
24  Procedure..: sys_req
25  Description..: Generate interrupt 60H
26  Params..: int op_code (IDLE)
27 */
28 int sys_req( int op_code );
29 
30 /*
31  Procedure..: mpx_init
32  Description..: Initialize MPX support software
33  Params..: int cur_mod (symbolic constants MODULE_R1, MODULE_R2, etc
34 */
35 void mpx_init(int cur_mod);
36 
37 /*
38  Procedure..: set_malloc
39  Description..: Sets the memory allocation function for sys_alloc_mem
40  Params..: Function pointer
41 */
42 void sys_set_malloc(void* (*func)(size_t));
43 
44 /*
45  Procedure..: set_free
46  Description..: Sets the memory free function for sys_free_mem
47  Params..: s1-destination, s2-source
48 */
49 void sys_set_free(int (*func)(void *));
50 
51 /*
52  Procedure..: sys_alloc_mem
53  Description..: Allocates a block of memory (similar to malloc)
54  Params..: Number of bytes to allocate
55 */
56 void *sys_alloc_mem(u32int size);
57 
58 /*
59  Procedure..: sys_free_mem
60  Description..: Frees memory
61  Params..: Pointer to block of memory to free
62 */
63 int sys_free_mem(void *ptr);
64 
65 /*
66  Procedure..: idle
67  Description..: The idle process
68  Params..: None
69 */
70 void idle();
71 
78 
79 #endif
uint32_t * sys_call(processContext_t *context)
sys_call
Definition: mpx_supt.c:62
void * sys_alloc_mem(u32int size)
Definition: mpx_supt.c:33
int sys_req(int op_code)
Definition: mpx_supt.c:11
The s_processContext struct defines the context that each process stores .
Definition: system.h:71
void sys_set_malloc(void *(*func)(size_t))
Definition: mpx_supt.c:23
int device_id
Definition: mpx_supt.h:20
int sys_free_mem(void *ptr)
Definition: mpx_supt.c:41
int op_code
Definition: mpx_supt.h:19
Definition: mpx_supt.h:18
unsigned long uint32_t
Definition: system.h:31
void sys_set_free(int(*func)(void *))
Definition: mpx_supt.c:28
unsigned long u32int
Definition: system.h:27
void mpx_init(int cur_mod)
Definition: mpx_supt.c:18
void idle()
Definition: mpx_supt.c:49