public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "s_j_newbury at yahoo dot co dot uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/31325] gcj support for ARM EABI
Date: Fri, 03 Aug 2007 12:56:00 -0000	[thread overview]
Message-ID: <20070803125621.25429.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31325-12652@http.gcc.gnu.org/bugzilla/>



------- Comment #18 from s_j_newbury at yahoo dot co dot uk  2007-08-03 12:56 -------
(In reply to comment #17)
> Re comment #16: I've tested this, and it seems to work.  What failures do you
> expect?
> 

/* How to make a trampoline.  */

#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
   unsigned int  __fun = (unsigned int)(FUN); \
   unsigned int  __ctx = (unsigned int)(CTX); \
   *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */  \
   *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \
   *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \
   *(unsigned int*) &__tramp[12] = __ctx; \
   *(unsigned int*) &__tramp[16] = __fun; \
   register unsigned long _beg __asm ("a1") = (unsigned long) (&__tramp[0]);   
\
   register unsigned long _end __asm ("a2") = (unsigned long) (&__tramp[19]);  
\
   register unsigned long _flg __asm ("a3") = 0;                        \
   __asm __volatile ("swi\ 0x9f0002             @ sys_cacheflush"       \
                            : "=r" (_beg)                               \
                            : "0" (_beg), "r" (_end), "r" (_flg));      \
 })

The above swi uses the OABI syscall base.

>From include/asm-arm/unistd.h:
#define __NR_OABI_SYSCALL_BASE  0x900000

#if defined(__thumb__) || defined(__ARM_EABI__)
#define __NR_SYSCALL_BASE       0
#else
#define __NR_SYSCALL_BASE       __NR_OABI_SYSCALL_BASE
#endif

With EABI all syscalls are called as swi 0 with the syscall number passed in a
register rather than encoding it into the instruction (offset from 0x900000).

When the above code from ffi.c is executed on a kernel lacking the OABI syscall
handling it will fail with an illegal instruction trap.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31325


  parent reply	other threads:[~2007-08-03 12:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-23 12:52 [Bug java/31325] New: " s_j_newbury at yahoo dot co dot uk
2007-03-23 12:53 ` [Bug java/31325] " s_j_newbury at yahoo dot co dot uk
2007-03-23 12:55 ` s_j_newbury at yahoo dot co dot uk
2007-03-23 13:03 ` s_j_newbury at yahoo dot co dot uk
2007-03-23 13:08 ` s_j_newbury at yahoo dot co dot uk
2007-03-23 13:11 ` s_j_newbury at yahoo dot co dot uk
2007-03-23 13:14 ` s_j_newbury at yahoo dot co dot uk
2007-03-23 13:22 ` s_j_newbury at yahoo dot co dot uk
2007-03-23 15:21 ` s_j_newbury at yahoo dot co dot uk
2007-03-23 19:32 ` tromey at gcc dot gnu dot org
2007-03-24 17:30 ` s_j_newbury at yahoo dot co dot uk
2007-03-24 19:58 ` s_j_newbury at yahoo dot co dot uk
2007-03-25 14:52 ` s_j_newbury at yahoo dot co dot uk
2007-07-20 15:11 ` [Bug target/31325] " aph at gcc dot gnu dot org
2007-07-20 15:15 ` aph at gcc dot gnu dot org
2007-07-20 17:17 ` s_j_newbury at yahoo dot co dot uk
2007-08-03 11:52 ` s_j_newbury at yahoo dot co dot uk
2007-08-03 12:03 ` aph at gcc dot gnu dot org
2007-08-03 12:56 ` s_j_newbury at yahoo dot co dot uk [this message]
2007-08-03 13:52 ` s_j_newbury at yahoo dot co dot uk
2007-08-03 14:33 ` aph at gcc dot gnu dot org
2007-08-09 17:44 ` aph at gcc dot gnu dot org
2007-09-04 19:15 ` aph at gcc dot gnu dot org

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=20070803125621.25429.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).