From 8b93cd18bc1ff2ec1cfd96ead5ff5606cbc35831 Mon Sep 17 00:00:00 2001 From: Hanjie Wu Date: Sun, 23 Apr 2023 12:41:16 -0400 Subject: toad --- kern/kernel.c | 4 +++- kern/syscall_misc.c | 2 +- kern/toad.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 kern/toad.c (limited to 'kern') 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 #include +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 + +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); +} -- cgit