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