]> gitweb.factorcode.org Git - factor.git/blob - vm/cpu-x86.32.S
tools.deploy.shaker: strip out math.vectors specializations
[factor.git] / vm / cpu-x86.32.S
1 #include "asm.h"
2
3 #define ARG0 %eax
4 #define ARG1 %edx
5 #define STACK_REG %esp
6 #define DS_REG %esi
7 #define RETURN_REG %eax
8
9 #define NV_TEMP_REG %ebx
10
11 #define ARITH_TEMP_1 %ebp
12 #define ARITH_TEMP_2 %ebx
13 #define DIV_RESULT %eax
14
15 #define CELL_SIZE 4
16 #define STACK_PADDING 12
17
18 #define PUSH_NONVOLATILE \
19         push %ebx ; \
20         push %ebp ; \
21         push %ebp
22
23 #define POP_NONVOLATILE \
24         pop %ebp ; \
25         pop %ebp ; \
26         pop %ebx
27
28 #define QUOT_XT_OFFSET 12
29
30 /* We pass a function pointer to memcpy to work around a Mac OS X
31 ABI limitation which would otherwise require us to do a bizzaro PC-relative
32 trampoline to retrieve the function address */
33 DEF(void,set_callstack,(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy)):
34         mov 4(%esp),%ebp                   /* to */
35         mov 8(%esp),%edx                   /* from */
36         mov 12(%esp),%ecx                  /* length */
37         mov 16(%esp),%eax                  /* memcpy */
38         sub %ecx,%ebp                      /* compute new stack pointer */
39         mov %ebp,%esp
40         push %ecx                          /* pass length */
41         push %edx                          /* pass src */
42         push %ebp                          /* pass dst */
43         call *%eax                         /* call memcpy */
44         add $12,%esp                       /* pop args from the stack */
45         ret                                /* return _with new stack_ */
46
47 DEF(long long,read_timestamp_counter,(void)):
48         rdtsc
49         ret
50
51 DEF(void,primitive_inline_cache_miss,(void)):
52         mov (%esp),%ebx
53 DEF(void,primitive_inline_cache_miss_tail,(void)):
54         sub $8,%esp
55         push %ebx
56         call MANGLE(inline_cache_miss)
57         add $12,%esp
58         jmp *%eax
59
60 #include "cpu-x86.S"
61
62 #ifdef WINDOWS
63         .section .drectve
64         .ascii " -export:read_timestamp_counter"
65 #endif