factor/vm/cpu-x86.32.S

77 lines
1.9 KiB
ArmAsm
Raw Normal View History

2007-09-21 22:56:01 -04:00
#include "asm.h"
/* Note that primitive word definitions are compiled with
__attribute__((regparm 2), so the pointer to the word object is passed in EAX,
and the callstack top is passed in EDX */
#define ARG0 %eax
#define ARG1 %edx
#define STACK_REG %esp
2007-09-22 00:44:27 -04:00
#define DS_REG %esi
2007-09-26 00:34:37 -04:00
#define RETURN_REG %eax
2007-09-21 22:56:01 -04:00
#define NV_TEMP_REG %ebx
2008-11-08 21:32:23 -05:00
#define ARITH_TEMP_1 %ebp
#define ARITH_TEMP_2 %ebx
#define DIV_RESULT %eax
2007-09-21 22:56:01 -04:00
#define CELL_SIZE 4
2008-11-07 21:33:32 -05:00
#define STACK_PADDING 12
2007-09-21 22:56:01 -04:00
#define PUSH_NONVOLATILE \
2007-09-22 00:44:27 -04:00
push %ebx ; \
2008-11-08 21:32:23 -05:00
push %ebp ; \
2007-09-21 22:56:01 -04:00
push %ebp
#define POP_NONVOLATILE \
2008-11-08 21:32:23 -05:00
pop %ebp ; \
2007-09-22 00:44:27 -04:00
pop %ebp ; \
2007-09-21 22:56:01 -04:00
pop %ebx
2009-04-26 09:06:37 -04:00
#define QUOT_XT_OFFSET 14
#define WORD_XT_OFFSET 30
2007-09-21 22:56:01 -04:00
2007-09-22 02:28:49 -04:00
/* We pass a function pointer to memcpy to work around a Mac OS X
2007-09-21 22:56:01 -04:00
ABI limitation which would otherwise require us to do a bizzaro PC-relative
trampoline to retrieve the function address */
DEF(void,set_callstack,(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy)):
mov 4(%esp),%ebp /* to */
mov 8(%esp),%edx /* from */
mov 12(%esp),%ecx /* length */
mov 16(%esp),%eax /* memcpy */
sub %ecx,%ebp /* compute new stack pointer */
mov %ebp,%esp
push %ecx /* pass length */
push %edx /* pass src */
push %ebp /* pass dst */
call *%eax /* call memcpy */
add $12,%esp /* pop args from the stack */
ret /* return _with new stack_ */
2008-10-20 06:56:39 -04:00
/* cpu.x86.32 calls this */
DEF(bool,check_sse2,(void)):
2008-10-20 06:56:39 -04:00
push %ebx
2008-10-31 22:07:41 -04:00
mov $1,%eax
2008-10-20 06:56:39 -04:00
cpuid
shr $26,%edx
and $1,%edx
pop %ebx
mov %edx,%eax
ret
DEF(F_FASTCALL void,primitive_inline_cache_miss,(void)):
mov (%esp),%eax
sub $8,%esp
push %eax
call MANGLE(inline_cache_miss)
add $12,%esp
jmp *WORD_XT_OFFSET(%eax)
2007-09-21 22:56:01 -04:00
#include "cpu-x86.S"
#ifdef WINDOWS
.section .drectve
.ascii " -export:check_sse2"
#endif