From 17bd229f57a94b467235ba7d2a626e39aa661166 Mon Sep 17 00:00:00 2001 From: Divyam Khandelwal <divyam@wirelessprv-10-194-9-252.near.illinois.edu> Date: Sat, 28 Apr 2018 20:22:27 -0500 Subject: [PATCH] Vidmap updated, fish still broken --- student-distrib/paging.c | 16 ++++++++++------ student-distrib/paging.h | 2 +- student-distrib/scheduler.c | 1 + student-distrib/syscall.c | 9 ++++----- student-distrib/syscall.h | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/student-distrib/paging.c b/student-distrib/paging.c index de330a3..d451d09 100644 --- a/student-distrib/paging.c +++ b/student-distrib/paging.c @@ -22,7 +22,7 @@ void paging_initi(void){ } /* First page table entry need to be 0 */ - page_table[0] = 0x0; + // page_table[0] = 0x0; /* Set page table for video memory */ page_table[VIDEO_MEM + 0] |= USER | PRESENT; @@ -80,18 +80,22 @@ void remap2(int32_t term_id){ * Return Value: void * Function: Initialises page for video memory */ -uint8_t* remap_vidmem(uint32_t pid){ +void remap_vidmem(){ - int32_t addr = VIDEO_MEM + pid * 4 + 3; //3 = offset for multiple terminals + page_directory[33] = (uint32_t)(uint32_t)page_table | USER | READ_WRITE | PRESENT; - page_table[addr] = VIDEO_ADDR | USER | READ_WRITE | PRESENT; + if(visible_terminal == running_terminal) + + page_table[0] = ((uint32_t)0xB8000) | USER | READ_WRITE | PRESENT; - page_directory[0] = ((uint32_t)page_table) | USER | READ_WRITE | PRESENT; + else + + page_table[0] = ((uint32_t)(0xB8000 + (running_terminal+1)*0x1000 )) | USER | READ_WRITE | PRESENT; // flush TLB flush_tlb(); - return (uint8_t*)(addr << 12); + return; } /* remap_program diff --git a/student-distrib/paging.h b/student-distrib/paging.h index 3bae8d9..8db45b5 100644 --- a/student-distrib/paging.h +++ b/student-distrib/paging.h @@ -62,7 +62,7 @@ extern void remap1(int32_t term_id); extern void remap2(int32_t term_id); -extern uint8_t* remap_vidmem(uint32_t pid); +extern void remap_vidmem(); extern int32_t remap_proc(int32_t pid); extern void remap_program(uint32_t pid); extern void remap_term(int32_t term_id); diff --git a/student-distrib/scheduler.c b/student-distrib/scheduler.c index e642ad3..23ad1dc 100644 --- a/student-distrib/scheduler.c +++ b/student-distrib/scheduler.c @@ -52,6 +52,7 @@ void scheduler(void){ return; } + remap_vidmem(); remap2(running_terminal); pcb_t* next_pcb = terminal[running_terminal].pcb; diff --git a/student-distrib/syscall.c b/student-distrib/syscall.c index 778005a..82e01b0 100644 --- a/student-distrib/syscall.c +++ b/student-distrib/syscall.c @@ -98,7 +98,7 @@ int32_t execute(const uint8_t* command){ return 0; printf("[EXE] running_terminal = %d\n", running_terminal); - printf("[EXE] strlen(command) = %d\n", strlen(command)); + printf("[EXE] (command) = %s\n", command); // if cpu reaches its maximum control, abort if( total_prog_count >= MAX_PROCESS) @@ -485,15 +485,14 @@ int32_t vidmap (uint8_t** screen_start){ if ( addr < VID_STA || addr > VID_END) return -1; - terminal[ visible_terminal].pcb = current_pcb(); + remap_vidmem(); - *screen_start = remap_vidmem( terminal[ visible_terminal].pcb->pid); + *screen_start = (uint8_t *)(0x8400000); //screen_start = terminal[ running_terminal].vid_mem; - flush_tlb(); - return 0; + return 0x8400000; } /* diff --git a/student-distrib/syscall.h b/student-distrib/syscall.h index 940f1b7..2062696 100644 --- a/student-distrib/syscall.h +++ b/student-distrib/syscall.h @@ -37,7 +37,7 @@ extern int32_t sigreturn (void); //from paging.h void flush_tlb(void); void remap_program(uint32_t pid); -uint8_t* remap_vidmem(uint32_t pid); +//uint8_t* remap_vidmem(uint32_t pid); //from proc.h int32_t parse_cmd(const uint8_t* command, uint8_t* cmd, uint8_t (*argv)[MAX_ARGUMENT_SIZE]); /* Function for parsing commands */ -- GitLab