Revision 1ad2134f cpu-all.h
b/cpu-all.h | ||
---|---|---|
21 | 21 |
#define CPU_ALL_H |
22 | 22 |
|
23 | 23 |
#include "qemu-common.h" |
24 |
|
|
25 |
#if defined(__arm__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__) |
|
26 |
#define WORDS_ALIGNED |
|
27 |
#endif |
|
24 |
#include "cpu-common.h" |
|
28 | 25 |
|
29 | 26 |
/* some important defines: |
30 | 27 |
* |
... | ... | |
39 | 36 |
* TARGET_WORDS_BIGENDIAN : same for target cpu |
40 | 37 |
*/ |
41 | 38 |
|
42 |
#include "bswap.h" |
|
43 | 39 |
#include "softfloat.h" |
44 | 40 |
|
45 | 41 |
#if defined(WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) |
... | ... | |
847 | 843 |
int cpu_inl(CPUState *env, int addr); |
848 | 844 |
#endif |
849 | 845 |
|
850 |
/* address in the RAM (different from a physical address) */ |
|
851 |
#ifdef CONFIG_KQEMU |
|
852 |
typedef uint32_t ram_addr_t; |
|
853 |
#else |
|
854 |
typedef unsigned long ram_addr_t; |
|
855 |
#endif |
|
856 |
|
|
857 | 846 |
/* memory API */ |
858 | 847 |
|
859 | 848 |
extern int phys_ram_fd; |
... | ... | |
867 | 856 |
3 flags. The ROMD code stores the page ram offset in iotlb entry, |
868 | 857 |
so only a limited number of ids are avaiable. */ |
869 | 858 |
|
870 |
#define IO_MEM_SHIFT 3 |
|
871 | 859 |
#define IO_MEM_NB_ENTRIES (1 << (TARGET_PAGE_BITS - IO_MEM_SHIFT)) |
872 | 860 |
|
873 |
#define IO_MEM_RAM (0 << IO_MEM_SHIFT) /* hardcoded offset */ |
|
874 |
#define IO_MEM_ROM (1 << IO_MEM_SHIFT) /* hardcoded offset */ |
|
875 |
#define IO_MEM_UNASSIGNED (2 << IO_MEM_SHIFT) |
|
876 |
#define IO_MEM_NOTDIRTY (3 << IO_MEM_SHIFT) |
|
877 |
|
|
878 |
/* Acts like a ROM when read and like a device when written. */ |
|
879 |
#define IO_MEM_ROMD (1) |
|
880 |
#define IO_MEM_SUBPAGE (2) |
|
881 |
#define IO_MEM_SUBWIDTH (4) |
|
882 |
|
|
883 | 861 |
/* Flags stored in the low bits of the TLB virtual address. These are |
884 | 862 |
defined so that fast path ram access is all zeros. */ |
885 | 863 |
/* Zero if TLB entry is valid. */ |
... | ... | |
890 | 868 |
/* Set if TLB entry is an IO callback. */ |
891 | 869 |
#define TLB_MMIO (1 << 5) |
892 | 870 |
|
893 |
typedef void CPUWriteMemoryFunc(void *opaque, target_phys_addr_t addr, uint32_t value); |
|
894 |
typedef uint32_t CPUReadMemoryFunc(void *opaque, target_phys_addr_t addr); |
|
895 |
|
|
896 |
void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, |
|
897 |
ram_addr_t size, |
|
898 |
ram_addr_t phys_offset, |
|
899 |
ram_addr_t region_offset); |
|
900 |
static inline void cpu_register_physical_memory(target_phys_addr_t start_addr, |
|
901 |
ram_addr_t size, |
|
902 |
ram_addr_t phys_offset) |
|
903 |
{ |
|
904 |
cpu_register_physical_memory_offset(start_addr, size, phys_offset, 0); |
|
905 |
} |
|
906 |
|
|
907 |
ram_addr_t cpu_get_physical_page_desc(target_phys_addr_t addr); |
|
908 |
ram_addr_t qemu_ram_alloc(ram_addr_t); |
|
909 |
void qemu_ram_free(ram_addr_t addr); |
|
910 |
/* This should only be used for ram local to a device. */ |
|
911 |
void *qemu_get_ram_ptr(ram_addr_t addr); |
|
912 |
/* This should not be used by devices. */ |
|
913 |
ram_addr_t qemu_ram_addr_from_host(void *ptr); |
|
914 |
|
|
915 |
int cpu_register_io_memory(int io_index, |
|
916 |
CPUReadMemoryFunc **mem_read, |
|
917 |
CPUWriteMemoryFunc **mem_write, |
|
918 |
void *opaque); |
|
919 |
void cpu_unregister_io_memory(int table_address); |
|
920 |
|
|
921 |
void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, |
|
922 |
int len, int is_write); |
|
923 |
static inline void cpu_physical_memory_read(target_phys_addr_t addr, |
|
924 |
uint8_t *buf, int len) |
|
925 |
{ |
|
926 |
cpu_physical_memory_rw(addr, buf, len, 0); |
|
927 |
} |
|
928 |
static inline void cpu_physical_memory_write(target_phys_addr_t addr, |
|
929 |
const uint8_t *buf, int len) |
|
930 |
{ |
|
931 |
cpu_physical_memory_rw(addr, (uint8_t *)buf, len, 1); |
|
932 |
} |
|
933 |
void *cpu_physical_memory_map(target_phys_addr_t addr, |
|
934 |
target_phys_addr_t *plen, |
|
935 |
int is_write); |
|
936 |
void cpu_physical_memory_unmap(void *buffer, target_phys_addr_t len, |
|
937 |
int is_write, target_phys_addr_t access_len); |
|
938 |
void *cpu_register_map_client(void *opaque, void (*callback)(void *opaque)); |
|
939 |
void cpu_unregister_map_client(void *cookie); |
|
940 |
|
|
941 |
uint32_t ldub_phys(target_phys_addr_t addr); |
|
942 |
uint32_t lduw_phys(target_phys_addr_t addr); |
|
943 |
uint32_t ldl_phys(target_phys_addr_t addr); |
|
944 |
uint64_t ldq_phys(target_phys_addr_t addr); |
|
945 |
void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val); |
|
946 |
void stq_phys_notdirty(target_phys_addr_t addr, uint64_t val); |
|
947 |
void stb_phys(target_phys_addr_t addr, uint32_t val); |
|
948 |
void stw_phys(target_phys_addr_t addr, uint32_t val); |
|
949 |
void stl_phys(target_phys_addr_t addr, uint32_t val); |
|
950 |
void stq_phys(target_phys_addr_t addr, uint64_t val); |
|
951 |
|
|
952 |
void cpu_physical_memory_write_rom(target_phys_addr_t addr, |
|
953 |
const uint8_t *buf, int len); |
|
954 | 871 |
int cpu_memory_rw_debug(CPUState *env, target_ulong addr, |
955 | 872 |
uint8_t *buf, int len, int is_write); |
956 | 873 |
|
Also available in: Unified diff