Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
邵果毅
expProject266346
Commits
cc486dde
Commit
cc486dde
authored
2 years ago
by
Frans Kaashoek
Browse files
Options
Download
Patches
Plain Diff
Help students read this C syntax
parent
96047832
util
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kernel/syscall.c
+5
-0
kernel/syscall.c
with
5 additions
and
0 deletions
+5
-0
kernel/syscall.c
+
5
−
0
View file @
cc486dde
...
...
@@ -79,6 +79,7 @@ argstr(int n, char *buf, int max)
return
fetchstr
(
addr
,
buf
,
max
);
}
// Prototypes for the functions that handle system calls.
extern
uint64
sys_fork
(
void
);
extern
uint64
sys_exit
(
void
);
extern
uint64
sys_wait
(
void
);
...
...
@@ -101,6 +102,8 @@ extern uint64 sys_link(void);
extern
uint64
sys_mkdir
(
void
);
extern
uint64
sys_close
(
void
);
// An array mapping syscall numbers from syscall.h
// to the function that handles the system call.
static
uint64
(
*
syscalls
[])(
void
)
=
{
[
SYS_fork
]
sys_fork
,
[
SYS_exit
]
sys_exit
,
...
...
@@ -133,6 +136,8 @@ syscall(void)
num
=
p
->
trapframe
->
a7
;
if
(
num
>
0
&&
num
<
NELEM
(
syscalls
)
&&
syscalls
[
num
])
{
// Use num to lookup the system call function for num, call it,
// and store its return value in p->trapframe->a0
p
->
trapframe
->
a0
=
syscalls
[
num
]();
}
else
{
printf
(
"%d %s: unknown sys call %d
\n
"
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets