Attention is currently required from: Julius Werner, Paul Menzel.
Subrata Banik has posted comments on this change by Subrata Banik. ( https://review.coreboot.org/c/coreboot/+/83036?usp=email )
Change subject: libpayload/x86: Extend exception handling to x86_64 architecture ......................................................................
Patch Set 11:
(1 comment)
Patchset:
PS8:
Have you actually tried this out with fwgdb?
[Subrata] Yes, i have used FW GDB to verify it works during exception.
I think that would be a good test, use GDB to manually change the values of RAX, RCX, RSP, etc. then step through one more instruction and then compare whether the registers still contain those new values you had it write. I think that would show most of the bugs you still had in here now (e.g. RCX not being restored from the struct correctly).
[Subrata] I saw RCX still holds the old value correctly while existing from exception handler (irtq) although I missed to use `pop old_rcx` over `pop %rcx`. I believe that is due to restoring `%rcx` with old value (`old_rcs`) prior existing from exception.
Before calling into `exception_dispatch` function, the state of critical registers:
``` REG_IP: 0x0000000030023ef9 REG_FLAGS: 0x0000000000000046 REG_SP: 0x0000000034072ed8 REG_CX: 0x0000000003020100 CS: 0x0000000000000020 SS: 0x0000000000000018 ```
Inside `exception_dispatch` function:
``` Debug Exception Error code: n/a REG_IP: 0x0000000030023ef9 REG_FLAGS: 0x0000000000000046 REG_AX: 0x0000000000000009 REG_BX: 0x0000000000000000 REG_CX: 0x0000000003020100 REG_DX: 0x0000000000000001 REG_SP: 0x0000000034072ed8 REG_BP: 0x0000000000000009 REG_SI: 0x0000000000000029 REG_DI: 0x0000000034072eef REG_R8: 0x0000000000000009 REG_R9: 0x0000000000000000 REG_R10: 0x0000000000000000 REG_R11: 0x0000000034072d70 REG_R12: 0x0000000000000004 REG_R13: 0x0000000000000001 REG_R14: 0x0000000034072ee6 REG_R15: 0x0000000000000004 CS: 0x0020 DS: 0x0000 ES: 0x0000 SS: 0x0018 FS: 0x0018 GS: 0x0050 ```
After existing from `exception_dispatch` function, the state of critical registers: ``` REG_IP: 0x0000000030023ed9 REG_FLAGS: 0x0000000000000046 REG_SP: 0x0000000034072ed8 REG_CX: 0x0000000003020100 CS: 0x0000000000000020 SS: 0x0000000000000018 ```
I have ensured that the register values are unified before and after the exception_dispatch function hence, marking this open resolved.