Halt draft
This commit is contained in:
parent
3e639fe25d
commit
59d36a7c8e
7 changed files with 24 additions and 2 deletions
1
Makefile
1
Makefile
|
@ -135,6 +135,7 @@ UPROGS=\
|
|||
$U/_wc\
|
||||
$U/_zombie\
|
||||
$U/_clear\
|
||||
$U/_halt\
|
||||
|
||||
fs.img: mkfs/mkfs README.md $(UPROGS)
|
||||
mkfs/mkfs fs.img README.md $(UPROGS)
|
||||
|
|
|
@ -102,6 +102,7 @@ extern u64 sys_link(void);
|
|||
extern u64 sys_mkdir(void);
|
||||
extern u64 sys_close(void);
|
||||
extern u64 sys_trace(void);
|
||||
extern u64 sys_halt(void);
|
||||
|
||||
// An array mapping syscall numbers from syscall.h
|
||||
// to the function that handles the system call.
|
||||
|
@ -111,7 +112,7 @@ static u64 (*syscalls[])(void) = {
|
|||
[SYS_chdir] = sys_chdir, [SYS_dup] = sys_dup, [SYS_getpid] = sys_getpid, [SYS_sbrk] = sys_sbrk,
|
||||
[SYS_sleep] = sys_sleep, [SYS_uptime] = sys_uptime, [SYS_open] = sys_open, [SYS_write] = sys_write,
|
||||
[SYS_mknod] = sys_mknod, [SYS_unlink] = sys_unlink, [SYS_link] = sys_link, [SYS_mkdir] = sys_mkdir,
|
||||
[SYS_close] = sys_close, [SYS_trace] = sys_trace,
|
||||
[SYS_close] = sys_close, [SYS_trace] = sys_trace, [SYS_halt] = sys_halt,
|
||||
};
|
||||
|
||||
void
|
||||
|
|
|
@ -23,3 +23,4 @@
|
|||
#define SYS_mkdir 20
|
||||
#define SYS_close 21
|
||||
#define SYS_trace 22
|
||||
#define SYS_halt 23
|
||||
|
|
|
@ -96,3 +96,9 @@ sys_trace(void)
|
|||
/* TODO: Implement sys_trace */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
sys_halt(void)
|
||||
{
|
||||
/* TODO: Implement sys_halt */
|
||||
}
|
||||
|
|
9
user/halt.c
Normal file
9
user/halt.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "user.h"
|
||||
|
||||
/** Stops the machine */
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
halt();
|
||||
return 0;
|
||||
}
|
|
@ -74,6 +74,9 @@ int uptime(void);
|
|||
/** trace */
|
||||
int trace(int);
|
||||
|
||||
/** halt */
|
||||
void halt(void);
|
||||
|
||||
/**
|
||||
* Library functions (ulib.c)
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@ sub entry {
|
|||
print " ecall\n";
|
||||
print " ret\n";
|
||||
}
|
||||
|
||||
|
||||
entry("fork");
|
||||
entry("exit");
|
||||
entry("wait");
|
||||
|
@ -37,3 +37,4 @@ entry("sbrk");
|
|||
entry("sleep");
|
||||
entry("uptime");
|
||||
entry("trace");
|
||||
entry("halt");
|
||||
|
|
Loading…
Reference in a new issue