softmmu_template.h revision 3d40f685fa5cdd9cb665ae3cbf5f76113dafcb99
/*
* Software MMU support
*
* Copyright (c) 2003 Fabrice Bellard
*
* 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/>.
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#include "qemu-timer.h"
#if DATA_SIZE == 8
#define SUFFIX q
#define USUFFIX q
#ifdef VBOX
# define DATA_TYPE_PROMOTED uint64_t
#endif
#define SUFFIX l
#define USUFFIX l
#ifdef VBOX
# define DATA_TYPE_PROMOTED RTCCUINTREG
#endif
#define SUFFIX w
#ifdef VBOX
# define DATA_TYPE_PROMOTED RTCCUINTREG
#endif
#define SUFFIX b
#ifdef VBOX
# define DATA_TYPE_PROMOTED RTCCUINTREG
#endif
#else
#endif
#ifdef SOFTMMU_CODE_ACCESS
#define READ_ACCESS_TYPE 2
#else
#define READ_ACCESS_TYPE 0
#endif
int mmu_idx,
void *retaddr);
void *retaddr)
{
int index;
}
#if SHIFT <= 2
#else
#ifdef TARGET_WORDS_BIGENDIAN
#else
#endif
#endif /* SHIFT > 2 */
return res;
}
/* handle all cases except unaligned access which span two pages */
#ifndef VBOX
int mmu_idx)
#else
/* Load helpers invoked from generated code, and TCG makes an assumption
that valid value takes the whole register, why gcc after 4.3 may
use only lower part of register for smaller types. So force promotion. */
int mmu_idx)
#endif
{
int index;
void *retaddr;
/* test if there is match for unaligned or IO access */
/* XXX: could done more in memory macro in a non portable way */
redo:
if (tlb_addr & ~TARGET_PAGE_MASK) {
/* IO access */
goto do_unaligned_access;
/* slow unaligned access (it spans two pages or IO) */
#ifdef ALIGNED_ONLY
#endif
} else {
#ifdef ALIGNED_ONLY
}
#endif
}
} else {
/* the page is not in the TLB : fill it */
#ifdef ALIGNED_ONLY
#endif
goto redo;
}
return res;
}
/* handle all unaligned cases */
int mmu_idx,
void *retaddr)
{
redo:
if (tlb_addr & ~TARGET_PAGE_MASK) {
/* IO access */
goto do_unaligned_access;
/* slow unaligned access (it spans two pages) */
#ifdef TARGET_WORDS_BIGENDIAN
#else
#endif
} else {
}
} else {
/* the page is not in the TLB : fill it */
goto redo;
}
return res;
}
#ifndef SOFTMMU_CODE_ACCESS
int mmu_idx,
void *retaddr);
void *retaddr)
{
int index;
}
#if SHIFT <= 2
#else
#ifdef TARGET_WORDS_BIGENDIAN
#else
#endif
#endif /* SHIFT > 2 */
}
int mmu_idx)
{
void *retaddr;
int index;
redo:
if (tlb_addr & ~TARGET_PAGE_MASK) {
/* IO access */
goto do_unaligned_access;
#ifdef ALIGNED_ONLY
#endif
} else {
#ifdef ALIGNED_ONLY
}
#endif
}
} else {
/* the page is not in the TLB : fill it */
#ifdef ALIGNED_ONLY
#endif
goto redo;
}
}
/* handles all unaligned cases */
int mmu_idx,
void *retaddr)
{
int index, i;
redo:
if (tlb_addr & ~TARGET_PAGE_MASK) {
/* IO access */
goto do_unaligned_access;
/* XXX: not efficient, but simple */
/* Note: relies on the fact that tlb_fill() does not remove the
* previous page from the TLB cache. */
for(i = DATA_SIZE - 1; i >= 0; i--) {
#ifdef TARGET_WORDS_BIGENDIAN
#else
#endif
}
} else {
}
} else {
/* the page is not in the TLB : fill it */
goto redo;
}
}
#endif /* !defined(SOFTMMU_CODE_ACCESS) */
#ifdef VBOX
#endif