Skip to content
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

Trap handler changes to support s390x #2871

Merged
merged 1 commit into from
May 3, 2021

Conversation

uweigand
Copy link
Member

@uweigand uweigand commented May 3, 2021

On s390x, SIGILL and SIGFPE are delivered with the PSW address
pointing after the faulting instruction, while SIGSEGV and
SIGBUS are delivered with the PSW address pointing to the
faulting instruction. In order to support this, the common
code trap handler has to distinguish between those cases.

Also, enable SIGFPE on s390x (just like on x86).

On s390x, SIGILL and SIGFPE are delivered with the PSW address
pointing *after* the faulting instruction, while SIGSEGV and
SIGBUS are delivered with the PSW address pointing *to* the
faulting instruction.  In order to support this, the common
code trap handler has to distinguish between those cases.

Also, enable SIGFPE on s390x (just like on x86).
// signals on the first byte of the instruction (as usual). This
// means we simply need to decrement the reported PSW address by
// one in the case of a "late" signal here to ensure we always
// correctly find the associated trap handler.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an online link to gist here which goes into some more detail? I'm mostly just curious for my own edification!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. Right now, I don't think this is documented anywhere but by reading the Linux kernel sources. This should probably be added to the ABI document. I've added an issue there as a reminder: IBM/s390x-abi#2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sounds reasonable to me!

@alexcrichton alexcrichton merged commit dfb1bc4 into bytecodealliance:main May 3, 2021
mchesser pushed a commit to mchesser/wasmtime that referenced this pull request May 24, 2021
On s390x, SIGILL and SIGFPE are delivered with the PSW address
pointing *after* the faulting instruction, while SIGSEGV and
SIGBUS are delivered with the PSW address pointing *to* the
faulting instruction.  In order to support this, the common
code trap handler has to distinguish between those cases.

Also, enable SIGFPE on s390x (just like on x86).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants