More x86_64 mods, but x86_64 still doesn't work.

This commit is contained in:
Clifford T. Matthews 2009-06-08 18:57:09 -06:00
parent f508f8c67c
commit 97d657fa0f
5 changed files with 55 additions and 42 deletions

View File

@ -107,7 +107,7 @@ esac
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS([stddef.h stdlib.h string.h sys/param.h unistd.h]) AC_CHECK_HEADERS([stddef.h stdlib.h string.h sys/param.h unistd.h stdint.h])
# Checks for typedefs, structures, and compiler characteristics. # Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST AC_C_CONST
@ -130,6 +130,20 @@ AC_FUNC_REALLOC
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getpagesize memmove memset strchr strdup strerror strstr]) AC_CHECK_FUNCS([getpagesize memmove memset strchr strdup strerror strstr])
AC_CHECK_SIZEOF([char *])
AC_TYPE_INT8_T
AC_TYPE_UINT8_T
AC_TYPE_INT16_T
AC_TYPE_UINT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT64_T
#if test -n "$configdirs"; then #if test -n "$configdirs"; then
# AC_CONFIG_SUBDIRS($configdirs) # AC_CONFIG_SUBDIRS($configdirs)
#fi #fi

View File

@ -1,8 +1,7 @@
#if !defined (_syn68k_public_h_) #if !defined (_syn68k_public_h_)
#define _syn68k_public_h_ #define _syn68k_public_h_
/* $Id: syn68k_public.h 83 2005-05-12 02:33:41Z ctm $ */ #include <stdint.h>
#include <setjmp.h> #include <setjmp.h>
/* Decide whether we are big or little endian here. Add more machines as /* Decide whether we are big or little endian here. Add more machines as
@ -60,32 +59,19 @@
# define USE_BIOS_TIMER # define USE_BIOS_TIMER
#endif #endif
#if !defined (INT_TYPES_TYPEDEFED)
/* Portability typedefs for signed and unsigned n-bit numbers. */ /* Portability typedefs for signed and unsigned n-bit numbers. */
typedef signed char int8;
typedef unsigned char uint8;
typedef signed short int16;
typedef unsigned short uint16;
#if !defined(__alpha) /* TODO: just use the ones from stdint.h instead of our own */
typedef signed long int32; typedef int8_t int8;
typedef unsigned long uint32; typedef uint8_t uint8;
typedef int16_t int16;
typedef uint16_t uint16;
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
#else /* defined(__alpha) */
typedef signed int int32;
typedef unsigned int uint32;
#endif /* defined(__alpha) */
#if defined (__GNUC__) /* Hack to compile mapindex.c on hokibox. */
typedef signed long long int64;
typedef unsigned long long uint64;
#endif
#endif /* !INT_TYPES_TYPEDEFED */
/* Typedef for address in 68k space. */ /* Typedef for address in 68k space. */
@ -230,23 +216,36 @@ extern uint16 callback_dummy_address_space[];
# define CLEAN(addr) (((ptr_sized_uint)(addr)) & LEGAL_ADDRESS_BITS) # define CLEAN(addr) (((ptr_sized_uint)(addr)) & LEGAL_ADDRESS_BITS)
#endif #endif
#if !defined (__alpha)
/* TODO: see if get rid of need for SIZEOF_CHAR_P, since that's something
that comes from config.h and we shouldn't require users of
syn68k_public.h to require config.h */
#if !defined(SIZEOF_CHAR_P)
#if !defined(__x86_64)
# define SIZEOF_CHAR_P 4
#else
# define SIZEOF_CHAR_P 8
#endif
#endif
#if SIZEOF_CHAR_P == 4
extern uint32 ROMlib_offset; extern uint32 ROMlib_offset;
#else
extern unsigned long ROMlib_offset;
#endif
/* Handy macros to convert back and forth between address spaces. */
#if !defined (__alpha)
#define SYN68K_TO_US(addr) ((uint16 *) ((unsigned long)addr + ROMlib_offset)) /* uint16 * only the default. */ #define SYN68K_TO_US(addr) ((uint16 *) ((unsigned long)addr + ROMlib_offset)) /* uint16 * only the default. */
#else
#define SYN68K_TO_US(addr) ((uint16 *) ((unsigned long)(uint32)addr + ROMlib_offset)) /* uint16 * only the default. */
#endif
#if !defined (__alpha)
#define US_TO_SYN68K(addr) (/*(syn68k_addr_t)*/(int32) (addr) - ROMlib_offset) #define US_TO_SYN68K(addr) (/*(syn68k_addr_t)*/(int32) (addr) - ROMlib_offset)
#else
#elif SIZEOF_CHAR_P == 8
extern uint64 ROMlib_offset;
#define SYN68K_TO_US(addr) ((uint16 *) ((uint64)(uint32)addr + ROMlib_offset)) /* uint16 * only the default. */
#define US_TO_SYN68K(addr) ((uint32) ((long) (addr) - ROMlib_offset)) #define US_TO_SYN68K(addr) ((uint32) ((long) (addr) - ROMlib_offset))
#else
#error "SIZEOF_CHAR_P unknown"
#endif #endif
/* These macros should not be used within Syn68k, but are needed in /* These macros should not be used within Syn68k, but are needed in

View File

@ -18,7 +18,7 @@
#elif defined (powerpc) || defined (__ppc__) #elif defined (powerpc) || defined (__ppc__)
# define GLOBAL_REGISTER_DECLS register const uint16 *code asm ("%r13"); # define GLOBAL_REGISTER_DECLS register const uint16 *code asm ("%r13");
#elif defined(__x86_64) #elif defined(__x86_64)
# define GLOBAL_REGISTER_DECLS register const uint16 *code asm ("%rsi"); # define GLOBAL_REGISTER_DECLS register const uint16 *code asm ("%r12");
#else #else
# error "Choose a global register to hold the current synthetic PC. Make sure it is saved by the normal calling convention." # error "Choose a global register to hold the current synthetic PC. Make sure it is saved by the normal calling convention."
#endif #endif

View File

@ -530,7 +530,7 @@ generate_code (Block *b, TempBlockInfo *tbi, BOOL try_native_p)
+ PTR_WORDS); + PTR_WORDS);
b->malloc_code_offset = PTR_WORDS; b->malloc_code_offset = PTR_WORDS;
WRITE_LONG (&b->compiled_code[-2], b->m68k_start_address); WRITE_LONG (&b->compiled_code[PTR_WORDS], b->m68k_start_address);
#ifdef GENERATE_NATIVE_CODE #ifdef GENERATE_NATIVE_CODE
/* Now that the block's code is at a fixed address, patch up any /* Now that the block's code is at a fixed address, patch up any

View File

@ -10,10 +10,10 @@
#include <unistd.h> #include <unistd.h>
#if !defined (__alpha) #if SIZEOF_CHAR_P == 4
uint32 ROMlib_offset = MEMORY_OFFSET; uint32 ROMlib_offset = MEMORY_OFFSET;
#else #else
unsigned long ROMlib_offset = MEMORY_OFFSET; uint64 ROMlib_offset = MEMORY_OFFSET;
#endif #endif
/* These are set by command-line switches. */ /* These are set by command-line switches. */