Skip to content

Commit

Permalink
Implement fill_cpu_state for FreeBSD/i386. Issue #501
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed Aug 13, 2022
1 parent ac97fdb commit 8b2b6d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fixed "missing vcode unit" error during elaboration (#502).
- Fixed crash with recursive entity instantiation (#502).
- Fixed error with expressions like `X'ELEMENT'LENGTH` (#508).
- Added support for FreeBSD/i386.

## Version 1.7.0 - 2022-08-07
- *Breaking change:* In-tree builds are no longer supported: use a
Expand Down
12 changes: 12 additions & 0 deletions thirdparty/cpustate.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ void fill_cpu_state(struct cpu_state *cpu, ucontext_t *uc)
cpu->regs[13] = uc->uc_mcontext.mc_r13;
cpu->regs[14] = uc->uc_mcontext.mc_r14;
cpu->regs[15] = uc->uc_mcontext.mc_r15;
#elif defined __FreeBSD__ && defined __i386__
cpu->pc = uc->uc_mcontext.mc_eip;
cpu->sp = uc->uc_mcontext.mc_esp;

cpu->regs[0] = uc->uc_mcontext.mc_eax;
cpu->regs[1] = uc->uc_mcontext.mc_ecx;
cpu->regs[2] = uc->uc_mcontext.mc_edx;
cpu->regs[3] = uc->uc_mcontext.mc_ebx;
cpu->regs[4] = uc->uc_mcontext.mc_esp;
cpu->regs[5] = uc->uc_mcontext.mc_ebp;
cpu->regs[6] = uc->uc_mcontext.mc_esi;
cpu->regs[7] = uc->uc_mcontext.mc_edi;
#elif defined __FreeBSD__ && defined __aarch64__
cpu->pc = uc->uc_mcontext.mc_gpregs.gp_elr;
cpu->sp = uc->uc_mcontext.mc_gpregs.gp_sp;
Expand Down

0 comments on commit 8b2b6d9

Please sign in to comment.