Skip to content
Snippets Groups Projects
Commit 625f3b6e authored by abinade2's avatar abinade2
Browse files

changed switch_terminal signature

parent 257d6218
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ extern void scheduler(void); ...@@ -8,7 +8,7 @@ extern void scheduler(void);
/* function needed from other place */ /* function needed from other place */
int32_t execute (const uint8_t* command); 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); int32_t remap_proc(int32_t pid);
void store_vid_mem(int32_t term_id); void store_vid_mem(int32_t term_id);
......
...@@ -199,23 +199,23 @@ void init_terminal(void) ...@@ -199,23 +199,23 @@ void init_terminal(void)
* *
* SIDE EFFECTS: switching terminal * SIDE EFFECTS: switching terminal
*/ */
int32_t switch_terminal(int32_t term_id) void switch_terminal(int32_t term_id)
{ {
int32_t prev_terminal; int32_t prev_terminal;
//check for valid terminal id (from 0 to 2) and if we maxed out on processes //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) if( term_id < 0 || term_id > 2 || total_prog_count > MAX_PROCESS)
return -2; return;
//retrieve currently visible terminal //retrieve currently visible terminal
prev_terminal = visible_terminal; prev_terminal = visible_terminal;
//check if we're not switching to the same screen //check if we're not switching to the same screen
if(term_id == prev_terminal) if(term_id == prev_terminal)
return -1; return;
//set current terminal in control structure //set current terminal in control structure
visible_terminal = term_id; visible_terminal = term_id;
//restore paging from 0xb8000 to prev_terminal video mapping //restore paging from 0xb8000 to prev_terminal video mapping
restore_vid_mem(); restore_vid_mem();
...@@ -226,11 +226,7 @@ int32_t switch_terminal(int32_t term_id) ...@@ -226,11 +226,7 @@ int32_t switch_terminal(int32_t term_id)
//display new terminal video memory //display new terminal video memory
memcpy( (void*)TERM_VID, (const void*) terminal[visible_terminal].vid_mem, _4_KB ); 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); update_cursor(visible_terminal);
//check if shell is running on that terminal return;
return ( terminal[term_id].terminal_prog_count == 0) ? 0 : 1;
} }
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "lib.h" #include "lib.h"
#include "types.h" #include "types.h"
#include "keyboard.h" #include "keyboard.h"
#include "paging.h"
extern void clear_buffer(void); extern void clear_buffer(void);
extern void buffer_backspace(void); extern void buffer_backspace(void);
...@@ -15,18 +14,16 @@ extern int32_t terminal_read(int32_t fd, void* buf, int32_t nbytes); ...@@ -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_write(int32_t fd, const void* buf, int32_t nbytes);
extern int32_t terminal_open(const uint8_t* filename); extern int32_t terminal_open(const uint8_t* filename);
extern int32_t terminal_close(int32_t fd); extern int32_t terminal_close(int32_t fd);
extern void switch_terminal(int32_t term_id);
void restore_vid_mem(void);
void store_vid_mem(int32_t term_id);
extern int32_t switch_terminal(int32_t term_id);
void init_terminal(void); void init_terminal(void);
void copy_term_data(int32_t term_id, int32_t cmd); void copy_term_data(int32_t term_id, int32_t cmd);
void clear_term_vid(void); void clear_term_vid(void);
//void update_cursor();
//function from other place //function from other place
void remap_term(int32_t term_id); 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); int32_t execute (const uint8_t* command);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment