-
Notifications
You must be signed in to change notification settings - Fork 43
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
Investigate MSR instruction #32
Comments
I think in case of updating SP/CONTROL, it may take more than one instruction for the update to be reflected. I could be wrong - but what's the instruction that comes right after msr? Is it one of the synchronization instructions (ISB/DSB/DMB)? |
0x1000239e <svcRtxKernelStart+74>: 01 f0 11 fa bl 0x100037c4 0x10001d78 <SVC_Handler+72>: f0 c8 ldmia r0!, {r4, r5, r6, r7} |
Then the next question is: does SP eventually update to the new value? i.e. after this instruction:
in the silicone sp is still I think it will also help if we print the values of MSP/PSP (GDB registers 17/18), to see if they are updated after this instruction |
Not able to reproduce it anymore, may be the various instruction fixes solve even this issue |
Thank you for testing this! |
Shifting by #32 did not update the carry flag. It should have set the carry flag to the leftmost bit of the input register. E.g. `asrs r0, r0, #32` produces an incorrect result when `r0` is set to `0xffffffff` and the carry flag is initially clear. wokwi/wokwi-features#593
based on gdbdiff I found a wrong sp value after this instruction:
0x100023b0 <svcRtxKernelStart+92>: 83 f3 14 88 msr CONTROL, r3
Mismatch after 73528 compared instructions
Register StartValue Emulator Silicone
r0 0x20004d84 0x20004d84 0x20004d84
r1 0x00000000 0x00000000 0x00000000
r2 0x20004e0c 0x20004e0c 0x20004e0c
r3 0x00000002 0x00000002 0x00000002
r4 0x00000000 0x00000000 0x00000000
r5 0x20002a3c 0x20002a3c 0x20002a3c
r6 0x18000000 0x18000000 0x18000000
r7 0x10002355 0x10002355 0x10002355
r8 0xffffffff 0xffffffff 0xffffffff
r9 0xffffffff 0xffffffff 0xffffffff
r10 0x20030000 0x20030000 0x20030000
r11 0x00000000 0x00000000 0x00000000
r12 0x200001e9 0x200001e9 0x200001e9
sp* 0x2003ffa0 0xfffffffc 0x2003ffa0
lr 0x100038ff 0x100038ff 0x100038ff
pc 0x100023b0 0x100023b4 0x100023b4
xPSR 0x2100000b 0x2100000b 0x2100000b
another:
0x10001d82 <SVC_Handler+82>: 80 f3 09 88 msr PSP, r0
Mismatch after 73552 compared instructions
Register StartValue Emulator Silicone
r0 0x20003958 0x20003958 0x20003958
r1 0x00000000 0x00000000 0x00000000
r2 0x20004d84 0x20004d84 0x20004d84
r3 0x20002a50 0x20002a50 0x20002a50
r4 0x00000000 0x00000000 0x00000000
r5 0x00000000 0x00000000 0x00000000
r6 0x00000000 0x00000000 0x00000000
r7 0x00000000 0x00000000 0x00000000
r8 0x00000000 0x00000000 0x00000000
r9 0x00000000 0x00000000 0x00000000
r10 0x00000000 0x00000000 0x00000000
r11 0x00000000 0x00000000 0x00000000
r12 0x200001e9 0x200001e9 0x200001e9
sp* 0x2003ffb8 0x20003958 0x2003ffb8
lr 0xfffffff9 0xfffffff9 0xfffffff9
pc 0x10001d82 0x10001d86 0x10001d86
xPSR 0x0100000b 0x0100000b 0x0100000b
to recreate use test-printf.ino.elf/hex files You shared then "break _start" and run gdbdiff
The text was updated successfully, but these errors were encountered: