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/_wc\
|
||||||
$U/_zombie\
|
$U/_zombie\
|
||||||
$U/_clear\
|
$U/_clear\
|
||||||
|
$U/_halt\
|
||||||
|
|
||||||
fs.img: mkfs/mkfs README.md $(UPROGS)
|
fs.img: mkfs/mkfs README.md $(UPROGS)
|
||||||
mkfs/mkfs fs.img 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_mkdir(void);
|
||||||
extern u64 sys_close(void);
|
extern u64 sys_close(void);
|
||||||
extern u64 sys_trace(void);
|
extern u64 sys_trace(void);
|
||||||
|
extern u64 sys_halt(void);
|
||||||
|
|
||||||
// An array mapping syscall numbers from syscall.h
|
// An array mapping syscall numbers from syscall.h
|
||||||
// to the function that handles the system call.
|
// 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_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_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_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
|
void
|
||||||
|
|
|
@ -23,3 +23,4 @@
|
||||||
#define SYS_mkdir 20
|
#define SYS_mkdir 20
|
||||||
#define SYS_close 21
|
#define SYS_close 21
|
||||||
#define SYS_trace 22
|
#define SYS_trace 22
|
||||||
|
#define SYS_halt 23
|
||||||
|
|
|
@ -96,3 +96,9 @@ sys_trace(void)
|
||||||
/* TODO: Implement sys_trace */
|
/* TODO: Implement sys_trace */
|
||||||
return 0;
|
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 */
|
/** trace */
|
||||||
int trace(int);
|
int trace(int);
|
||||||
|
|
||||||
|
/** halt */
|
||||||
|
void halt(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Library functions (ulib.c)
|
* Library functions (ulib.c)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,7 +14,7 @@ sub entry {
|
||||||
print " ecall\n";
|
print " ecall\n";
|
||||||
print " ret\n";
|
print " ret\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
entry("fork");
|
entry("fork");
|
||||||
entry("exit");
|
entry("exit");
|
||||||
entry("wait");
|
entry("wait");
|
||||||
|
@ -37,3 +37,4 @@ entry("sbrk");
|
||||||
entry("sleep");
|
entry("sleep");
|
||||||
entry("uptime");
|
entry("uptime");
|
||||||
entry("trace");
|
entry("trace");
|
||||||
|
entry("halt");
|
||||||
|
|
Loading…
Reference in a new issue