support other architectures: arm64, mips

This commit is contained in:
Vitor Santos Costa 2016-05-30 11:18:35 +01:00
parent cd7571da7a
commit ceb26b68a0
3 changed files with 11 additions and 83 deletions

View File

@ -72,6 +72,10 @@ static Int traced_absmi(void) { return Yap_traced_absmi(); }
#endif
#ifndef YREG
#define YREG YENV
#endif
void **Yap_ABSMI_OPCODES;
#ifdef PUSH_X

View File

@ -54,10 +54,6 @@
#undef PUSH_X
#endif
#ifdef mips
#undef PUSH_REGS
#undef PUSH_X
#endif
/* force a cache of WAM regs for multi-threaded architectures! */
#ifdef THREADS
@ -322,80 +318,6 @@ INLINE_ONLY EXTERN inline void restore_TR(void) {
TR = Yap_REGS.TR_;
}
#elif defined(__GNUC__) && defined(mips)
#define P Yap_REGS.P_ /* prolog machine program counter */
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
register CELL *HR asm ("$16");
register CELL *HB asm ("$17");
register choiceptr B asm ("$18");
register yamop *CP asm ("$19");
register CELL *S asm ("$20");
register CELL CreepFlag asm ("$21");
register tr_fr_ptr TR asm ("$22");
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
Yap_REGS.H_ = HR;
Yap_REGS.HB_ = HB;
Yap_REGS.B_ = B;
Yap_REGS.CP_ = CP;
Yap_REGS.CreepFlag_ = CreepFlag;
Yap_REGS.TR_ = TR;
}
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
HR = Yap_REGS.H_;
HB = Yap_REGS.HB_;
B = Yap_REGS.B_;
CP = Yap_REGS.CP_;
CreepFlag = Yap_REGS.CreepFlag_;
TR = Yap_REGS.TR_;
}
#define BACKUP_MACHINE_REGS() \
CELL *BK_H = HR; \
CELL *BK_HB = HB; \
choiceptr BK_B = B; \
CELL BK_CreepFlag = CreepFlag; \
yamop *BK_CP = CP; \
tr_fr_ptr BK_TR = TR; \
restore_machine_regs()
#define RECOVER_MACHINE_REGS() \
save_machine_regs(); \
HR = BK_H; \
HB = BK_HB; \
B = BK_B; \
CreepFlag = BK_CreepFlag; \
CP = BK_CP; \
TR = BK_TR
INLINE_ONLY EXTERN inline void save_H(void) {
Yap_REGS.H_ = HR;
}
INLINE_ONLY EXTERN inline void restore_H(void) {
HR = Yap_REGS.H_;
}
#define BACKUP_H() CELL *BK_H = HR; restore_H()
#define RECOVER_H() save_H(); HR = BK_H
INLINE_ONLY EXTERN inline void save_B(void) {
Yap_REGS.B_ = B;
}
INLINE_ONLY EXTERN inline void restore_B(void) {
B = Yap_REGS.B_;
}
#define BACKUP_B() choiceptr BK_B = B; restore_B()
#define RECOVER_B() save_B(); B = BK_B
#define restore_TR()
#elif defined(__GNUC__) && defined(hppa)
#define P Yap_REGS.P_ /* prolog machine program counter */

12
H/Yap.h
View File

@ -233,12 +233,16 @@ INLINE_ONLY inline EXTERN size_t strnlen(const char *s, size_t maxlen) {
#if !defined(IN_SECOND_QUADRANT)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
defined(mips) || (__DragonFly__)
defined(mips) || defined(__mips64) || defined(__aarch64__) || (__DragonFly__)
#if defined(YAPOR) && defined(__alpha)
#define MMAP_ADDR 0x40000000
#elif defined(mips)
#define MMAP_ADDR 0x02000000
#elif defined(__mips64)
#define MMAP_ADDR 0x02000000
#elif defined(__aarch64__)
#define MMAP_ADDR 0x02000000
#elif defined(__powerpc__)
#define MMAP_ADDR 0x20000000
#else
@ -246,7 +250,7 @@ INLINE_ONLY inline EXTERN size_t strnlen(const char *s, size_t maxlen) {
#endif /* YAPOR && __alpha */
#elif __svr4__ || defined(__SVR4)
#define MMAP_ADDR 0x02000000
#endif /* __linux__ || __FreeBSD__ || __NetBSD__ || mips || __APPLE__ || \
#endif /* __linux__ || __FreeBSD__ || __NetBSD__ || mips || __mips64 || __APPLE__ || \
__DragonFly__ */
#endif /* !IN_SECOND_QUADRANT */
@ -318,9 +322,6 @@ typedef volatile int lockvar;
#elif defined(sparc) || defined(__sparc)
typedef volatile int lockvar;
#include <locks_sparc.h>
#elif defined(mips)
typedef volatile int lockvar;
#include <locks_mips.h>
#elif defined(__alpha)
typedef volatile int lockvar;
#include <locks_alpha.h>
@ -465,6 +466,7 @@ extern int Yap_output_msg;
#endif
#if __ANDROID__
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
#include <android/log.h>