/************************************************************************
 *
 * This file contains the platform-dependent definitions for the Mac OS X
 * PowerMacintosh platform.
 *
 *	Copyright (C) 2000-2008 Cincom Systems, Inc.
 *
 ************************************************************************/

#define LEFT_BIT_FIELD_ORDER 1 /* Compiler ordering of bit fields in structs */

#define PLATFORM_SUPPORTS_64_BITS 1
#define HAS_64_BIT_ARITHMETIC 1
#ifndef assembly
typedef long long longlong;
typedef unsigned long long ulonglong;
#endif

#define HaveCleanSignals TRUE	/* FALSE for polling */
#define CanSmashRegisters FALSE
#define HaveLimitRegister TRUE

#define bytesInNMethodZone (1152 * 1024)
#define bytesInFreeZone (0 * 1024)   /* Mac's pdMoreMemory does this and more */

/* Ideally this would be defined in the processor include file, but differences
 * in platform assembler syntax makes this a better place.
 */
#define GlueProc "glueMacX.h"
#define indirectFunctionPointers 0
/* This is potentially OS-specific and so does belong here.
 */
#define platcallc_h "ibmCallC.h"

#define PLAT_OSNAME "unix bsd apple Power MacOSX"
#define StructLayoutAlgorithm "twoFourLayout"

#define pdFPUType() 1
#define sc_pc sc_ir
#define SC_PC uc_mcontext->ss.srr0

/* #define DOUBLES_ALIGNED NO - RALF 010927 */
#define MAXWAITMILLISECONDS 500

/* To interoperate with Linux Threads the stack zone needs to be allocated
 * on the stack.
 */
#define ALLOCATE_STACKZONE_ON_C_STACK TRUE

/* The System V ABI requires 16-byte alignment.
 */
#define C_STACK_POINTER_BYTE_ALIGNMENT 16
#if defined(__GNUC__)
# define getsp() ({ register void *sp;						\
	asm volatile ("ori  %0,r1,0" : "=r"(sp) : : "memory");	\
	sp; })
#elif !defined(assembly)
extern void *getsp(void);
#endif

#ifndef assembly
/*
 * override the arithmetic macros because the C preprocessor does not
 * follow the same rule as the compiled code.
 */
#define arithRShift(value, shiftWidth) \
		(((oopInt) (value)) >> shiftWidth)
#define divTrunc(dividend, divisor) \
	  (((oopInt)(dividend)) / ((oopInt)(divisor)))

#define rem(dividend, divisor, scratch ) \
		((oopInt)(dividend) % (oopInt)(divisor))

#define divFloor(dividend, divisor) \
	  (((dividend ^ divisor) & signBitMask) ? \
	    ((dividend & signBitMask) ? \
	      (((oopInt)(dividend)-((oopInt)(divisor)-1))/(oopInt)(divisor)): \
	      (((oopInt)(dividend)-((oopInt)(divisor)+1))/(oopInt)(divisor))):\
	    (oopInt)(dividend) / (oopInt)(divisor))

#define mod(dividend, divisor, scratch) \
		(((dividend ^ divisor) & signBitMask) ? \
			((scratch = (oopInt)(dividend)%(oopInt)(divisor)) != 0 ? \
				scratch + (oopInt)(divisor) : \
				0) : \
			(oopInt)(dividend) % (oopInt)(divisor))

#endif
