Revision 5fafdf24 cpu-all.h
b/cpu-all.h | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
* defines common to all virtual CPUs |
3 |
*
|
|
3 |
* |
|
4 | 4 |
* Copyright (c) 2003 Fabrice Bellard |
5 | 5 |
* |
6 | 6 |
* This library is free software; you can redistribute it and/or |
... | ... | |
24 | 24 |
#define WORDS_ALIGNED |
25 | 25 |
#endif |
26 | 26 |
|
27 |
/* some important defines:
|
|
28 |
*
|
|
27 |
/* some important defines: |
|
28 |
* |
|
29 | 29 |
* WORDS_ALIGNED : if defined, the host cpu can only make word aligned |
30 | 30 |
* memory accesses. |
31 |
*
|
|
31 |
* |
|
32 | 32 |
* WORDS_BIGENDIAN : if defined, the host cpu is big endian and |
33 | 33 |
* otherwise little endian. |
34 |
*
|
|
34 |
* |
|
35 | 35 |
* (TARGET_WORDS_ALIGNED : same for target cpu (not supported yet)) |
36 |
*
|
|
36 |
* |
|
37 | 37 |
* TARGET_WORDS_BIGENDIAN : same for target cpu |
38 | 38 |
*/ |
39 | 39 |
|
... | ... | |
147 | 147 |
* type is: |
148 | 148 |
* (empty): integer access |
149 | 149 |
* f : float access |
150 |
*
|
|
150 |
* |
|
151 | 151 |
* sign is: |
152 | 152 |
* (empty): for floats or 32 bit size |
153 | 153 |
* u : unsigned |
... | ... | |
158 | 158 |
* w: 16 bits |
159 | 159 |
* l: 32 bits |
160 | 160 |
* q: 64 bits |
161 |
*
|
|
161 |
* |
|
162 | 162 |
* endian is: |
163 | 163 |
* (empty): target cpu endianness or 8 bit access |
164 | 164 |
* r : reversed target cpu endianness (not implemented yet) |
... | ... | |
621 | 621 |
#define stfq_raw(p, v) stfq_p(saddr((p)), v) |
622 | 622 |
|
623 | 623 |
|
624 |
#if defined(CONFIG_USER_ONLY)
|
|
624 |
#if defined(CONFIG_USER_ONLY) |
|
625 | 625 |
|
626 | 626 |
/* if user mode, no other memory access functions */ |
627 | 627 |
#define ldub(p) ldub_raw(p) |
... | ... | |
685 | 685 |
#define PAGE_VALID 0x0008 |
686 | 686 |
/* original state of the write flag (used when tracking self-modifying |
687 | 687 |
code */ |
688 |
#define PAGE_WRITE_ORG 0x0010
|
|
688 |
#define PAGE_WRITE_ORG 0x0010 |
|
689 | 689 |
|
690 | 690 |
void page_dump(FILE *f); |
691 | 691 |
int page_get_flags(target_ulong address); |
... | ... | |
694 | 694 |
|
695 | 695 |
CPUState *cpu_copy(CPUState *env); |
696 | 696 |
|
697 |
void cpu_dump_state(CPUState *env, FILE *f,
|
|
697 |
void cpu_dump_state(CPUState *env, FILE *f, |
|
698 | 698 |
int (*cpu_fprintf)(FILE *f, const char *fmt, ...), |
699 | 699 |
int flags); |
700 | 700 |
void cpu_dump_statistics (CPUState *env, FILE *f, |
... | ... | |
732 | 732 |
if no page found. */ |
733 | 733 |
target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr); |
734 | 734 |
|
735 |
#define CPU_LOG_TB_OUT_ASM (1 << 0)
|
|
735 |
#define CPU_LOG_TB_OUT_ASM (1 << 0) |
|
736 | 736 |
#define CPU_LOG_TB_IN_ASM (1 << 1) |
737 | 737 |
#define CPU_LOG_TB_OP (1 << 2) |
738 | 738 |
#define CPU_LOG_TB_OP_OPT (1 << 3) |
... | ... | |
793 | 793 |
typedef void CPUWriteMemoryFunc(void *opaque, target_phys_addr_t addr, uint32_t value); |
794 | 794 |
typedef uint32_t CPUReadMemoryFunc(void *opaque, target_phys_addr_t addr); |
795 | 795 |
|
796 |
void cpu_register_physical_memory(target_phys_addr_t start_addr,
|
|
796 |
void cpu_register_physical_memory(target_phys_addr_t start_addr, |
|
797 | 797 |
unsigned long size, |
798 | 798 |
unsigned long phys_offset); |
799 | 799 |
uint32_t cpu_get_physical_page_desc(target_phys_addr_t addr); |
... | ... | |
808 | 808 |
|
809 | 809 |
void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, |
810 | 810 |
int len, int is_write); |
811 |
static inline void cpu_physical_memory_read(target_phys_addr_t addr,
|
|
811 |
static inline void cpu_physical_memory_read(target_phys_addr_t addr, |
|
812 | 812 |
uint8_t *buf, int len) |
813 | 813 |
{ |
814 | 814 |
cpu_physical_memory_rw(addr, buf, len, 0); |
815 | 815 |
} |
816 |
static inline void cpu_physical_memory_write(target_phys_addr_t addr,
|
|
816 |
static inline void cpu_physical_memory_write(target_phys_addr_t addr, |
|
817 | 817 |
const uint8_t *buf, int len) |
818 | 818 |
{ |
819 | 819 |
cpu_physical_memory_rw(addr, (uint8_t *)buf, len, 1); |
... | ... | |
829 | 829 |
void stl_phys(target_phys_addr_t addr, uint32_t val); |
830 | 830 |
void stq_phys(target_phys_addr_t addr, uint64_t val); |
831 | 831 |
|
832 |
void cpu_physical_memory_write_rom(target_phys_addr_t addr,
|
|
832 |
void cpu_physical_memory_write_rom(target_phys_addr_t addr, |
|
833 | 833 |
const uint8_t *buf, int len); |
834 |
int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
|
|
834 |
int cpu_memory_rw_debug(CPUState *env, target_ulong addr, |
|
835 | 835 |
uint8_t *buf, int len, int is_write); |
836 | 836 |
|
837 | 837 |
#define VGA_DIRTY_FLAG 0x01 |
... | ... | |
843 | 843 |
return phys_ram_dirty[addr >> TARGET_PAGE_BITS] == 0xff; |
844 | 844 |
} |
845 | 845 |
|
846 |
static inline int cpu_physical_memory_get_dirty(ram_addr_t addr,
|
|
846 |
static inline int cpu_physical_memory_get_dirty(ram_addr_t addr, |
|
847 | 847 |
int dirty_flags) |
848 | 848 |
{ |
849 | 849 |
return phys_ram_dirty[addr >> TARGET_PAGE_BITS] & dirty_flags; |
... | ... | |
866 | 866 |
|
867 | 867 |
#if defined(__powerpc__) |
868 | 868 |
|
869 |
static inline uint32_t get_tbl(void)
|
|
869 |
static inline uint32_t get_tbl(void) |
|
870 | 870 |
{ |
871 | 871 |
uint32_t tbl; |
872 | 872 |
asm volatile("mftb %0" : "=r" (tbl)); |
873 | 873 |
return tbl; |
874 | 874 |
} |
875 | 875 |
|
876 |
static inline uint32_t get_tbu(void)
|
|
876 |
static inline uint32_t get_tbu(void) |
|
877 | 877 |
{ |
878 | 878 |
uint32_t tbl; |
879 | 879 |
asm volatile("mftbu %0" : "=r" (tbl)); |
Also available in: Unified diff