diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 65 |
1 files changed, 53 insertions, 12 deletions
@@ -11,6 +11,7 @@ pcb * pcb_list;
pcb * ready_queue;
pcb * io_init_queue;
+pcb * cop;
pcb pcb0;
pcb pcb1;
@@ -25,7 +26,10 @@ pcb pcb9; pcb pcb10;
pcb pcb11;
+unsigned sys_stack[STACK_SIZE];
+
int main(void) {
+ pcb * pcb_addr;
printf("Booting MPX... \n");
/* Put initialization code here */
@@ -43,21 +47,58 @@ int main(void) { pcb10.chain = &pcb11;
pcb11.chain = NULL;
- build_pcb(&pcb0, " ", FREE, -1, -1, 0);
- build_pcb(&pcb1, " ", FREE, -1, -1, 0);
- build_pcb(&pcb2, " ", FREE, -1, -1, 0);
- build_pcb(&pcb3, " ", FREE, -1, -1, 0);
- build_pcb(&pcb4, " ", FREE, -1, -1, 0);
- build_pcb(&pcb5, " ", FREE, -1, -1, 0);
- build_pcb(&pcb6, " ", FREE, -1, -1, 0);
- build_pcb(&pcb7, " ", FREE, -1, -1, 0);
- build_pcb(&pcb8, " ", FREE, -1, -1, 0);
- build_pcb(&pcb9, " ", FREE, -1, -1, 0);
- build_pcb(&pcb10, " ", FREE, -1, -1, 0);
- build_pcb(&pcb11, " ", FREE, -1, -1, 0);
+ build_pcb(&pcb0, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb1, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb2, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb3, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb4, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb5, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb6, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb7, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb8, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb9, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb10, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
+ build_pcb(&pcb11, " ", FREE, -1, -1, 0, NULL, NULL, NULL, NULL);
pcb_list = &pcb0;
+ // initialize the currently running process
+ cop = NULL;
+
+ // initialize the mod3 test pcbs
+ pcb_addr = get_pcb(pcb_list);
+ build_pcb(pcb_addr, "test1", APP_PROCESS, READY, NOT_SUSPENDED, 0, _CS,
+ (unsigned)test1, _DS, 0x200);
+ insert_pcb(&ready_queue, pcb_addr, 0);
+
+ pcb_addr = get_pcb(pcb_list);
+ build_pcb(pcb_addr, "test2",APP_PROCESS, READY, NOT_SUSPENDED, 0, _CS,
+ (unsigned)test2, _DS, 0x200);
+ insert_pcb(&ready_queue, pcb_addr, 0);
+
+ pcb_addr = get_pcb(pcb_list);
+ build_pcb(pcb_addr, "test3", APP_PROCESS, READY, NOT_SUSPENDED, 0, _CS,
+ (unsigned)test3, _DS, 0x200);
+ insert_pcb(&ready_queue, pcb_addr, 0);
+
+ pcb_addr = get_pcb(pcb_list);
+ build_pcb(pcb_addr, "test4", APP_PROCESS, READY, NOT_SUSPENDED, 0, _CS,
+ (unsigned)test4, _DS, 0x200);
+ insert_pcb(&ready_queue, pcb_addr, 0);
+
+ pcb_addr = get_pcb(pcb_list);
+ build_pcb(pcb_addr, "test5", APP_PROCESS, READY, NOT_SUSPENDED, 0, _CS,
+ (unsigned)test5, _DS, 0x200);
+ insert_pcb(&ready_queue, pcb_addr, 0);
+
+ // initialize the system stack
+ _SP = (unsigned) &sys_stack[STACK_SIZE -1];
+
+ //get the show on the road!
+ sys_init();
+ dispatch();
+
+ //never gonna get here
comhan(); /* Execute the command handler */
return 0;
|