Reputation:
I am just learning mips now and how to use its more complex syscalls.
I found this page for a list of all Mips Syscalls, https://syscalls.w3challs.com/ . I am using a Linux o32 bit emulator (qemu) so that implies this would be my list of syscalls, https://syscalls.w3challs.com/?arch=mips_o32
Right now I want to use mprotect, syscall 4125 however the third argument is
unsigned long prot
and I don't really know what that means or how to format it. I know its a unsigned_long so I'll define it as a .word in my .data but I don't know the formatting of it. I know this parameter is going to define the new memory protection settings for the specific address page mprotect is called on.
I know mprotect is a system call in C which means its already a low level function, so I looked at the arguments of mprotect in C and they are just predefined Macros like, PROT_NONE, PROT_READ etc. Im assuming these macros are just some integer values but I cant find where those integer values are defined and second I dont even know if prot in C is a 1-1 match of prot in mips.
This kinda sort of thing has me stuck on some of the other system calls too like,
syscall 4007: waitpid that has pid_t pid int, int options
,
syscall 4016: lchown that has uid_t user gid_t group
and so much more. I dont know how these parameters are suppose to be defined/structured!
An ideal answer to this would first explain how to define the prot parameter for mprotect as thats my priority and secondly explain how I can find this out for my self in the future.
Upvotes: 0
Views: 86