Skip to content

Commit a120bbe

Browse files
committed
Changes for ARMv8 on aarch64-linux-gnu.
Get the platform defines right: if __linux__ && (defined(__arm64__) || defined(__aarch64__)) Include cogitARMv8.c in the files to be included by cogit.c (only for one configuration for now; there are serious self-modifying code permission problems to be solved before an ARMv8 JIT can be realized). Configure the build.linux64ARMv8/squeak.cog.spur builds correctly; we should *NOT* manually define platform defines; these are to be left up to the native compiler. (I'll fix the stack builds soon).
1 parent 6a7f917 commit a120bbe

File tree

6 files changed

+35
-19
lines changed

6 files changed

+35
-19
lines changed

build.linux64ARMv8/squeak.cog.spur/build.assert/mvm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
set -e
33
# assert Cog Spur VM with VM profiler and threaded heartbeat
44
INSTALLDIR=assert/sqspur64ARMv8linuxhtAssert
5+
MACHINE="-march=armv8.5-a -mtune=cortex-a72"
56
OPT="-g3 -O1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -DDEBUGVM=0"
67

78
if [ $# -ge 1 ]; then
@@ -17,11 +18,10 @@ esac
1718
test -f plugins.int || (test -f ../plugins.int && cp -p ../plugins.int . || cp -p ../../plugins.int .)
1819
test -f plugins.ext || (test -f ../plugins.ext && cp -p ../plugins.ext . || cp -p ../../plugins.ext .)
1920
test -f config.h || ../../../platforms/unix/config/configure \
20-
--with-vmversion=5.0 \
21-
--with-src=spur64src \
21+
--with-vmversion=5.0 --with-src=spur64src \
2222
--without-vm-display-fbdev --without-npsqueak \
23-
TARGET_ARCH="-march=armv8-a" \
24-
CFLAGS="$OPT -D__ARM_ARCH_ISA_A64 -DARM64 -D__arm__ -D__arm64__ -D__aarch64__"
23+
CFLAGS="$MACHINE $OPT -DCOGMTVM=0"
24+
2525
rm -f vm/sqUnixMain.o # nuke version info
2626
rm -rf ../../../products/$INSTALLDIR
2727
# prefer make install prefix=`readlink -f \`pwd\`/../../../products/$INSTALLDIR`

build.linux64ARMv8/squeak.cog.spur/build.debug/mvm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
set -e
33
# debug Cog Spur VM with VM profiler and threaded heartbeat
44
INSTALLDIR=sqspur64ARMv8linuxhtDebug
5+
MACHINE="-march=armv8.5-a -mtune=cortex-a72"
56
OPT="-g3 -O0 -DDEBUGVM=1"
67

78
if [ $# -ge 1 ]; then
@@ -17,11 +18,10 @@ esac
1718
test -f plugins.int || (test -f ../plugins.int && cp -p ../plugins.int . || cp -p ../../plugins.int .)
1819
test -f plugins.ext || (test -f ../plugins.ext && cp -p ../plugins.ext . || cp -p ../../plugins.ext .)
1920
test -f config.h || ../../../platforms/unix/config/configure \
20-
--with-vmversion=5.0 \
21-
--with-src=spur64src \
21+
--with-vmversion=5.0 --with-src=spur64src \
2222
--without-vm-display-fbdev --without-npsqueak \
23-
TARGET_ARCH="-march=armv8-a" \
24-
CFLAGS="$OPT -D__ARM_ARCH_ISA_A64 -DARM64 -D__arm__ -D__arm64__ -D__aarch64__"
23+
CFLAGS="$MACHINE $OPT -DCOGMTVM=0"
24+
2525
rm -f vm/sqUnixMain.o # nuke version info
2626
rm -rf ../../../products/$INSTALLDIR
2727
# prefer make install prefix=`readlink -f \`pwd\`/../../../products/$INSTALLDIR`

build.linux64ARMv8/squeak.cog.spur/build/mvm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
set -e
33
# Cog Spur VM with VM profiler and threaded heartbeat
44
INSTALLDIR=sqspur64ARMv8linuxht
5-
OPT="-g -O2 -DNDEBUG -DDEBUGVM=0"
5+
MACHINE="-march=armv8.5-a -mtune=cortex-a72"
6+
OPT="-g -O3 -DNDEBUG -DDEBUGVM=0"
67

78
if [ $# -ge 1 ]; then
89
INSTALLDIR="$1"; shift
@@ -17,11 +18,10 @@ esac
1718
test -f plugins.int || (test -f ../plugins.int && cp -p ../plugins.int . || cp -p ../../plugins.int .)
1819
test -f plugins.ext || (test -f ../plugins.ext && cp -p ../plugins.ext . || cp -p ../../plugins.ext .)
1920
test -f config.h || ../../../platforms/unix/config/configure \
20-
--with-vmversion=5.0 \
21-
--with-src=spur64src \
21+
--with-vmversion=5.0 --with-src=spur64src \
2222
--without-vm-display-fbdev --without-npsqueak \
23-
TARGET_ARCH="-march=armv8-a" \
24-
CFLAGS="$OPT -D__ARM_ARCH_ISA_A64 -DARM64 -D__arm__ -D__arm64__ -D__aarch64__"
23+
CFLAGS="$MACHINE $OPT -DCOGMTVM=0"
24+
2525
rm -f vm/sqUnixMain.o # nuke version info
2626
rm -rf ../../../products/$INSTALLDIR
2727
# prefer make install prefix=`readlink -f \`pwd\`/../../../products/$INSTALLDIR`

platforms/unix/vm/sqUnixMain.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,9 +1021,25 @@ printRegisterState(ucontext_t *uap)
10211021
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15],
10221022
regs[REG_RIP]);
10231023
return (void *)regs[REG_RIP];
1024-
# elif __linux__ && (defined(__arm64__))
1025-
printf("@@FIXME@@: derive register state from a ucontext_t on aarch64 \n");
1026-
return 0;
1024+
# elif __linux__ && (defined(__arm64__) || defined(__aarch64__))
1025+
unsigned long *regs = (unsigned long *)&uap->uc_mcontext.regs[0];
1026+
printf( "\tx0 %p x1 %p x2 %p x3 %p\n"
1027+
"\tx4 %p x5 %p x6 %p x7 %p\n"
1028+
"\tx8 %p x9 %p x10 %p x11 %p\n"
1029+
"\tx12 %p x13 %p x14 %p x15 %p\n"
1030+
"\tx16 %p x17 %p x18 %p x19 %p\n"
1031+
"\tx20 %p x21 %p x22 %p x23 %p\n"
1032+
"\tx24 %p x25 %p x26 %p x27 %p\n"
1033+
"\tx29 %p fp %p lr %p sp %p\n",
1034+
regs[0], regs[1], regs[2], regs[3],
1035+
regs[4], regs[5], regs[6], regs[7],
1036+
regs[8], regs[9], regs[10], regs[11],
1037+
regs[12], regs[13], regs[14], regs[15],
1038+
regs[16], regs[17], regs[18], regs[19],
1039+
regs[20], regs[21], regs[22], regs[23],
1040+
regs[24], regs[25], regs[26], regs[27],
1041+
regs[28], regs[29], regs[30], uap->uc_mcontext.sp);
1042+
return uap->uc_mcontext.pc;
10271043
# elif __linux__ && (defined(__arm__) || defined(__arm32__) || defined(ARM32))
10281044
struct sigcontext *regs = &uap->uc_mcontext;
10291045
printf( "\t r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n"

platforms/unix/vm/sqUnixSpurMemory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ sqAllocateMemorySegmentOfSizeAboveAllocatedSizeInto(sqInt size, void *minAddress
129129
delta = max(pageSize,1024*1024);
130130

131131
while ((unsigned long)(address + bytes) > (unsigned long)address) {
132-
alloc = mmap(address, bytes, PROT_READ | PROT_WRITE,
132+
alloc = mmap(address, bytes, PROT_READ | PROT_WRITE | PROT_EXEC,
133133
MAP_ANON | MAP_PRIVATE, -1, 0);
134134
if (alloc == MAP_FAILED) {
135135
mmapErrno = errno;

spur64src/vm/cogit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* Automatically generated by
2-
Cogit VMMaker.oscog-eem.2596 uuid: 8500baf3-a5ae-4594-9f3b-08cedfdf1fb3
2+
Cogit VMMaker.oscog-eem.2676 uuid: c506939b-d6f7-44a3-9ea3-97131756aa64
33
*/
44

55
#if !SysV && !_WIN64
66
# define SysV 1
77
#endif
88

9-
#if defined(__ARM_ARCH_8__) || defined(__arm__) || defined(__arm64__) || defined(ARM64)
9+
#if defined(__arm64__) || defined(__aarch64__) || defined(__ARM_ARCH_ISA_A64) || defined(ARM64) || defined(ARMv8)
1010

1111
# include "cogitARMv8.c"
1212

0 commit comments

Comments
 (0)