Files
xemu/include/exec/cpu-defs.h
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
2.6 KiB
C
Raw Normal View History

2003-08-10 21:35:13 +00:00
/*
* common defines for all CPUs
*
2003-08-10 21:35:13 +00:00
* 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.1 of the License, or (at your option) any later version.
2003-08-10 21:35:13 +00:00
*
* 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/>.
2003-08-10 21:35:13 +00:00
*/
#ifndef CPU_DEFS_H
#define CPU_DEFS_H
2007-11-17 17:14:51 +00:00
#ifndef NEED_CPU_H
#error cpu.h included from common code
#endif
#include "qemu/host-utils.h"
#include "qemu/thread.h"
#ifndef CONFIG_USER_ONLY
2012-12-17 18:19:49 +01:00
#include "exec/hwaddr.h"
#endif
2015-04-26 16:49:24 +01:00
#include "exec/memattrs.h"
#include "hw/core/cpu.h"
2003-08-10 21:35:13 +00:00
2019-03-22 11:51:19 -07:00
#include "cpu-param.h"
2004-01-24 15:26:06 +00:00
#ifndef TARGET_LONG_BITS
2019-03-22 11:51:19 -07:00
# error TARGET_LONG_BITS must be defined in cpu-param.h
#endif
#ifndef TARGET_PHYS_ADDR_SPACE_BITS
# error TARGET_PHYS_ADDR_SPACE_BITS must be defined in cpu-param.h
#endif
#ifndef TARGET_VIRT_ADDR_SPACE_BITS
# error TARGET_VIRT_ADDR_SPACE_BITS must be defined in cpu-param.h
#endif
#ifndef TARGET_PAGE_BITS
# ifdef TARGET_PAGE_BITS_VARY
# ifndef TARGET_PAGE_BITS_MIN
# error TARGET_PAGE_BITS_MIN must be defined in cpu-param.h
# endif
# else
# error TARGET_PAGE_BITS must be defined in cpu-param.h
# endif
2004-01-24 15:26:06 +00:00
#endif
#include "exec/target_long.h"
2004-01-24 15:26:06 +00:00
#if defined(CONFIG_SOFTMMU) && defined(CONFIG_TCG)
2019-01-16 12:01:13 -05:00
#define CPU_TLB_DYN_MIN_BITS 6
#define CPU_TLB_DYN_DEFAULT_BITS 8
# if HOST_LONG_BITS == 32
/* Make sure we do not require a double-word shift for the TLB load */
# define CPU_TLB_DYN_MAX_BITS (32 - TARGET_PAGE_BITS)
# else /* HOST_LONG_BITS == 64 */
/*
* Assuming TARGET_PAGE_BITS==12, with 2**22 entries we can cover 2**(22+12) ==
* 2**34 == 16G of address space. This is roughly what one would expect a
* TLB to cover in a modern (as of 2018) x86_64 CPU. For instance, Intel
* Skylake's Level-2 STLB has 16 1G entries.
* Also, make sure we do not size the TLB past the guest's address space.
*/
# ifdef TARGET_PAGE_BITS_VARY
# define CPU_TLB_DYN_MAX_BITS \
2019-01-16 12:01:13 -05:00
MIN(22, TARGET_VIRT_ADDR_SPACE_BITS - TARGET_PAGE_BITS)
# else
# define CPU_TLB_DYN_MAX_BITS \
MIN_CONST(22, TARGET_VIRT_ADDR_SPACE_BITS - TARGET_PAGE_BITS)
# endif
2019-01-16 12:01:13 -05:00
# endif
#endif /* CONFIG_SOFTMMU && CONFIG_TCG */
2003-08-10 21:35:13 +00:00
#endif