Add support for fflush and close syscalls

This commit is contained in:
2025-04-27 02:48:55 -04:00
parent f07d793e6c
commit adfdaa27f7
5 changed files with 84 additions and 0 deletions

View File

@@ -74,4 +74,32 @@ int32_t openat(int32_t fd, const char* filename, uint32_t flags, uint32_t mode)
return file;
}
int close(unsigned int fd){
int rtn = 0;
asm (
"move $a0, %1\n"
"li $v0, 4006\n"
"syscall\n"
"move %0, $v0\n"
: "=r"(rtn)
: "r" (fd)
: "a0", "v0"
);
return rtn;
}
int fsync(unsigned int fd){
int rtn = 0;
asm (
"move $a0, %1\n"
"li $v0, 4118\n"
"syscall\n"
"move %0, $v0\n"
: "=r"(rtn)
: "r" (fd)
: "a0", "v0"
);
return rtn;
}
#endif