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
e2b818c5
Commit
e2b818c5
authored
7 years ago
by
abinade2
Browse files
Options
Downloads
Patches
Plain Diff
Exiting shells, parse command fixed
parent
9f59fe2b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
student-distrib/proc.c
+4
-2
4 additions, 2 deletions
student-distrib/proc.c
student-distrib/syscall.c
+14
-14
14 additions, 14 deletions
student-distrib/syscall.c
with
18 additions
and
16 deletions
student-distrib/proc.c
+
4
−
2
View file @
e2b818c5
...
...
@@ -158,7 +158,8 @@ int32_t parse_cmd(const uint8_t* command, uint8_t* parsed_cmd, uint8_t (*argv)[M
//copy command to parsed_cmd
for
(
i
=
0
;
i
<
(
end
-
start
);
i
++
)
parsed_cmd
[
i
]
=
command
[
i
+
start
];
if
(
command
[
i
+
start
]
!=
0x0D
)
//check for \n
parsed_cmd
[
i
]
=
command
[
i
+
start
];
command_length
=
strlen
((
int8_t
*
)
command
);
...
...
@@ -195,7 +196,8 @@ int32_t parse_cmd(const uint8_t* command, uint8_t* parsed_cmd, uint8_t (*argv)[M
//copy argument to return array
for
(
i
=
0
;
i
<
(
end
-
start
);
i
++
)
argv
[
j
][
i
]
=
command
[
i
+
start
];
if
(
command
[
i
+
start
]
!=
0x0D
)
//check for \n
argv
[
j
][
i
]
=
command
[
i
+
start
];
}
...
...
This diff is collapsed.
Click to expand it.
student-distrib/syscall.c
+
14
−
14
View file @
e2b818c5
...
...
@@ -16,7 +16,7 @@ int32_t halt (uint8_t status){
pcb_t
*
pcb_cur
=
terminal
[
running_terminal
].
pcb
;
//pcb_t* pcb_cur = current_pcb();
printf
(
"[halt] running_terminal = %d
\n
"
,
running_terminal
);
//
printf("[halt] running_terminal = %d\n", running_terminal);
pcb_t
*
pcb_prev
=
pcb_cur
->
parent_pcb
;
...
...
@@ -31,13 +31,13 @@ int32_t halt (uint8_t status){
if
(
terminal
[
running_terminal
].
terminal_prog_count
>
0
)
{
total_prog_count
--
;
terminal
[
pcb_cur
->
running_terminal
].
terminal_prog_count
--
;
clear_pid
(
pcb_cur
->
pid
);
total_prog_count
--
;
terminal
[
pcb_cur
->
running_terminal
].
terminal_prog_count
--
;
}
if
(
/*pcb_cur->pid == pcb_cur->parent_pid*/
pcb_cur
->
shell_flag
==
1
)
if
(
terminal
[
running_terminal
].
terminal_prog_count
==
0
)
{
clear_pid
(
pcb_cur
->
pid
);
printf
(
"[halt] executing new shell...
\n
"
);
execute
((
uint8_t
*
)
"shell"
);
}
...
...
@@ -97,15 +97,8 @@ int32_t execute(const uint8_t* command){
if
(
strlen
(
command
)
==
1
)
return
0
;
printf
(
"[EXE] running_terminal = %d
\n
"
,
running_terminal
);
printf
(
"[EXE] (command) = %s
\n
"
,
command
);
// if cpu reaches its maximum control, abort
if
(
total_prog_count
>=
MAX_PROCESS
)
{
printf
(
"[execute] Reached maximum number of processes %d
\n
"
,
MAX_PROCESS
);
return
0
;
}
// printf("[EXE] running_terminal = %d\n", running_terminal);
// printf("[EXE] (command) = %s\n", command);
//------------------ 0 : Parse args ----------------------------------------
...
...
@@ -134,6 +127,13 @@ int32_t execute(const uint8_t* command){
//------------------ 1: Executable check -----------------------------------
// if cpu reaches its maximum control, abort
if
(
total_prog_count
>=
MAX_PROCESS
)
{
printf
(
"[execute] Reached maximum number of processes %d
\n
"
,
MAX_PROCESS
);
return
0
;
}
dentry_t
dentry
;
uint8_t
buf
[
4
];
uint32_t
entry_point
;
...
...
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