blob: 07ba4c757bf97d502d71b00fe0ab1730dc9f0882 [file] [log] [blame]
Vladimir Chtchetkine5389aa12010-02-16 10:38:35 -08001/* Copyright (C) 2007-2009 The Android Open Source Project
2**
3** This software is licensed under the terms of the GNU General Public
4** License version 2, as published by the Free Software Foundation, and
5** may be copied, distributed, and modified under those terms.
6**
7** This program is distributed in the hope that it will be useful,
8** but WITHOUT ANY WARRANTY; without even the implied warranty of
9** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10** GNU General Public License for more details.
11*/
12
13/*
14 * Contains SOFTMMU macros expansion for ldx_user and stx_user routines used
15 * outside of JIT. The issue is that regular implementation of these routines
16 * assumes that pointer to CPU environment is stored in ebp register, which
17 * is true for calls made inside JIT, but is not necessarily true for calls
18 * made outside of JIT. The way SOFTMMU macros are expanded in this header
19 * enforces ldx/stx routines to use CPU environment stored in cpu_single_env
20 * variable.
21 */
22#ifndef QEMU_SOFTMMU_OUTSIDE_JIT_H
23#define QEMU_SOFTMMU_OUTSIDE_JIT_H
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29////////////////////////////////////////////////////////////////////////////////
30// Declares routines implemented in softmmu_outside_jit.c, that are used in
31// this macros expansion. Note that MMUSUFFIX _outside_jit is enforced in
32// softmmu_header.h by defining OUTSIDE_JIT macro.
33////////////////////////////////////////////////////////////////////////////////
34
35uint8_t REGPARM __ldb_outside_jit(target_ulong addr, int mmu_idx);
36void REGPARM __stb_outside_jit(target_ulong addr, uint8_t val, int mmu_idx);
37uint16_t REGPARM __ldw_outside_jit(target_ulong addr, int mmu_idx);
38void REGPARM __stw_outside_jit(target_ulong addr, uint16_t val, int mmu_idx);
39uint32_t REGPARM __ldl_outside_jit(target_ulong addr, int mmu_idx);
40void REGPARM __stl_outside_jit(target_ulong addr, uint32_t val, int mmu_idx);
41uint64_t REGPARM __ldq_outside_jit(target_ulong addr, int mmu_idx);
42void REGPARM __stq_outside_jit(target_ulong addr, uint64_t val, int mmu_idx);
43
44// Enforces MMUSUFFIX to be set to _outside_jit in softmmu_header.h
45#define OUTSIDE_JIT
46// Enforces use of cpu_single_env for CPU environment.
47#define env cpu_single_env
48
49// =============================================================================
50// Generate ld/stx_user
51// =============================================================================
52#define MEMSUFFIX MMU_MODE1_SUFFIX
53#define ACCESS_TYPE 1
54
55#define DATA_SIZE 1
56#include "softmmu_header.h"
57
58#define DATA_SIZE 2
59#include "softmmu_header.h"
60
61#define DATA_SIZE 4
62#include "softmmu_header.h"
63
64#define DATA_SIZE 8
65#include "softmmu_header.h"
66
67#undef MEMSUFFIX
68#undef ACCESS_TYPE
69
70// =============================================================================
71// Generate ld/stx_kernel
72// =============================================================================
73#define MEMSUFFIX MMU_MODE0_SUFFIX
74#define ACCESS_TYPE 0
75
76#define DATA_SIZE 1
77#include "softmmu_header.h"
78
79#define DATA_SIZE 2
80#include "softmmu_header.h"
81
82#define DATA_SIZE 4
83#include "softmmu_header.h"
84
85#define DATA_SIZE 8
86#include "softmmu_header.h"
87
88#undef MEMSUFFIX
89#undef ACCESS_TYPE
90
91#undef env
92#undef OUTSIDE_JIT
93
94#ifdef __cplusplus
95}; /* end of extern "C" */
96#endif
97
98#endif // QEMU_SOFTMMU_OUTSIDE_JIT_H