diff --git a/student-distrib/scheduler.h b/student-distrib/scheduler.h index edf65f593032e645b0de7bfc2b3f93a992e38f63..f26885a5c58c66d979ec9bc2e5d318c52808df66 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 f228cbae0bc9dd508ce1969f050f25fac22a8b4b..5873f90c003b0edad851c6cfa04277d598ff1518 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 d63587c949f8b9a134a1e5354c40074b131a8269..8618003cc18a16a1e395c37b531559b2080587a2 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