[Vm-dev] About mantis 3929 (FPU register stack overflow)
John M McIntosh
johnmci at smalltalkconsulting.com
Thu Sep 17 18:25:45 UTC 2009
In looking at this I should point out I made a number of changes to my
version of x86-sysv-asm.S
Oddly I already had the fstpl
But my other changes might be of interest and or for comment.
(a) usage of REG_TO_EXTERN, PICIFY, and NON_LAZY_STUB to make it
compile/link on some variation of gcc in 10.3.x at some point
(b) and $0xFFFFFFF0,%esp /*align to 128-bits*/
This was required to properly align the stack for vector logic and to
make quicktime call FFI calls happy (otherwise at some point a
quicktime FFI call trashes a value on the stack).
(c) cld "Clear Direction"
I at some point added this based on:
Contains system flags, such as the direction flag and the carry flag.
The direction flag must be set to the “forward” direction (that is, 0)
before entry to and upon exit from a routine.
Other user flags have no specified role in the standard calling
sequence and are not preserved.
On 2009-09-09, at 5:32 PM, David T. Lewis wrote:
> On Wed, Sep 09, 2009 at 10:50:07PM +0200, Nicolas Cellier wrote:
>> http://bugs.squeak.org/view.php?id=3929 has been identified as a
>> problem of FPU register stack overflow on linux VM.
>> A single change of line 51 of x86-sysv-asm.S solved this problem:
>> fstpl ffiFloatReturnValue
>> Though I did not write extensive tests, I used modified VM a while
>> without problems.
>> What do you think of inclusion in svn trunk ?
> I recall some extensive discussion of this (some of which is
> on the Mantis page), but no action since then. Barring any objections,
> it sounds like this should be included in the svn trunk.
> Ian, you may have missed the earlier discussions.
> caveat: I have no expertise with FPUs and the subject is not the sort
> of thing that would be improved by a democratic process, so I'll
> from casting my "+1" vote.
John M. McIntosh <johnmci at smalltalkconsulting.com> Twitter:
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
_ffiCallAddressOf: /* 8=addr, 12=stack, 16=stackSize */
movl %esp, %ebp
movl 16(%ebp), %ecx
testl %ecx, %ecx
subl %ecx, %esp
and $0xFFFFFFF0,%esp /*align to 128-bits*/
subl $4, %ecx
movl 12(%ebp), %edx
1: movl (%edx,%ecx,1), %eax
movl %eax, (%esp,%ecx,1)
subl $4, %ecx
2: and $0xFFFFFFF0,%esp /*align to 128-bits*/
REG_TO_EXTERN (%eax, _intReturnValue)
REG_TO_EXTERN (%edx, _intReturnValue2)
movl %ebp, %esp
More information about the Vm-dev