Compare commits
2 commits
146e7f65ca
...
b8b8f58fee
Author | SHA1 | Date | |
---|---|---|---|
|
b8b8f58fee | ||
|
bae44d0333 |
2 changed files with 31 additions and 14 deletions
25
user/banner.h
Normal file
25
user/banner.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
unsigned char banner[] = {
|
||||
0x0a, 0x20, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x20, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96,
|
||||
0x88, 0xe2, 0x95, 0x97, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x20, 0x20, 0x20, 0xe2, 0x96, 0x88,
|
||||
0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88,
|
||||
0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x0a, 0x20, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2,
|
||||
0x96, 0x88, 0xe2, 0x95, 0x97, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0xe2, 0x96,
|
||||
0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x91, 0x20, 0x20, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x91,
|
||||
0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2,
|
||||
0x95, 0x90, 0xe2, 0x95, 0x9d, 0x0a, 0x20, 0x20, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2,
|
||||
0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x91, 0x20,
|
||||
0x20, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x91, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96,
|
||||
0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x0a, 0x20, 0x20,
|
||||
0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97,
|
||||
0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96,
|
||||
0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x90,
|
||||
0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x0a, 0x20, 0x20, 0xe2,
|
||||
0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2,
|
||||
0x95, 0x97, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2,
|
||||
0x95, 0x94, 0xe2, 0x95, 0x9d, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2,
|
||||
0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0x0a, 0x20, 0x20, 0xe2, 0x95,
|
||||
0x9a, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x9d, 0x20, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x9d, 0x20,
|
||||
0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x9d, 0x20, 0x20, 0x20,
|
||||
0xe2, 0x95, 0x9a, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2,
|
||||
0x95, 0x9d, 0x0a, 0x0a, 0x00,
|
||||
};
|
20
user/init.c
20
user/init.c
|
@ -8,21 +8,10 @@
|
|||
#include "kernel/file.h"
|
||||
#include "user/user.h"
|
||||
#include "kernel/fcntl.h"
|
||||
#include "user/banner.h"
|
||||
|
||||
char *argv[] = { "sh", 0 };
|
||||
|
||||
// clang-format off
|
||||
const char *banner =
|
||||
"\n $$\\ $$\\ $$$$$$\\\n"
|
||||
" $$ | $$ | $$ __$$\\ \n"
|
||||
" \\$$\\ $$ |$$\\ $$\\ $$ / \\__|\n"
|
||||
" \\$$$$ / \\$$\\ $$ |$$$$$$$\\ \n"
|
||||
" $$ $$< \\$$\\$$ / $$ __$$\\ \n"
|
||||
" $$ /\\$$\\ \\$$$ / $$ / $$ |\n"
|
||||
" $$ / $$ | \\$ / $$$$$$ |\n"
|
||||
" \\__| \\__| \\_/ \\______/\n\n";
|
||||
// clang-format on
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
@ -37,7 +26,8 @@ main(void)
|
|||
|
||||
for(;;) {
|
||||
printf("init: starting sh\n");
|
||||
printf(banner);
|
||||
// printf(banner);
|
||||
printf((const char *)banner);
|
||||
pid = fork();
|
||||
if(pid < 0) {
|
||||
printf("init: fork failed\n");
|
||||
|
@ -54,7 +44,9 @@ main(void)
|
|||
// or if a parentless process exits.
|
||||
wpid = wait((int *)0);
|
||||
if(wpid == pid) {
|
||||
// the shell exited; restart it.
|
||||
// FIXME: Obviously not how things should be done
|
||||
printf("\nShell exited... Halting\n");
|
||||
halt();
|
||||
break;
|
||||
} else if(wpid < 0) {
|
||||
printf("init: wait returned an error\n");
|
||||
|
|
Loading…
Reference in a new issue