Skip to content

Commit

Permalink
support other architectures: arm64, mips
Browse files Browse the repository at this point in the history
  • Loading branch information
vscosta committed May 30, 2016
1 parent cd7571d commit ceb26b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 83 deletions.
4 changes: 4 additions & 0 deletions C/absmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
78 changes: 0 additions & 78 deletions H/Regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down
12 changes: 7 additions & 5 deletions H/Yap.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,24 @@ 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
#define MMAP_ADDR 0x10000000
#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 */

Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit ceb26b6

Please sign in to comment.