Add read support for mips
This commit is contained in:
16
arch/mips.c
16
arch/mips.c
@@ -28,7 +28,21 @@ intptr_t write(int32_t fd, const void* buf, intptr_t size){
|
||||
);
|
||||
return n_written;
|
||||
}
|
||||
//intptr_t read(int32_t fd, const void* buf, intptr_t size);
|
||||
intptr_t read(int32_t fd, const void* buf, intptr_t size){
|
||||
intptr_t n_read = 0;
|
||||
asm volatile (
|
||||
"move $a0, %1\n"
|
||||
"move $a1, %2\n"
|
||||
"move $a2, %3\n"
|
||||
"li $v0, 4004\n"
|
||||
"syscall\n"
|
||||
"move %0, $v0\n"
|
||||
: "=r"(n_read)
|
||||
: "r"(fd), "r"(buf), "r"(size)
|
||||
: "a0", "a1", "a2", "v0" //TODO: temp registers clobbered by syscall should probably also be listed but this fn returns right away so it should be fine?
|
||||
);
|
||||
return n_read;
|
||||
}
|
||||
|
||||
uint32_t fork(){
|
||||
int rtn;
|
||||
|
||||
Reference in New Issue
Block a user