diff --git a/apps/system/init/Makefile b/apps/system/init/Makefile index b295a15..e06c896 100644 --- a/apps/system/init/Makefile +++ b/apps/system/init/Makefile @@ -54,7 +54,7 @@ build: $(FILENAME) $(FILENAME): $(OBJ) $(info Linking $@) - $(CC) $(LDFLAGS) $(SYSROOT) $(OBJ) -lssp -linit -lsys -lgraph -o $@ + $(CC) $(LDFLAGS) $(SYSROOT) $(OBJ) -lssp -linit -o $@ %.o: %.c $(HEADERS) $(info Compiling $<) diff --git a/apps/system/init/init.c b/apps/system/init/init.c index 99bdbed..7f80c0b 100644 --- a/apps/system/init/init.c +++ b/apps/system/init/init.c @@ -1,21 +1,11 @@ #include +#include #include -#include -#include #include - -void PutCharToKernelConsole(char c) -{ - __asm__ __volatile__("syscall" - : - : "a"(1), "D"(c), "S"(0) - : "rcx", "r11", "memory"); -} - #define print(m, ...) init_log(m, ##__VA_ARGS__) -int main(int argc, char *argv[], char *envp[]) +void test_args(int argc, char *argv[], char *envp[]) { print("%p %p %p\n", (void *)(uint64_t)&argc, (void *)&argv, (void *)&envp); print("I have %d arguments\n", argc); @@ -38,8 +28,12 @@ int main(int argc, char *argv[], char *envp[]) for (auxv = (Elf64_auxv_t *)e; auxv->a_type != AT_NULL; auxv++) print("auxv: %ld %#lx\n", auxv->a_type, auxv->a_un.a_val); +} - File *test = FileOpen("/Test.txt", FILE_READ); +int main(int argc, char *argv[], char *envp[]) +{ + // test_args(argc, argv, envp); + FILE *test = fopen("/Test.txt", "r"); if (test == NULL) { print("Failed to open file\n"); @@ -47,9 +41,9 @@ int main(int argc, char *argv[], char *envp[]) } char buf[1024]; - uint64_t read = FileRead(test, 0, (uint8_t *)buf, 1024); + int read = fread(buf, 1024, 1, test); print("Read %ld bytes from file\n", read); print("File contents: %s\n", buf); - FileClose(test); + fclose(test); return 0; }