mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 06:13:46 +08:00
Fix usermode virtual address type
Usermode virtual addresses are abi_ulong, not target_ulong. Signed-off-by: Paul Brook <paul@codesourcery.com>
This commit is contained in:
parent
4836a2b09a
commit
b480d9b74d
@ -744,15 +744,17 @@ extern unsigned long qemu_host_page_mask;
|
||||
#define PAGE_WRITE_ORG 0x0010
|
||||
#define PAGE_RESERVED 0x0020
|
||||
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
void page_dump(FILE *f);
|
||||
|
||||
typedef int (*walk_memory_regions_fn)(void *, unsigned long,
|
||||
unsigned long, unsigned long);
|
||||
typedef int (*walk_memory_regions_fn)(void *, abi_ulong,
|
||||
abi_ulong, unsigned long);
|
||||
int walk_memory_regions(void *, walk_memory_regions_fn);
|
||||
|
||||
int page_get_flags(target_ulong address);
|
||||
void page_set_flags(target_ulong start, target_ulong end, int flags);
|
||||
int page_check_range(target_ulong start, target_ulong len, int flags);
|
||||
#endif
|
||||
|
||||
void cpu_exec_init_all(unsigned long tb_size);
|
||||
CPUState *cpu_copy(CPUState *env);
|
||||
|
@ -29,7 +29,7 @@
|
||||
addresses in userspace mode. Define tb_page_addr_t to be an appropriate
|
||||
type. */
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
typedef target_ulong tb_page_addr_t;
|
||||
typedef abi_ulong tb_page_addr_t;
|
||||
#else
|
||||
typedef ram_addr_t tb_page_addr_t;
|
||||
#endif
|
||||
|
22
exec.c
22
exec.c
@ -2217,7 +2217,7 @@ struct walk_memory_regions_data
|
||||
};
|
||||
|
||||
static int walk_memory_regions_end(struct walk_memory_regions_data *data,
|
||||
unsigned long end, int new_prot)
|
||||
abi_ulong end, int new_prot)
|
||||
{
|
||||
if (data->start != -1ul) {
|
||||
int rc = data->fn(data->priv, data->start, end, data->prot);
|
||||
@ -2233,9 +2233,9 @@ static int walk_memory_regions_end(struct walk_memory_regions_data *data,
|
||||
}
|
||||
|
||||
static int walk_memory_regions_1(struct walk_memory_regions_data *data,
|
||||
unsigned long base, int level, void **lp)
|
||||
abi_ulong base, int level, void **lp)
|
||||
{
|
||||
unsigned long pa;
|
||||
abi_ulong pa;
|
||||
int i, rc;
|
||||
|
||||
if (*lp == NULL) {
|
||||
@ -2258,7 +2258,8 @@ static int walk_memory_regions_1(struct walk_memory_regions_data *data,
|
||||
} else {
|
||||
void **pp = *lp;
|
||||
for (i = 0; i < L2_BITS; ++i) {
|
||||
pa = base | (i << (TARGET_PAGE_BITS + L2_BITS * level));
|
||||
pa = base | ((abi_ulong)i <<
|
||||
(TARGET_PAGE_BITS + L2_BITS * level));
|
||||
rc = walk_memory_regions_1(data, pa, level - 1, pp + i);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
@ -2280,7 +2281,7 @@ int walk_memory_regions(void *priv, walk_memory_regions_fn fn)
|
||||
data.prot = 0;
|
||||
|
||||
for (i = 0; i < V_L1_SIZE; i++) {
|
||||
int rc = walk_memory_regions_1(&data, i << V_L1_SHIFT,
|
||||
int rc = walk_memory_regions_1(&data, (abi_ulong)i << V_L1_SHIFT,
|
||||
V_L1_SHIFT / L2_BITS - 1, l1_map + i);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
@ -2290,12 +2291,13 @@ int walk_memory_regions(void *priv, walk_memory_regions_fn fn)
|
||||
return walk_memory_regions_end(&data, 0, 0);
|
||||
}
|
||||
|
||||
static int dump_region(void *priv, unsigned long start,
|
||||
unsigned long end, unsigned long prot)
|
||||
static int dump_region(void *priv, abi_ulong start,
|
||||
abi_ulong end, unsigned long prot)
|
||||
{
|
||||
FILE *f = (FILE *)priv;
|
||||
|
||||
(void) fprintf(f, "%08lx-%08lx %08lx %c%c%c\n",
|
||||
(void) fprintf(f, TARGET_ABI_FMT_lx"-"TARGET_ABI_FMT_lx
|
||||
" "TARGET_ABI_FMT_lx" %c%c%c\n",
|
||||
start, end, end - start,
|
||||
((prot & PAGE_READ) ? 'r' : '-'),
|
||||
((prot & PAGE_WRITE) ? 'w' : '-'),
|
||||
@ -2332,8 +2334,8 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
|
||||
/* This function should never be called with addresses outside the
|
||||
guest address space. If this assert fires, it probably indicates
|
||||
a missing call to h2g_valid. */
|
||||
#if HOST_LONG_BITS > L1_MAP_ADDR_SPACE_BITS
|
||||
assert(end < (1ul << L1_MAP_ADDR_SPACE_BITS));
|
||||
#if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS
|
||||
assert(end < ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS));
|
||||
#endif
|
||||
assert(start < end);
|
||||
|
||||
|
@ -2020,7 +2020,7 @@ static int vma_get_mapping_count(const struct mm_struct *);
|
||||
static struct vm_area_struct *vma_first(const struct mm_struct *);
|
||||
static struct vm_area_struct *vma_next(struct vm_area_struct *);
|
||||
static abi_ulong vma_dump_size(const struct vm_area_struct *);
|
||||
static int vma_walker(void *priv, unsigned long start, unsigned long end,
|
||||
static int vma_walker(void *priv, abi_ulong start, abi_ulong end,
|
||||
unsigned long flags);
|
||||
|
||||
static void fill_elf_header(struct elfhdr *, int, uint16_t, uint32_t);
|
||||
@ -2173,7 +2173,7 @@ static abi_ulong vma_dump_size(const struct vm_area_struct *vma)
|
||||
return (vma->vma_end - vma->vma_start);
|
||||
}
|
||||
|
||||
static int vma_walker(void *priv, unsigned long start, unsigned long end,
|
||||
static int vma_walker(void *priv, abi_ulong start, abi_ulong end,
|
||||
unsigned long flags)
|
||||
{
|
||||
struct mm_struct *mm = (struct mm_struct *)priv;
|
||||
|
@ -88,7 +88,7 @@ void *qemu_vmalloc(size_t size)
|
||||
|
||||
if (h2g_valid(p)) {
|
||||
/* Allocated region overlaps guest address space. This may recurse. */
|
||||
unsigned long addr = h2g(p);
|
||||
abi_ulong addr = h2g(p);
|
||||
page_set_flags(addr & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(addr + size),
|
||||
PAGE_RESERVED);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user