You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			21 lines
		
	
	
		
			685 B
		
	
	
	
		
			NASM
		
	
			
		
		
	
	
			21 lines
		
	
	
		
			685 B
		
	
	
	
		
			NASM
		
	
| [SECTION .text]
 | |
| [GLOBAL context_switch]
 | |
| [GLOBAL context_launch]
 | |
| [GLOBAL fake_systemv_abi]
 | |
| 
 | |
| ; context_switch saves the registers in the current context structure
 | |
| ; and populates the registers from the the next context.
 | |
| align 16
 | |
| context_switch:
 | |
| 
 | |
| ; context_launch populates the register set from the next context structure.
 | |
| ; It does not save the current registers.
 | |
| align 16 ; When only one parameter is used for `align`, it will use NOP
 | |
| context_launch:
 | |
| 
 | |
| ; fake_systemv_abi is used to populate the volatile argument registers used by the systemv abi (rdi, rsi, ...)
 | |
| ; with values from the non-volatile registers saved within the thread context (r15, r14, ...)
 | |
| align 16
 | |
| fake_systemv_abi:
 | |
| 
 |