/*
 * i386/qnx/jit-md.h
 * Qnx i386 JIT configuration information.
 *
 * Copyright (c) 1996 T. J. Wilkinson & Associates, London, UK.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * Written by Jeppe Sommer <jso@lyngso-industri.dk>, 1997.
 */

#ifndef __i386_qnx_jit_md_h
#define __i386_qnx_jit_md_h

/**/
/* Include common information. */
/**/
#include "i386/jit.h"

#undef CALL_KAFFE_FUNCTION_VARARGS
#define       CALL_KAFFE_FUNCTION_VARARGS(meth, obj, nargs, argptr, retval)   \
      asm volatile ("                                                 \n\
              movl %3,%%eax                                           \n\
1:            cmpl $0,%%eax                                           \n\
              je 2f                                                   \n\
              decl %%eax                                              \n\
              pushl (%4,%%eax,4)                                      \n\
              jmp 1b                                                  \n\
2:                                                                    \n\
              pushl %2                                                \n\
              call *%1                                                \n\
              movl %%eax,%0                                           \n\
              " : "=r" (retval) :                                     \
          "r" (meth->ncode), "r" (obj), "r" (nargs), "r" (argptr[0])  \
          : "eax", "cc" );                                            \
      asm volatile ("                                                 \n\
              addl %0,%%esp" : : "r" (4*(nargs+1)) : "cc")


/**/
/* Extra exception handling information. */
/**/

/* Function prototype for signal handlers */
#define       EXCEPTIONPROTO                                                  \
      int sig

/* Get the first exception frame from a signal handler */
#define       EXCEPTIONFRAME(f, c)                                            \
      (f).retbp = 0;                                          \
      (f).retpc = 0
#endif

