Linux manages to have three separate orderings of the arguments to the clone() syscall on different architectures. In the kernel these are selected via CONFIG_CLONE_BACKWARDS and CONFIG_CLONE_BACKWARDS2. Clean up our implementation of this to use similar #define names rather than a TARGET_* ifdef ladder. This includes behaviour changes fixing bugs on cris, x86-64, m68k, openrisc and unicore32. cris had explicit but wrong handling; the others were just incorrectly using QEMU's default, which happened to be the equivalent of CONFIG_CLONE_BACKWARDS. (unicore32 appears to be broken in the mainline kernel in that it tries to use arg3 for both parent_tidptr and newtls simultaneously -- we don't attempt to emulate this bug...) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
		
			
				
	
	
		
			26 lines
		
	
	
		
			558 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			558 B
		
	
	
	
		
			C
		
	
	
	
	
	
/* this typedef defines how a Program Status Word looks like */
 | 
						|
typedef struct {
 | 
						|
    abi_ulong mask;
 | 
						|
    abi_ulong addr;
 | 
						|
} __attribute__ ((aligned(8))) target_psw_t;
 | 
						|
 | 
						|
/*
 | 
						|
 * The pt_regs struct defines the way the registers are stored on
 | 
						|
 * the stack during a system call.
 | 
						|
 */
 | 
						|
 | 
						|
#define TARGET_NUM_GPRS        16
 | 
						|
 | 
						|
struct target_pt_regs {
 | 
						|
    abi_ulong args[1];
 | 
						|
    target_psw_t psw;
 | 
						|
    abi_ulong gprs[TARGET_NUM_GPRS];
 | 
						|
    abi_ulong orig_gpr2;
 | 
						|
    unsigned short ilen;
 | 
						|
    unsigned short trap;
 | 
						|
};
 | 
						|
 | 
						|
#define UNAME_MACHINE "s390x"
 | 
						|
 | 
						|
#define TARGET_CLONE_BACKWARDS
 |