-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QEMU Segmentation Fault #49
Comments
I compiled the code and it works fine. It appears that you have a problem with allocating memory for your arguments during the function calls. More info here |
I think you need to specify your parameter type for g in the first example. |
Hi, that was actually a mistake on my end when I was writing the post. We have narrowed down the issue to incorrect allocation of memory as Jaafar has suggested above. Is there a rule that prevents QEMU to access memory below $sp such as |
You might be accessing the frame of another function. Since you used MARS, I would suggest re-checking where you are writing in the memory. I am pretty sure it will work because MARS doesn't have the concept of frames. Try to follow the stack pointer and I can guarantee you are writing in the frame of the previous function. There is an option to debug in MARS and keep track of where the stack pointer is writing in memory |
Oh I see! So when we are in one frame, it is illegal to write to the memory for another frame? If so, does that only apply to writing or is reading also illegal? Thanks for your help btw! |
Reading non-public space is illegal as well to my knowledge |
Figured it out - it was because of these flags we included in our code to address these warnings: |
Hi, when we compile nested function calls with arguments, such as the following,
we get uncaught target signal 11 (segmentation fault) - core dumped when we run it in QEMU. However, the same code can be run without issues in MARS. Additionally, the code without the argument like below compiled to run fine.
For the record, we have tried to both use the argument registers $a0-$a3, as well as direct storage in memory for the arguments.
We were wondering if there were any similar known issues, as we are very confused about why the compiled MIPS code could output the correct value in MARS but not QEMU. Thanks in advance!
The text was updated successfully, but these errors were encountered: