cputlb.c (b626eb031a33886a06a153b8715213a2b5816c1c) | cputlb.c (d03f140804b345a85973976506492027f703d82d) |
---|---|
1/* 2 * Common CPU TLB handling 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 20 unchanged lines hidden (view full) --- 29#include "exec/ram_addr.h" 30#include "tcg/tcg.h" 31#include "qemu/error-report.h" 32#include "exec/log.h" 33#include "exec/helper-proto.h" 34#include "qemu/atomic.h" 35#include "qemu/atomic128.h" 36#include "translate-all.h" | 1/* 2 * Common CPU TLB handling 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 20 unchanged lines hidden (view full) --- 29#include "exec/ram_addr.h" 30#include "tcg/tcg.h" 31#include "qemu/error-report.h" 32#include "exec/log.h" 33#include "exec/helper-proto.h" 34#include "qemu/atomic.h" 35#include "qemu/atomic128.h" 36#include "translate-all.h" |
37#include "trace-root.h" 38#include "qemu/plugin.h" 39#include "trace/mem.h" |
|
37#ifdef CONFIG_PLUGIN 38#include "qemu/plugin-memory.h" 39#endif 40 41/* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */ 42/* #define DEBUG_TLB */ 43/* #define DEBUG_TLB_LOG */ 44 --- 1576 unchanged lines hidden (view full) --- 1621 1622tcg_target_ulong helper_be_ldsl_mmu(CPUArchState *env, target_ulong addr, 1623 TCGMemOpIdx oi, uintptr_t retaddr) 1624{ 1625 return (int32_t)helper_be_ldul_mmu(env, addr, oi, retaddr); 1626} 1627 1628/* | 40#ifdef CONFIG_PLUGIN 41#include "qemu/plugin-memory.h" 42#endif 43 44/* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */ 45/* #define DEBUG_TLB */ 46/* #define DEBUG_TLB_LOG */ 47 --- 1576 unchanged lines hidden (view full) --- 1624 1625tcg_target_ulong helper_be_ldsl_mmu(CPUArchState *env, target_ulong addr, 1626 TCGMemOpIdx oi, uintptr_t retaddr) 1627{ 1628 return (int32_t)helper_be_ldul_mmu(env, addr, oi, retaddr); 1629} 1630 1631/* |
1632 * Load helpers for cpu_ldst.h. 1633 */ 1634 1635static inline uint64_t cpu_load_helper(CPUArchState *env, abi_ptr addr, 1636 int mmu_idx, uintptr_t retaddr, 1637 MemOp op, FullLoadHelper *full_load) 1638{ 1639 uint16_t meminfo; 1640 TCGMemOpIdx oi; 1641 uint64_t ret; 1642 1643 meminfo = trace_mem_get_info(op, mmu_idx, false); 1644 trace_guest_mem_before_exec(env_cpu(env), addr, meminfo); 1645 1646 op &= ~MO_SIGN; 1647 oi = make_memop_idx(op, mmu_idx); 1648 ret = full_load(env, addr, oi, retaddr); 1649 1650 qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, meminfo); 1651 1652 return ret; 1653} 1654 1655uint32_t cpu_ldub_mmuidx_ra(CPUArchState *env, abi_ptr addr, 1656 int mmu_idx, uintptr_t ra) 1657{ 1658 return cpu_load_helper(env, addr, mmu_idx, ra, MO_UB, full_ldub_mmu); 1659} 1660 1661int cpu_ldsb_mmuidx_ra(CPUArchState *env, abi_ptr addr, 1662 int mmu_idx, uintptr_t ra) 1663{ 1664 return (int8_t)cpu_load_helper(env, addr, mmu_idx, ra, MO_SB, 1665 full_ldub_mmu); 1666} 1667 1668uint32_t cpu_lduw_mmuidx_ra(CPUArchState *env, abi_ptr addr, 1669 int mmu_idx, uintptr_t ra) 1670{ 1671 return cpu_load_helper(env, addr, mmu_idx, ra, MO_TEUW, 1672 MO_TE == MO_LE 1673 ? full_le_lduw_mmu : full_be_lduw_mmu); 1674} 1675 1676int cpu_ldsw_mmuidx_ra(CPUArchState *env, abi_ptr addr, 1677 int mmu_idx, uintptr_t ra) 1678{ 1679 return (int16_t)cpu_load_helper(env, addr, mmu_idx, ra, MO_TESW, 1680 MO_TE == MO_LE 1681 ? full_le_lduw_mmu : full_be_lduw_mmu); 1682} 1683 1684uint32_t cpu_ldl_mmuidx_ra(CPUArchState *env, abi_ptr addr, 1685 int mmu_idx, uintptr_t ra) 1686{ 1687 return cpu_load_helper(env, addr, mmu_idx, ra, MO_TEUL, 1688 MO_TE == MO_LE 1689 ? full_le_ldul_mmu : full_be_ldul_mmu); 1690} 1691 1692uint64_t cpu_ldq_mmuidx_ra(CPUArchState *env, abi_ptr addr, 1693 int mmu_idx, uintptr_t ra) 1694{ 1695 return cpu_load_helper(env, addr, mmu_idx, ra, MO_TEQ, 1696 MO_TE == MO_LE 1697 ? helper_le_ldq_mmu : helper_be_ldq_mmu); 1698} 1699 1700/* |
|
1629 * Store Helpers 1630 */ 1631 1632static inline void QEMU_ALWAYS_INLINE 1633store_memop(void *haddr, uint64_t val, MemOp op) 1634{ 1635 switch (op) { 1636 case MO_UB: --- 212 unchanged lines hidden (view full) --- 1849} 1850 1851void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val, 1852 TCGMemOpIdx oi, uintptr_t retaddr) 1853{ 1854 store_helper(env, addr, val, oi, retaddr, MO_BEQ); 1855} 1856 | 1701 * Store Helpers 1702 */ 1703 1704static inline void QEMU_ALWAYS_INLINE 1705store_memop(void *haddr, uint64_t val, MemOp op) 1706{ 1707 switch (op) { 1708 case MO_UB: --- 212 unchanged lines hidden (view full) --- 1921} 1922 1923void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val, 1924 TCGMemOpIdx oi, uintptr_t retaddr) 1925{ 1926 store_helper(env, addr, val, oi, retaddr, MO_BEQ); 1927} 1928 |
1929/* 1930 * Store Helpers for cpu_ldst.h 1931 */ 1932 1933static inline void QEMU_ALWAYS_INLINE 1934cpu_store_helper(CPUArchState *env, target_ulong addr, uint64_t val, 1935 int mmu_idx, uintptr_t retaddr, MemOp op) 1936{ 1937 TCGMemOpIdx oi; 1938 uint16_t meminfo; 1939 1940 meminfo = trace_mem_get_info(op, mmu_idx, true); 1941 trace_guest_mem_before_exec(env_cpu(env), addr, meminfo); 1942 1943 oi = make_memop_idx(op, mmu_idx); 1944 store_helper(env, addr, val, oi, retaddr, op); 1945 1946 qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, meminfo); 1947} 1948 1949void cpu_stb_mmuidx_ra(CPUArchState *env, target_ulong addr, uint32_t val, 1950 int mmu_idx, uintptr_t retaddr) 1951{ 1952 cpu_store_helper(env, addr, val, mmu_idx, retaddr, MO_UB); 1953} 1954 1955void cpu_stw_mmuidx_ra(CPUArchState *env, target_ulong addr, uint32_t val, 1956 int mmu_idx, uintptr_t retaddr) 1957{ 1958 cpu_store_helper(env, addr, val, mmu_idx, retaddr, MO_TEUW); 1959} 1960 1961void cpu_stl_mmuidx_ra(CPUArchState *env, target_ulong addr, uint32_t val, 1962 int mmu_idx, uintptr_t retaddr) 1963{ 1964 cpu_store_helper(env, addr, val, mmu_idx, retaddr, MO_TEUL); 1965} 1966 1967void cpu_stq_mmuidx_ra(CPUArchState *env, target_ulong addr, uint64_t val, 1968 int mmu_idx, uintptr_t retaddr) 1969{ 1970 cpu_store_helper(env, addr, val, mmu_idx, retaddr, MO_TEQ); 1971} 1972 |
|
1857/* First set of helpers allows passing in of OI and RETADDR. This makes 1858 them callable from other helpers. */ 1859 1860#define EXTRA_ARGS , TCGMemOpIdx oi, uintptr_t retaddr 1861#define ATOMIC_NAME(X) \ 1862 HELPER(glue(glue(glue(atomic_ ## X, SUFFIX), END), _mmu)) 1863#define ATOMIC_MMU_DECLS 1864#define ATOMIC_MMU_LOOKUP atomic_mmu_lookup(env, addr, oi, retaddr) --- 145 unchanged lines hidden --- | 1973/* First set of helpers allows passing in of OI and RETADDR. This makes 1974 them callable from other helpers. */ 1975 1976#define EXTRA_ARGS , TCGMemOpIdx oi, uintptr_t retaddr 1977#define ATOMIC_NAME(X) \ 1978 HELPER(glue(glue(glue(atomic_ ## X, SUFFIX), END), _mmu)) 1979#define ATOMIC_MMU_DECLS 1980#define ATOMIC_MMU_LOOKUP atomic_mmu_lookup(env, addr, oi, retaddr) --- 145 unchanged lines hidden --- |