We had a check using TARGET_VIRT_ADDR_SPACE_BITS to make sure that the allocation coming in from the command-line option was not too large, but that didn't include target-specific knowledge about other restrictions on user-space. Remove several target-specific hacks in linux-user/main.c. For MIPS and Nios, we can replace them with proper adjustments to the respective target's TARGET_VIRT_ADDR_SPACE_BITS definition. For ARM, we had no existing ifdef but I suspect that the current default value of 0xf7000000 was chosen with this in mind. Define a workable value in linux-user/arm/, and also document why the special case is required. Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20170708025030.15845-3-rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * ARM specific CPU ABI and functions for linux-user
 | 
						|
 *
 | 
						|
 * Copyright (c) 2003 Fabrice Bellard
 | 
						|
 *
 | 
						|
 * This library is free software; you can redistribute it and/or
 | 
						|
 * modify it under the terms of the GNU Lesser General Public
 | 
						|
 * License as published by the Free Software Foundation; either
 | 
						|
 * version 2 of the License, or (at your option) any later version.
 | 
						|
 *
 | 
						|
 * This library is distributed in the hope that it will be useful,
 | 
						|
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
						|
 * Lesser General Public License for more details.
 | 
						|
 *
 | 
						|
 * You should have received a copy of the GNU Lesser General Public
 | 
						|
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 | 
						|
 */
 | 
						|
#ifndef ARM_TARGET_CPU_H
 | 
						|
#define ARM_TARGET_CPU_H
 | 
						|
 | 
						|
/* We need to be able to map the commpage.
 | 
						|
   See validate_guest_space in linux-user/elfload.c.  */
 | 
						|
#define MAX_RESERVED_VA  0xffff0000ul
 | 
						|
 | 
						|
static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp)
 | 
						|
{
 | 
						|
    if (newsp) {
 | 
						|
        env->regs[13] = newsp;
 | 
						|
    }
 | 
						|
    env->regs[0] = 0;
 | 
						|
}
 | 
						|
 | 
						|
static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls)
 | 
						|
{
 | 
						|
    if (access_secure_reg(env)) {
 | 
						|
        env->cp15.tpidruro_s = newtls;
 | 
						|
    } else {
 | 
						|
        env->cp15.tpidrro_el[0] = newtls;
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
static inline target_ulong cpu_get_tls(CPUARMState *env)
 | 
						|
{
 | 
						|
    if (access_secure_reg(env)) {
 | 
						|
        return env->cp15.tpidruro_s;
 | 
						|
    } else {
 | 
						|
        return env->cp15.tpidrro_el[0];
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
#endif
 |