Revision a68fe89c
b/exec.c | ||
---|---|---|
3106 | 3106 |
|
3107 | 3107 |
/* physical memory access (slow version, mainly for debug) */ |
3108 | 3108 |
#if defined(CONFIG_USER_ONLY) |
3109 |
void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
|
|
3110 |
int len, int is_write)
|
|
3109 |
int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
|
|
3110 |
uint8_t *buf, int len, int is_write)
|
|
3111 | 3111 |
{ |
3112 | 3112 |
int l, flags; |
3113 | 3113 |
target_ulong page; |
... | ... | |
3120 | 3120 |
l = len; |
3121 | 3121 |
flags = page_get_flags(page); |
3122 | 3122 |
if (!(flags & PAGE_VALID)) |
3123 |
return; |
|
3123 |
return -1;
|
|
3124 | 3124 |
if (is_write) { |
3125 | 3125 |
if (!(flags & PAGE_WRITE)) |
3126 |
return; |
|
3126 |
return -1;
|
|
3127 | 3127 |
/* XXX: this code should not depend on lock_user */ |
3128 | 3128 |
if (!(p = lock_user(VERIFY_WRITE, addr, l, 0))) |
3129 |
/* FIXME - should this return an error rather than just fail? */ |
|
3130 |
return; |
|
3129 |
return -1; |
|
3131 | 3130 |
memcpy(p, buf, l); |
3132 | 3131 |
unlock_user(p, addr, l); |
3133 | 3132 |
} else { |
3134 | 3133 |
if (!(flags & PAGE_READ)) |
3135 |
return; |
|
3134 |
return -1;
|
|
3136 | 3135 |
/* XXX: this code should not depend on lock_user */ |
3137 | 3136 |
if (!(p = lock_user(VERIFY_READ, addr, l, 1))) |
3138 |
/* FIXME - should this return an error rather than just fail? */ |
|
3139 |
return; |
|
3137 |
return -1; |
|
3140 | 3138 |
memcpy(buf, p, l); |
3141 | 3139 |
unlock_user(p, addr, 0); |
3142 | 3140 |
} |
... | ... | |
3144 | 3142 |
buf += l; |
3145 | 3143 |
addr += l; |
3146 | 3144 |
} |
3145 |
return 0; |
|
3147 | 3146 |
} |
3148 | 3147 |
|
3149 | 3148 |
#else |
... | ... | |
3641 | 3640 |
cpu_physical_memory_write(addr, (const uint8_t *)&val, 8); |
3642 | 3641 |
} |
3643 | 3642 |
|
3644 |
#endif |
|
3645 |
|
|
3646 | 3643 |
/* virtual memory access for debug (includes writing to ROM) */ |
3647 | 3644 |
int cpu_memory_rw_debug(CPUState *env, target_ulong addr, |
3648 | 3645 |
uint8_t *buf, int len, int is_write) |
... | ... | |
3661 | 3658 |
if (l > len) |
3662 | 3659 |
l = len; |
3663 | 3660 |
phys_addr += (addr & ~TARGET_PAGE_MASK); |
3664 |
#if !defined(CONFIG_USER_ONLY) |
|
3665 | 3661 |
if (is_write) |
3666 | 3662 |
cpu_physical_memory_write_rom(phys_addr, buf, l); |
3667 | 3663 |
else |
3668 |
#endif |
|
3669 | 3664 |
cpu_physical_memory_rw(phys_addr, buf, l, is_write); |
3670 | 3665 |
len -= l; |
3671 | 3666 |
buf += l; |
... | ... | |
3673 | 3668 |
} |
3674 | 3669 |
return 0; |
3675 | 3670 |
} |
3671 |
#endif |
|
3676 | 3672 |
|
3677 | 3673 |
/* in deterministic execution mode, instructions doing device I/Os |
3678 | 3674 |
must be at the end of the TB */ |
Also available in: Unified diff