| 
									
										
										
										
											2007-09-21 22:56:01 -04:00
										 |  |  | #include "asm.h" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define ARG0 %rdi | 
					
						
							|  |  |  | #define ARG1 %rsi | 
					
						
							|  |  |  | #define STACK_REG %rsp | 
					
						
							|  |  |  | #define DS_REG %r14 | 
					
						
							| 
									
										
										
										
											2007-09-26 00:34:37 -04:00
										 |  |  | #define RETURN_REG %rax | 
					
						
							| 
									
										
										
										
											2007-09-21 22:56:01 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define CELL_SIZE 8 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PUSH_NONVOLATILE \ | 
					
						
							| 
									
										
										
										
											2007-09-22 00:44:27 -04:00
										 |  |  | 	push %rbx ; \
 | 
					
						
							|  |  |  | 	push %rbp ; \
 | 
					
						
							|  |  |  | 	push %r12 ; \
 | 
					
						
							| 
									
										
										
										
											2007-09-22 00:28:55 -04:00
										 |  |  | 	push %r13 ;
 | 
					
						
							| 
									
										
										
										
											2007-09-21 22:56:01 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define POP_NONVOLATILE \ | 
					
						
							| 
									
										
										
										
											2007-09-22 00:44:27 -04:00
										 |  |  | 	pop %r13 ; \
 | 
					
						
							|  |  |  | 	pop %r12 ; \
 | 
					
						
							|  |  |  | 	pop %rbp ; \
 | 
					
						
							| 
									
										
										
										
											2007-09-21 22:56:01 -04:00
										 |  |  | 	pop %rbx | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-26 00:34:10 -04:00
										 |  |  | #define QUOT_XT_OFFSET 21 | 
					
						
							| 
									
										
										
										
											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)): | 
					
						
							|  |  |  | 	sub %rdx,%rdi                      /* compute new stack pointer */ | 
					
						
							|  |  |  | 	mov %rdi,%rsp | 
					
						
							|  |  |  | 	call *%rcx                         /* call memcpy */ | 
					
						
							|  |  |  | 	ret                                /* return _with new stack_ */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "cpu-x86.S" |