summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanjie Wu <hanjiew@andrew.cmu.edu>2023-04-23 12:41:16 -0400
committerHanjie Wu <hanjiew@andrew.cmu.edu>2023-04-23 12:41:16 -0400
commit8b93cd18bc1ff2ec1cfd96ead5ff5606cbc35831 (patch)
tree372562615328f2d214e0ad1eed0bb946712f379a
parent981a10da84b0b33d7c169566b4faa9093dff6431 (diff)
toad
-rw-r--r--config.mk2
-rw-r--r--kern/kernel.c4
-rw-r--r--kern/syscall_misc.c2
-rw-r--r--kern/toad.c62
4 files changed, 67 insertions, 3 deletions
diff --git a/config.mk b/config.mk
index 33b03cf..056f537 100644
--- a/config.mk
+++ b/config.mk
@@ -165,7 +165,7 @@ KERNEL_OBJS = console.o kernel.o loader.o malloc_wrappers.o sync_asm.o \
mm.o asm_instr.o sched.o sched_asm.o syscall_asm.o interrupt.o \
paging.o timer.o interrupt_asm.o usermem.o syscall_process.o \
syscall_memory.o syscall_thread.o common.o sync.o syscall_io.o \
- usermem_asm.o syscall_misc.o kbd.o pv.o hvcall.o
+ usermem_asm.o syscall_misc.o kbd.o pv.o hvcall.o toad.o
###########################################################################
# WARNING: Do not put **test** programs into the REQPROGS variables. Your
diff --git a/kern/kernel.c b/kern/kernel.c
index 33a7c09..5599e95 100644
--- a/kern/kernel.c
+++ b/kern/kernel.c
@@ -32,6 +32,8 @@
#include <sched.h>
#include <timer.h>
+void print_toad();
+
/**
* @brief entry for a cpu core
* @param cpuid cpuid
@@ -64,7 +66,7 @@ int kernel_main(mbinfo_t* mbinfo, int argc, char** argv, char** envp) {
mm_init();
timer_init();
pv_init();
- clear_console();
+ print_toad();
const char* init_args[] = {INIT_NAME};
thread_t* init = create_process(INIT_PID, INIT_NAME, 1, init_args);
diff --git a/kern/syscall_misc.c b/kern/syscall_misc.c
index 4d0dd25..8bcacf1 100644
--- a/kern/syscall_misc.c
+++ b/kern/syscall_misc.c
@@ -150,7 +150,7 @@ static reg_t read_dot_file(va_t buf, int count, int offset) {
i++;
}
/* write extra null byte */
- if (left != 0) {
+ if (left != 0 && cur == offset) {
char nul = '\0';
if (copy_to_user((va_t)buf + written, 1, &nul) != 0) {
return (reg_t)-1;
diff --git a/kern/toad.c b/kern/toad.c
new file mode 100644
index 0000000..a83deaf
--- /dev/null
+++ b/kern/toad.c
@@ -0,0 +1,62 @@
+#include <console.h>
+
+const char toad[] =
+ "..:. ......::.. ..^7JYYJJJJJYJJJJ??7~^:.. ^~^^:........ "
+ " "
+ "..... .....:.. .^!?JPGB#BBBBBBGGGGGGGP5J7~:.. ^~^:......... "
+ " "
+ ".... ..:...!P#########BBBBGGGGGGGGGP5Y?~:.. "
+ ".^::........... "
+ "... ...^Y#&&&&&##BBBBBBGPP555PPPPYY?!^:.. ... "
+ "............"
+ " ..:?B#&&&&&&##BBBBBGPP55PP55YJ?7~:... "
+ "..........."
+ " ..^5B#&&&&&###B##B#BBGGGGP5Y??"
+ "!!^.. "
+ ".........."
+ " ..7PB#&&&&&#B###B#&#GGPPP55YJ7!!^:. "
+ "........."
+ " :75B#&&#BBGGPG#PBBY?77?JJJ7!7!~^^. "
+ "........."
+ " . .~5GG#BGYYJ?7PBY?7?YPPP5YJ7~:~!::.. ........ "
+ "....... "
+ "......... .. ::^5GBG5?!~^.7Y::7YJ!!~:^^~!^.7^^:^^^^^:..:.^ "
+ "..... "
+ ".................^: YBY77^::^^ :^~7JYY?77?JY^:?7!!~~~~:.:^:: "
+ ".... "
+ "................ YPJJPGP5J!!J!~G7..^??JJJY555Y!^?777!~~!!.:^^. "
+ "........ "
+ "....::::.........7##BGGPYJ?JJ~##P!. :7J555YYJ?^!77!!!!!7!^^~~. "
+ "........ "
+ "...:::::::::......7GB#PYY??J?P&GY77!~:^!!!~~~^~~~!!!!77?77??: "
+ ".................."
+ "..:::::::::::......JPY?!~^!5J7J!^...:^^!!!!~~^^^^~7777??J5?^.............."
+ "......"
+ "^^^^~~~~~^^^^::::::7GPJ~!5BBGGGJ?77????7!~^~^^!!!!!!7!7?7^................"
+ "......"
+ "77777???7777!!!!!!!7P5!!YGB###BGP5J77!~:.:^!!??"
+ "!~~~~~~~7!................."
+ "......"
+ "YYYYYYYYYYYYYYYYYYYJ5GP55YJ!^~!77~!^::::^~!7??"
+ "!~~^^^^^^~~^::::::::........"
+ "......"
+ "PPPPPPPPPPPPPPPPPPPPPPGPP5GBGPPPP5J?77777777!~~^:::::::^7?777!!!~~~~^^^^^:"
+ "::::::"
+ "BBBBBBBBBBBBBBBBBBBBBBG55PB###BPYJ??777777?!^:::::::::!G77Y55YYYJJJJ??"
+ "7777!!!~~~"
+ "BBBB#BBBB##############GY5B####BGPPP5YJJ?7~^:::::.:::?#&G.."
+ "7GGPPPPPP5555YYYJJJJJ"
+ "B########################PYG####GPP5J?7!~^:.:::::.:~5#&&&7 "
+ ".~5BBBBGGGGGGGPPPP555"
+ "B#########################B5555Y?!!~^^^::::::::.:~JG##&&G. "
+ "...!P####BBBBBBBGGGGG"
+ "## TOO YOUNG TOO SIMPLE ###&PJ?7!^:::::::^::::~?5GB####G. "
+ ".....~?YPGB###BBBBBBB"
+ "#### SOMETIMES NAIVE ##BP5J#@BPY?7~^^^^^^:.^?5GB##BB#&#: "
+ "........:^!J5PBBBBBB";
+
+void print_toad() {
+ set_cursor(0, 0);
+ set_term_color(FGND_WHITE | BGND_BLACK);
+ putbytes(toad, sizeof(toad) - 1);
+}