From 625f3b6e4187e4e1bde1a3f5522885b6c473c51a Mon Sep 17 00:00:00 2001 From: Abinader <abinade2@illinois.edu> Date: Mon, 30 Apr 2018 14:58:36 -0500 Subject: [PATCH] changed switch_terminal signature --- student-distrib/scheduler.h | 2 +- student-distrib/terminal.c | 14 +++++--------- student-distrib/terminal.h | 11 ++++------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/student-distrib/scheduler.h b/student-distrib/scheduler.h index edf65f5..f26885a 100644 --- a/student-distrib/scheduler.h +++ b/student-distrib/scheduler.h @@ -8,7 +8,7 @@ extern void scheduler(void); /* function needed from other place */ int32_t execute (const uint8_t* command); -int32_t switch_terminal(int32_t term_id); +void switch_terminal(int32_t term_id); int32_t remap_proc(int32_t pid); void store_vid_mem(int32_t term_id); diff --git a/student-distrib/terminal.c b/student-distrib/terminal.c index f228cba..5873f90 100644 --- a/student-distrib/terminal.c +++ b/student-distrib/terminal.c @@ -199,23 +199,23 @@ void init_terminal(void) * * SIDE EFFECTS: switching terminal */ -int32_t switch_terminal(int32_t term_id) +void switch_terminal(int32_t term_id) { int32_t prev_terminal; //check for valid terminal id (from 0 to 2) and if we maxed out on processes if( term_id < 0 || term_id > 2 || total_prog_count > MAX_PROCESS) - return -2; + return; //retrieve currently visible terminal prev_terminal = visible_terminal; //check if we're not switching to the same screen if(term_id == prev_terminal) - return -1; + return; //set current terminal in control structure - visible_terminal = term_id; + visible_terminal = term_id; //restore paging from 0xb8000 to prev_terminal video mapping restore_vid_mem(); @@ -226,11 +226,7 @@ int32_t switch_terminal(int32_t term_id) //display new terminal video memory memcpy( (void*)TERM_VID, (const void*) terminal[visible_terminal].vid_mem, _4_KB ); - //set new terminal to update to physical video memory - //store_vid_mem(visible_terminal); - update_cursor(visible_terminal); - //check if shell is running on that terminal - return ( terminal[term_id].terminal_prog_count == 0) ? 0 : 1; + return; } diff --git a/student-distrib/terminal.h b/student-distrib/terminal.h index d63587c..8618003 100644 --- a/student-distrib/terminal.h +++ b/student-distrib/terminal.h @@ -4,7 +4,6 @@ #include "lib.h" #include "types.h" #include "keyboard.h" -#include "paging.h" extern void clear_buffer(void); extern void buffer_backspace(void); @@ -15,18 +14,16 @@ extern int32_t terminal_read(int32_t fd, void* buf, int32_t nbytes); extern int32_t terminal_write(int32_t fd, const void* buf, int32_t nbytes); extern int32_t terminal_open(const uint8_t* filename); extern int32_t terminal_close(int32_t fd); - -void restore_vid_mem(void); -void store_vid_mem(int32_t term_id); - -extern int32_t switch_terminal(int32_t term_id); +extern void switch_terminal(int32_t term_id); void init_terminal(void); void copy_term_data(int32_t term_id, int32_t cmd); void clear_term_vid(void); -//void update_cursor(); //function from other place void remap_term(int32_t term_id); +void restore_vid_mem(void); +void store_vid_mem(int32_t term_id); int32_t execute (const uint8_t* command); + #endif -- GitLab