From: Nathan Sidwell <nathan@acm.org>
To: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Debian m68k <debian-68k@lists.debian.org>,
linux-m68k <linux-m68k@lists.linux-m68k.org>,
"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Fwd: Re: Registers used for exception handling on Linux/m68k?
Date: Thu, 1 Oct 2020 08:46:10 -0400 [thread overview]
Message-ID: <23e12ab6-a1fd-16f3-9e09-123a5e770cac@acm.org> (raw)
In-Reply-To: <15fe02f1-6bd4-b4c1-dd73-77a93c23c539@physik.fu-berlin.de>
On 10/1/20 8:32 AM, John Paul Adrian Glaubitz wrote:
> Hi Nathan!
>
> Thanks for the explanations!
>
> On 10/1/20 2:27 PM, Nathan Sidwell wrote:
>> do you know what those 2 functions you mention provide on say x86? Then it might be easier to map onto 68k.
>
> From [1]:
>
> Register X86TargetLowering::getExceptionPointerRegister(
> const Constant *PersonalityFn) const {
> if (classifyEHPersonality(PersonalityFn) == EHPersonality::CoreCLR)
> return Subtarget.isTarget64BitLP64() ? X86::RDX : X86::EDX;
>
> return Subtarget.isTarget64BitLP64() ? X86::RAX : X86::EAX;
> }
>
> Register X86TargetLowering::getExceptionSelectorRegister(
> const Constant *PersonalityFn) const {
> // Funclet personalities don't use selectors (the runtime does the selection).
> assert(!isFuncletEHPersonality(classifyEHPersonality(PersonalityFn)));
> return Subtarget.isTarget64BitLP64() ? X86::RDX : X86::EDX;
> }
Aha! it is EH_RETURN :) and it appears stack adjustment is something
different.
for x86, gcc has:
#define EH_RETURN_DATA_REGNO(N) ((N) <= DX_REG ? (N) : INVALID_REGNUM)
thus N can either be AX_REG or DX_REG. (which is eax/rax and edx/rdx
depending on compilation mode)
for m68k gcc has:
#define EH_RETURN_DATA_REGNO(N) \
((N) < 2 ? (N) : INVALID_REGNUM)
so that's registers d0 and d1
I'm guessing EHPersonality:CoreCLR is a different ABI that you're not
concerned with. Thus I think you want:
getExceptionPointerRegister to return d0 and
getExceptionSelectorRegister to return d1.
give that a go, and see if you can throw/catch exceptions between code
compiled by your llvm port and a gcc
hope that helps.
>
> Adrian
>
>> [1] https://raw.githubusercontent.com/llvm/llvm-project/master/llvm/lib/Target/X86/X86ISelLowering.cpp
>
--
Nathan Sidwell
next prev parent reply other threads:[~2020-10-01 12:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <f9732b0d-9b7d-ba90-7897-1353d6912e24@acm.org>
[not found] ` <c8c4ef5a-e4bc-f9e5-7a76-74f32f084bd6@acm.org>
2020-10-01 9:49 ` Fwd: Re: Registers used for exception handling on Linux/m68k? John Paul Adrian Glaubitz
2020-10-01 12:27 ` Nathan Sidwell
2020-10-01 12:32 ` John Paul Adrian Glaubitz
2020-10-01 12:46 ` Nathan Sidwell [this message]
2020-10-01 12:51 ` John Paul Adrian Glaubitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23e12ab6-a1fd-16f3-9e09-123a5e770cac@acm.org \
--to=nathan@acm.org \
--cc=debian-68k@lists.debian.org \
--cc=gcc@gcc.gnu.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-m68k@lists.linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox