You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement mmap2 for shecc, but I found that there are no enough registers for calling the syscall based on test_mmap.s. So, I modified OP_syscall in src/riscv-codegen.c as following,
You need to modify the instruction count of that function after appending the new ones for it. Otherwise, the calculated offset of branch / jump instructions will be incorrect.
I am trying to implement
mmap2
for shecc, but I found that there are no enough registers for calling the syscall based on test_mmap.s. So, I modifiedOP_syscall
insrc/riscv-codegen.c
as following,On the other hand, to test the syscall, I modified the malloc help function as following:
block_meta_t *__malloc_request_space(int size) { char *brk; block_meta_t *block; + void *tmp = __syscall(__syscall_mmap2, 0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); brk = __syscall(__syscall_brk, 0);
After the mentioned modification, the segmentation fault is occurred when using qemu to execute the code.
Then, I dump the disassembly code to check. The caller and callee are shown below:
It looks like a correct implementation and is similar to the test_mmap.s, but it is failed. I have no idea how to solve it.
The text was updated successfully, but these errors were encountered: