mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
use LOCAL macro to mark local symbols in *.S
This commit is contained in:
parent
a9ae50900a
commit
32f4feb4aa
@ -10,6 +10,8 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define LOCAL(x) .L##x
|
||||
|
||||
.text
|
||||
|
||||
#ifdef __x86_64__
|
||||
@ -37,15 +39,15 @@ vmInvoke:
|
||||
// copy arguments into place
|
||||
pushq %rcx
|
||||
movq $0,%r9
|
||||
jmp test
|
||||
jmp LOCAL(test)
|
||||
|
||||
loop:
|
||||
LOCAL(loop):
|
||||
push (%rdx,%r9,8)
|
||||
inc %r9
|
||||
|
||||
test:
|
||||
LOCAL(test):
|
||||
cmpq %rcx,%r9
|
||||
jb loop
|
||||
jb LOCAL(loop)
|
||||
|
||||
// call function
|
||||
call *%rsi
|
||||
@ -97,15 +99,15 @@ vmInvoke:
|
||||
// copy arguments into place
|
||||
movl $0,%ecx
|
||||
mov 16(%ebp),%edx
|
||||
jmp test
|
||||
jmp LOCAL(test)
|
||||
|
||||
loop:
|
||||
LOCAL(loop):
|
||||
push (%edx,%ecx,4)
|
||||
inc %ecx
|
||||
|
||||
test:
|
||||
LOCAL(test):
|
||||
cmpl 20(%ebp),%ecx
|
||||
jb loop
|
||||
jb LOCAL(loop)
|
||||
|
||||
// call function
|
||||
call *12(%ebp)
|
||||
@ -118,20 +120,20 @@ test:
|
||||
// handle return value based on expected type
|
||||
movl 24(%ebp),%ecx
|
||||
|
||||
void:
|
||||
LOCAL(void):
|
||||
cmpl $VOID_TYPE,%ecx
|
||||
jne int64
|
||||
jmp exit
|
||||
jne LOCAL(int64)
|
||||
jmp LOCAL(exit)
|
||||
|
||||
int64:
|
||||
LOCAL(int64):
|
||||
cmpl $INT64_TYPE,%ecx
|
||||
jne int32
|
||||
jmp exit
|
||||
jne LOCAL(int32)
|
||||
jmp LOCAL(exit)
|
||||
|
||||
int32:
|
||||
LOCAL(int32):
|
||||
movl $0,%edx
|
||||
|
||||
exit:
|
||||
LOCAL(exit):
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
|
@ -13,6 +13,7 @@
|
||||
.text
|
||||
|
||||
#define BYTES_PER_WORD 4
|
||||
#define LOCAL(x) L##x
|
||||
|
||||
#ifdef __APPLE__
|
||||
.globl _vmNativeCall
|
||||
@ -52,20 +53,20 @@ vmNativeCall:
|
||||
mr r14,r9
|
||||
|
||||
li r16,0
|
||||
b test
|
||||
b LOCAL(test)
|
||||
|
||||
loop:
|
||||
LOCAL(loop):
|
||||
lwzx r17,r16,r5
|
||||
stwx r17,r16,r1
|
||||
addi r16,r16,BYTES_PER_WORD
|
||||
|
||||
test:
|
||||
LOCAL(test):
|
||||
cmplw r16,r6
|
||||
blt loop
|
||||
blt LOCAL(loop)
|
||||
|
||||
// do we need to load the floating point registers?
|
||||
cmpwi r8,0
|
||||
beq gpr
|
||||
beq LOCAL(gpr)
|
||||
|
||||
// yes, we do
|
||||
lfd f1,0(r8)
|
||||
@ -82,10 +83,10 @@ test:
|
||||
lfd f12,88(r8)
|
||||
lfd f13,96(r8)
|
||||
|
||||
gpr:
|
||||
LOCAL(gpr):
|
||||
// do we need to load the general-purpose registers?
|
||||
cmpwi r7,0
|
||||
beq call
|
||||
beq LOCAL(call)
|
||||
|
||||
// yes, we do
|
||||
mr r16,r7
|
||||
@ -98,29 +99,29 @@ gpr:
|
||||
lwz r9,24(r16)
|
||||
lwz r10,28(r16)
|
||||
|
||||
call:
|
||||
LOCAL(call):
|
||||
// load and call function address
|
||||
mtctr r13
|
||||
bctrl
|
||||
|
||||
// handle return value based on expected type
|
||||
cmpwi r14,VOID_TYPE
|
||||
bne float
|
||||
b exit
|
||||
bne LOCAL(float)
|
||||
b LOCAL(exit)
|
||||
|
||||
float:
|
||||
LOCAL(float):
|
||||
cmpwi r14,FLOAT_TYPE
|
||||
beq copy
|
||||
beq LOCAL(copy)
|
||||
cmpwi r14,DOUBLE_TYPE
|
||||
bne exit
|
||||
bne LOCAL(exit)
|
||||
|
||||
copy:
|
||||
LOCAL(copy):
|
||||
// move floating point return value to GPRs via memory
|
||||
stfd f1,8(r1)
|
||||
lwz r3,8(r1)
|
||||
lwz r4,12(r1)
|
||||
|
||||
exit:
|
||||
LOCAL(exit):
|
||||
// restore stack pointer
|
||||
lwz r1,0(r1)
|
||||
|
||||
|
66
src/x86.S
66
src/x86.S
@ -10,6 +10,8 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define LOCAL(x) .L##x
|
||||
|
||||
.text
|
||||
|
||||
#ifdef __x86_64__
|
||||
@ -42,9 +44,9 @@ vmNativeCall:
|
||||
|
||||
// copy memory arguments into place
|
||||
movq $0,%rcx
|
||||
jmp test
|
||||
jmp LOCAL(test)
|
||||
|
||||
loop:
|
||||
LOCAL(loop):
|
||||
movq %rcx,%rax
|
||||
movq %rcx,%rdx
|
||||
addq %rsp,%rdx
|
||||
@ -53,13 +55,13 @@ loop:
|
||||
movq %rax,(%rdx)
|
||||
addq $8,%rcx
|
||||
|
||||
test:
|
||||
LOCAL(test):
|
||||
cmpq -32(%rbp),%rcx
|
||||
jb loop
|
||||
jb LOCAL(loop)
|
||||
|
||||
// do we need to load the general-purpose registers?
|
||||
cmpq $0,-24(%rbp)
|
||||
je sse
|
||||
je LOCAL(sse)
|
||||
|
||||
// yes, we do
|
||||
movq -24(%rbp),%rax
|
||||
@ -70,10 +72,10 @@ test:
|
||||
movq 32(%rax),%r8
|
||||
movq 40(%rax),%r9
|
||||
|
||||
sse:
|
||||
LOCAL(sse):
|
||||
// do we need to load the SSE registers?
|
||||
cmpq $0,-16(%rbp)
|
||||
je call
|
||||
je LOCAL(call)
|
||||
|
||||
// yes, we do
|
||||
movq -16(%rbp),%rax
|
||||
@ -86,27 +88,27 @@ sse:
|
||||
movq 48(%rax),%xmm6
|
||||
movq 64(%rax),%xmm7
|
||||
|
||||
call:
|
||||
LOCAL(call):
|
||||
call *-48(%rbp)
|
||||
|
||||
// handle return value based on expected type
|
||||
movq -8(%rbp),%rcx
|
||||
|
||||
void:
|
||||
LOCAL(void):
|
||||
cmpq $VOID_TYPE,%rcx
|
||||
jne float
|
||||
jmp exit
|
||||
jne LOCAL(float)
|
||||
jmp LOCAL(exit)
|
||||
|
||||
float:
|
||||
LOCAL(float):
|
||||
cmpq $FLOAT_TYPE,%rcx
|
||||
je copy
|
||||
je LOCAL(copy)
|
||||
cmpq $DOUBLE_TYPE,%rcx
|
||||
jne exit
|
||||
jne LOCAL(exit)
|
||||
|
||||
copy:
|
||||
LOCAL(copy):
|
||||
movq %xmm0,%rax
|
||||
|
||||
exit:
|
||||
LOCAL(exit):
|
||||
movq %rbp,%rsp
|
||||
popq %rbp
|
||||
ret
|
||||
@ -147,9 +149,9 @@ vmNativeCall:
|
||||
|
||||
// copy arguments into place
|
||||
movl $0,%ecx
|
||||
jmp test
|
||||
jmp LOCAL(test)
|
||||
|
||||
loop:
|
||||
LOCAL(loop):
|
||||
movl %ecx,%eax
|
||||
movl %ecx,%edx
|
||||
addl %esp,%edx
|
||||
@ -158,9 +160,9 @@ loop:
|
||||
movl %eax,(%edx)
|
||||
addl $4,%ecx
|
||||
|
||||
test:
|
||||
LOCAL(test):
|
||||
cmpl 16(%ebp),%ecx
|
||||
jb loop
|
||||
jb LOCAL(loop)
|
||||
|
||||
// call function
|
||||
call *8(%ebp)
|
||||
@ -168,31 +170,31 @@ test:
|
||||
// handle return value based on expected type
|
||||
movl 20(%ebp),%ecx
|
||||
|
||||
void:
|
||||
LOCAL(void):
|
||||
cmpl $VOID_TYPE,%ecx
|
||||
jne int64
|
||||
jmp exit
|
||||
jne LOCAL(int64)
|
||||
jmp LOCAL(exit)
|
||||
|
||||
int64:
|
||||
LOCAL(int64):
|
||||
cmpl $INT64_TYPE,%ecx
|
||||
jne float
|
||||
jmp exit
|
||||
jne LOCAL(float)
|
||||
jmp LOCAL(exit)
|
||||
|
||||
float:
|
||||
LOCAL(float):
|
||||
cmpl $FLOAT_TYPE,%ecx
|
||||
jne double
|
||||
jne LOCAL(double)
|
||||
fstps 8(%ebp)
|
||||
movl 8(%ebp),%eax
|
||||
jmp exit
|
||||
jmp LOCAL(exit)
|
||||
|
||||
double:
|
||||
LOCAL(double):
|
||||
cmpl $DOUBLE_TYPE,%ecx
|
||||
jne exit
|
||||
jne LOCAL(exit)
|
||||
fstpl 8(%ebp)
|
||||
movl 8(%ebp),%eax
|
||||
movl 12(%ebp),%edx
|
||||
|
||||
exit:
|
||||
LOCAL(exit):
|
||||
movl %ebp,%esp
|
||||
popl %ebp
|
||||
ret
|
||||
|
Loading…
Reference in New Issue
Block a user