vmJumpAndInvoke bugfixes

This commit is contained in:
Joel Dice 2009-05-24 11:18:17 -06:00
parent 9dbea21ec4
commit e80401ed10

View File

@ -155,12 +155,10 @@ vmJumpAndInvoke:
// %r9 : arguments // %r9 : arguments
movq %rdi,%rbx movq %rdi,%rbx
movq %rdx,%rbp
movq %rcx,%rsp
// set return address // set return address
movq vmInvoke_returnAddress@GOTPCREL(%rip),%r10 movq vmInvoke_returnAddress@GOTPCREL(%rip),%r10
movq %r10,(%rsp) movq %r10,(%rcx)
// copy arguments into place // copy arguments into place
movq $0,%r11 movq $0,%r11
@ -168,13 +166,16 @@ vmJumpAndInvoke:
LOCAL(vmJumpAndInvoke_argumentLoop): LOCAL(vmJumpAndInvoke_argumentLoop):
movq (%r9,%r11,1),%r10 movq (%r9,%r11,1),%r10
movq %r10,8(%rsp,%r11,1) movq %r10,8(%rcx,%r11,1)
addq $8,%r11 addq $8,%r11
LOCAL(vmJumpAndInvoke_argumentTest): LOCAL(vmJumpAndInvoke_argumentTest):
cmpq %r8,%r11 cmpq %r8,%r11
jb LOCAL(vmJumpAndInvoke_argumentLoop) jb LOCAL(vmJumpAndInvoke_argumentLoop)
movq %rdx,%rbp
movq %rcx,%rsp
jmp *%rsi jmp *%rsi
#elif defined __i386__ #elif defined __i386__
@ -342,39 +343,40 @@ LOCAL(getPC):
.globl vmJumpAndInvoke .globl vmJumpAndInvoke
vmJumpAndInvoke: vmJumpAndInvoke:
// 8(%ebp): thread // 4(%esp): thread
// 12(%ebp): address // 8(%esp): address
// 16(%ebp): base // 12(%esp): base
// 20(%ebp): stack // 16(%esp): stack
// 24(%ebp): argumentFootprint // 20(%esp): argumentFootprint
// 28(%ebp): arguments // 24(%esp): arguments
movl 8(%ebp),%ebx movl 16(%esp),%ecx
movl 20(%ebp),%esp
// set return address // set return address
call LOCAL(getPC) call LOCAL(getPC)
addl $_GLOBAL_OFFSET_TABLE_,%esi addl $_GLOBAL_OFFSET_TABLE_,%esi
movl vmInvoke_returnAddress@GOT(%esi),%esi movl vmInvoke_returnAddress@GOT(%esi),%esi
movl %esi,(%esp) movl %esi,(%ecx)
// copy arguments into place // copy arguments into place
movl $0,%ecx movl $0,%esi
movl 24(%ebp),%esi movl 20(%esp),%edx
movl 28(%ebp),%eax movl 24(%esp),%eax
jmp LOCAL(vmJumpAndInvoke_argumentTest) jmp LOCAL(vmJumpAndInvoke_argumentTest)
LOCAL(vmJumpAndInvoke_argumentLoop): LOCAL(vmJumpAndInvoke_argumentLoop):
movl (%eax,%ecx,1),%edx movl (%eax,%esi,1),%edi
movl %edx,8(%esp,%ecx,1) movl %edi,4(%ecx,%esi,1)
addl $8,%ecx addl $4,%esi
LOCAL(vmJumpAndInvoke_argumentTest): LOCAL(vmJumpAndInvoke_argumentTest):
cmpl %esi,%ecx cmpl %edx,%esi
jb LOCAL(vmJumpAndInvoke_argumentLoop) jb LOCAL(vmJumpAndInvoke_argumentLoop)
movl 12(%ebp),%esi movl 4(%esp),%ebx
movl 16(%ebp),%ebp movl 8(%esp),%esi
movl 12(%esp),%ebp
movl %ecx,%esp
jmp *%esi jmp *%esi