| 
									
										
										
										
											2006-09-26 10:52:29 +02:00
										 |  |  | /* | 
					
						
							|  |  |  |  * Save registers before calling assembly functions. This avoids | 
					
						
							|  |  |  |  * disturbance of register allocation in some inline assembly constructs. | 
					
						
							|  |  |  |  * Copyright 2001,2002 by Andi Kleen, SuSE Labs. | 
					
						
							| 
									
										
										
										
											2008-05-12 21:20:42 +02:00
										 |  |  |  * Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc. | 
					
						
							| 
									
										
										
										
											2006-09-26 10:52:29 +02:00
										 |  |  |  * Subject to the GNU public license, v.2. No warranty of any kind. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2011-05-31 22:21:54 +02:00
										 |  |  | #include <linux/linkage.h> | 
					
						
							|  |  |  | #include <asm/dwarf2.h> | 
					
						
							|  |  |  | #include <asm/calling.h> | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-31 22:21:54 +02:00
										 |  |  | 	/* rdi:	arg1 ... normal C conventions. rax is saved/restored. */ | 
					
						
							|  |  |  | 	.macro THUNK name, func, put_ret_addr_in_rdi=0 | 
					
						
							| 
									
										
										
										
											2008-05-12 21:20:42 +02:00
										 |  |  | 	.globl \name | 
					
						
							|  |  |  | \name: | 
					
						
							|  |  |  | 	CFI_STARTPROC | 
					
						
							| 
									
										
										
										
											2011-05-31 22:21:54 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* this one pushes 9 elems, the next one would be %rIP */ | 
					
						
							| 
									
										
										
										
											2008-05-12 21:20:42 +02:00
										 |  |  | 	SAVE_ARGS | 
					
						
							| 
									
										
										
										
											2011-05-31 22:21:54 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.if \put_ret_addr_in_rdi | 
					
						
							|  |  |  | 	movq_cfi_restore 9*8, rdi | 
					
						
							|  |  |  | 	.endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-12 21:20:42 +02:00
										 |  |  | 	call \func | 
					
						
							|  |  |  | 	jmp  restore | 
					
						
							|  |  |  | 	CFI_ENDPROC | 
					
						
							|  |  |  | 	.endm | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-31 22:21:54 +02:00
										 |  |  | #ifdef CONFIG_TRACE_IRQFLAGS | 
					
						
							|  |  |  | 	THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1 | 
					
						
							|  |  |  | 	THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1 | 
					
						
							| 
									
										
										
										
											2006-07-03 00:24:45 -07:00
										 |  |  | #endif | 
					
						
							| 
									
										
										
										
											2007-10-11 22:11:12 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 
					
						
							| 
									
										
										
										
											2011-05-31 22:21:54 +02:00
										 |  |  | 	THUNK lockdep_sys_exit_thunk,lockdep_sys_exit | 
					
						
							| 
									
										
										
										
											2007-10-11 22:11:12 +02:00
										 |  |  | #endif | 
					
						
							| 
									
										
										
										
											2011-05-31 22:21:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	/* SAVE_ARGS below is used only for the .cfi directives it contains. */ | 
					
						
							|  |  |  | 	CFI_STARTPROC | 
					
						
							|  |  |  | 	SAVE_ARGS | 
					
						
							|  |  |  | restore: | 
					
						
							|  |  |  | 	RESTORE_ARGS | 
					
						
							| 
									
										
										
										
											2011-05-31 22:21:54 +02:00
										 |  |  | 	ret | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	CFI_ENDPROC |