public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Camm Maguire <camm@enhanced.com>
To: linux-kernel@vger.kernel.org
Subject: Fault Address from sigcontext for the various archs
Date: 05 Mar 2001 13:41:14 -0500	[thread overview]
Message-ID: <54snksdpo5.fsf@intech19.enhanced.com> (raw)
In-Reply-To: "Cappellini, Tony"'s message of "Wed, 28 Feb 2001 14:08:52 -0700"


Greetings!  I'm trying to assist in porting gcl to the various Linux
archs, and the code as is needs the fault address from struct
sigcontext.  i386 and m68k work, with solutions shown below.  What
about the other archs?  Where can I find the fault address around this
struct?

Thanks!

=============================================================================
i386
=============================================================================
#define GET_FAULT_ADDR(sig,code,sv,a) \
    ((void *)(((struct sigcontext_struct *)(&code))->cr2))     
=============================================================================
m68k
=============================================================================
#define GET_FAULT_ADDR(sig,code,sv,a) \
    ({	\
		struct sigcontext *scp = (struct sigcontext *)(sv);\
		int format = (scp->sc_formatvec >> 12) & 0xf;\
		unsigned long *framedata = (unsigned long *)(scp + 1);\
		unsigned long ea;\
		if (format == 0xa || format == 0xb)\
			/* 68020/030 */\
			ea = framedata[2];\
		else if (format == 7)\
			/* 68040 */\
			ea = framedata[3];\
		else if (format == 4) {\
			/* 68060 */\
			ea = framedata[0];\
			if (framedata[1] & 0x08000000)\
				/* correct addr on misaligned access */\
				ea = (ea+4095)&(~4095);\
		}\
		ea;\
	})
=============================================================================

-- 
Camm Maguire			     			camm@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

                 reply	other threads:[~2001-03-05 18:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=54snksdpo5.fsf@intech19.enhanced.com \
    --to=camm@enhanced.com \
    --cc=linux-kernel@vger.kernel.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