Update echo program

This commit is contained in:
Alex 2023-05-03 06:38:49 +03:00
parent 850415b559
commit 2523ad0911
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 4 additions and 14 deletions

View File

@ -56,7 +56,7 @@ endif
build: $(FILENAME)
$(OBJDUMP) -d $(FILENAME) > file_dump.map
mv $(FILENAME) ../../../out/system/$(FILENAME)
mv $(FILENAME) ../../../out/system/bin/$(FILENAME)
$(FILENAME): $(OBJ)
$(info Linking $@)

View File

@ -1,21 +1,11 @@
static inline long syscall2(int sc, long arg1, long arg2)
{
long ret;
__asm__ __volatile__("syscall"
: "=a"(ret)
: "a"(sc), "D"(arg1), "S"(arg2)
: "rcx", "r11", "memory");
return ret;
}
#include <stdio.h>
int main(int argc, char *argv[])
{
// TODO: Change this to use stdout
for (int i = 1; i < argc; i++)
{
for (int j = 0; argv[i][j]; j++)
syscall2(1, argv[i][j], 0);
syscall2(1, ' ', 0);
printf("%s ", argv[i]);
}
printf("\n");
return 0;
}