Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
abinade2
kernel
Commits
625f3b6e
Commit
625f3b6e
authored
7 years ago
by
abinade2
Browse files
Options
Downloads
Patches
Plain Diff
changed switch_terminal signature
parent
257d6218
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
student-distrib/scheduler.h
+1
-1
1 addition, 1 deletion
student-distrib/scheduler.h
student-distrib/terminal.c
+5
-9
5 additions, 9 deletions
student-distrib/terminal.c
student-distrib/terminal.h
+4
-7
4 additions, 7 deletions
student-distrib/terminal.h
with
10 additions
and
17 deletions
student-distrib/scheduler.h
+
1
−
1
View file @
625f3b6e
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
student-distrib/terminal.c
+
5
−
9
View file @
625f3b6e
...
@@ -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
;
}
}
This diff is collapsed.
Click to expand it.
student-distrib/terminal.h
+
4
−
7
View file @
625f3b6e
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment