Skip to content

Commit

Permalink
Fix building on x86
Browse files Browse the repository at this point in the history
  • Loading branch information
Reavershark committed Jan 4, 2025
1 parent 04c8401 commit ce893be
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions druntime/src/etc/linux/memoryerror.d
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ else version (X86)
auto context = cast(ucontext.ucontext_t*)contextPtr;

// Save registers into global thread local, to allow recovery.
savedEAX = context.uc_mcontext.gregs[REG_EAX];
savedEDX = context.uc_mcontext.gregs[REG_EDX];
savedEAX = context.uc_mcontext.gregs[ucontext.REG_EAX];
savedEDX = context.uc_mcontext.gregs[ucontext.REG_EDX];

// Hijack current context so we call our handler.
auto eip = context.uc_mcontext.gregs[REG_EIP];
auto eip = context.uc_mcontext.gregs[ucontext.REG_EIP];
auto addr = cast(RegType) info.si_addr;
context.uc_mcontext.gregs[REG_EAX] = addr;
context.uc_mcontext.gregs[REG_EDX] = eip;
context.uc_mcontext.gregs[REG_EIP] = cast(RegType) ((eip != addr)?&sigsegvDataHandler:&sigsegvCodeHandler);
context.uc_mcontext.gregs[ucontext.REG_EAX] = addr;
context.uc_mcontext.gregs[ucontext.REG_EDX] = eip;
context.uc_mcontext.gregs[ucontext.REG_EIP] = cast(RegType) ((eip != addr)?&sigsegvDataHandler:&sigsegvCodeHandler);
}

// All handler functions must be called with faulting address in EAX and original EIP in EDX.
Expand Down

0 comments on commit ce893be

Please sign in to comment.