[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squeak-vm-dev
Subject:    [Vm-dev] armV8 Alien update
From:       ken.dickey () whidbey ! com
Date:       2022-08-07 14:26:57
Message-ID: b198a1c3a420cd8a387283d8291411c6 () whidbey ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

 

FFICallbackThunk>>initialize fails for aarch64 with Alien-Core-eem.122
complaining:
   ByteArray(Object)>>doesNotUnderstand: #unsignedLongLongAt:put:

As this method is defined in class Alien, perhaps something like the 
attached? (tested,works)

Cheers,
-KenD

["FFICallbackThunk-initializeARMv8.st" (text/plain)]

'From Squeak5.3 of 28 May 2021 [latest update: #19459] on 7 August 2022 at 7:17:28 \
am'!

!FFICallbackThunk methodsFor: 'private-instance initalization' stamp: 'KenD 8/7/2022 \
07:16'! initializeARMv8
	"Initialize the receiver with a __ccall thunk.  The thunk calls thunkEntry in the \
Alien/IA32ABI plugin,  whose source is in \
platforms/Cross/plugins/IA32ABI/arm64abicc.c.  thunkEntry is the entry point  for \
Callbacks. The objective of the thunk is to call thunkEntry with all arguments to the \
call of the  thunk (registers and stack) as well as a pointer to the thunk itself.  \
thunkEntry is as follows:  
		long long
		thunkEntry(long x0, long x1, long x2, long x3,
				       long x4, long x5, long x6, long x7,
				       double d0, double d1, double d2, double d3,
				       double d4, double d5, double d6, double d7,
				       void *thunkpPlus20, sqIntptr_t *stackp)

	thunkEntry then collects the various arguments (thunk, integer register arguments, \
floating-point  register arguments, stack pointer) in a VMCallbackContext and invokes \
the callback via invokeCallbackContext:."

	| bytes |
	bytes := #["0		mov	x16, sp"			16rF0 16r03 16r00 16r91
				"4		sub	sp, sp, #0x20"			16rFF 16r83 16r00 16rD1
				"8		stp	x16, x30, [sp, #0x8]"	16rF0 16rFB 16r00 16rA9
				"c		bl		0x10"				16r01 16r00 16r00 16r94
				"10		str		x30, [sp]"			16rFE 16r03 16r00 16rF9
				"14		ldr		x16, #0x14"		16rB0 16r00 16r00 16r58
				"18		blr		x16	"				16r00 16r02 16r3F 16rD6
				 "1C	ldr		x30, [sp, #0x16]"	16rFE 16r0B 16r40 16rF9
				 "20	add		sp, sp, #0x20"		16rFF 16r83 16r00 16r91
				 "24	ret"							16rC0 16r03 16r5F 16rD6
													0 0 0 0 0 0 0 0] copy.
"	bytes unsignedLongLongAt: 41 put: self primThunkEntryAddress."
	self replaceFrom: 1 to: 48 with: bytes startingAt: 1.
	self unsignedLongLongAt: 41 put: self primThunkEntryAddress

	"self newCCall"! !



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic