diff options
-rw-r--r-- | src/init/main.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/init/main.c b/src/init/main.c index 2029bc9..401e4a0 100644 --- a/src/init/main.c +++ b/src/init/main.c @@ -5,7 +5,6 @@ #include <stdint.h> #define argify(str) str, sizeof(str) - 1 -#define log(str) _syscall_write(tty_fd, argify(str), 0) extern char _bss_start; // provided by the linker extern char _bss_end; @@ -29,8 +28,6 @@ int main(void) { fs_test(); test_await(); - printf("%s %x\n", "printf test", 0xACAB1312); - char c; while (_syscall_read(tty_fd, &c, 1, 0)) _syscall_write(tty_fd, &c, 1, 0); @@ -44,9 +41,9 @@ void read_file(const char *path, size_t len) { int buf_len = 64; _syscall_write(tty_fd, path, len, 0); - log(": "); + printf(": "); if (fd < 0) { - log("couldn't open.\n"); + printf("couldn't open.\n"); return; } @@ -67,7 +64,7 @@ void fs_test(void) { } // parent: accesses the fs - log("\n\n"); + printf("\n\n"); // the trailing slash should be ignored by mount() _syscall_mount(front, argify("/init/")); read_file(argify("/init/fake.txt")); @@ -75,14 +72,14 @@ void fs_test(void) { read_file(argify("/init/2.txt")); read_file(argify("/init/dir/3.txt")); - log("\nshadowing /init/dir...\n"); + printf("\nshadowing /init/dir...\n"); _syscall_mount(-1, argify("/init/dir")); read_file(argify("/init/fake.txt")); read_file(argify("/init/1.txt")); read_file(argify("/init/2.txt")); read_file(argify("/init/dir/3.txt")); - log("\n"); + printf("\n"); } void test_await(void) { @@ -95,19 +92,16 @@ void test_await(void) { // faults if (!_syscall_fork()) { // invalid memory access asm volatile("movb $69, 0" ::: "memory"); - log("this shouldn't happen"); + printf("this shouldn't happen"); _syscall_exit(-1); } if (!_syscall_fork()) { // #GP asm volatile("hlt" ::: "memory"); - log("this shouldn't happen"); + printf("this shouldn't happen"); _syscall_exit(-1); } - while ((ret = _syscall_await()) != ~0) { - log("await returned: "); - //_syscall_write(tty_fd, buf, len, 0); TODO printf - log("\n"); - } - log("await: no more children\n"); + while ((ret = _syscall_await()) != ~0) + printf("await returned: %x\n", ret); + printf("await: no more children\n"); } |