Fix >4G physical memory dump for Sparc32

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3229 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
blueswir1 2007-09-24 18:39:04 +00:00
parent e189e74868
commit 7743e58839
1 changed files with 31 additions and 19 deletions

View File

@ -506,7 +506,7 @@ static void term_printc(int c)
} }
static void memory_dump(int count, int format, int wsize, static void memory_dump(int count, int format, int wsize,
target_ulong addr, int is_physical) target_phys_addr_t addr, int is_physical)
{ {
CPUState *env; CPUState *env;
int nb_per_line, l, line_size, i, max_digits, len; int nb_per_line, l, line_size, i, max_digits, len;
@ -569,7 +569,10 @@ static void memory_dump(int count, int format, int wsize,
} }
while (len > 0) { while (len > 0) {
term_printf(TARGET_FMT_lx ":", addr); if (is_physical)
term_printf(TARGET_FMT_plx ":", addr);
else
term_printf(TARGET_FMT_lx ":", (target_ulong)addr);
l = len; l = len;
if (l > line_size) if (l > line_size)
l = line_size; l = line_size;
@ -637,18 +640,24 @@ static void do_memory_dump(int count, int format, int size,
memory_dump(count, format, size, addr, 0); memory_dump(count, format, size, addr, 0);
} }
#if TARGET_PHYS_ADDR_BITS > 32
#define GET_TPHYSADDR(h, l) (((uint64_t)(h) << 32) | (l))
#else
#define GET_TPHYSADDR(h, l) (l)
#endif
static void do_physical_memory_dump(int count, int format, int size, static void do_physical_memory_dump(int count, int format, int size,
uint32_t addrh, uint32_t addrl) uint32_t addrh, uint32_t addrl)
{ {
target_long addr = GET_TLONG(addrh, addrl); target_phys_addr_t addr = GET_TPHYSADDR(addrh, addrl);
memory_dump(count, format, size, addr, 1); memory_dump(count, format, size, addr, 1);
} }
static void do_print(int count, int format, int size, unsigned int valh, unsigned int vall) static void do_print(int count, int format, int size, unsigned int valh, unsigned int vall)
{ {
target_long val = GET_TLONG(valh, vall); target_phys_addr_t val = GET_TPHYSADDR(valh, vall);
#if TARGET_LONG_BITS == 32 #if TARGET_PHYS_ADDR_BITS == 32
switch(format) { switch(format) {
case 'o': case 'o':
term_printf("%#o", val); term_printf("%#o", val);
@ -1752,11 +1761,11 @@ static void next(void)
} }
} }
static target_long expr_sum(void); static target_phys_addr_t expr_sum(void);
static target_long expr_unary(void) static target_phys_addr_t expr_unary(void)
{ {
target_long n; target_phys_addr_t n;
char *p; char *p;
int ret; int ret;
@ -1794,6 +1803,7 @@ static target_long expr_unary(void)
case '$': case '$':
{ {
char buf[128], *q; char buf[128], *q;
target_long reg;
pch++; pch++;
q = buf; q = buf;
@ -1808,11 +1818,12 @@ static target_long expr_unary(void)
while (isspace(*pch)) while (isspace(*pch))
pch++; pch++;
*q = 0; *q = 0;
ret = get_monitor_def(&n, buf); ret = get_monitor_def(&reg, buf);
if (ret == -1) if (ret == -1)
expr_error("unknown register"); expr_error("unknown register");
else if (ret == -2) else if (ret == -2)
expr_error("no cpu defined"); expr_error("no cpu defined");
n = reg;
} }
break; break;
case '\0': case '\0':
@ -1820,7 +1831,7 @@ static target_long expr_unary(void)
n = 0; n = 0;
break; break;
default: default:
#if TARGET_LONG_BITS == 64 #if TARGET_PHYS_ADDR_BITS > 32
n = strtoull(pch, &p, 0); n = strtoull(pch, &p, 0);
#else #else
n = strtoul(pch, &p, 0); n = strtoul(pch, &p, 0);
@ -1837,9 +1848,9 @@ static target_long expr_unary(void)
} }
static target_long expr_prod(void) static target_phys_addr_t expr_prod(void)
{ {
target_long val, val2; target_phys_addr_t val, val2;
int op; int op;
val = expr_unary(); val = expr_unary();
@ -1868,9 +1879,9 @@ static target_long expr_prod(void)
return val; return val;
} }
static target_long expr_logic(void) static target_phys_addr_t expr_logic(void)
{ {
target_long val, val2; target_phys_addr_t val, val2;
int op; int op;
val = expr_prod(); val = expr_prod();
@ -1896,9 +1907,9 @@ static target_long expr_logic(void)
return val; return val;
} }
static target_long expr_sum(void) static target_phys_addr_t expr_sum(void)
{ {
target_long val, val2; target_phys_addr_t val, val2;
int op; int op;
val = expr_logic(); val = expr_logic();
@ -1916,7 +1927,7 @@ static target_long expr_sum(void)
return val; return val;
} }
static int get_expr(target_long *pval, const char **pp) static int get_expr(target_phys_addr_t *pval, const char **pp)
{ {
pch = *pp; pch = *pp;
if (setjmp(expr_env)) { if (setjmp(expr_env)) {
@ -2179,7 +2190,8 @@ static void monitor_handle_command(const char *cmdline)
case 'i': case 'i':
case 'l': case 'l':
{ {
target_long val; target_phys_addr_t val;
while (isspace(*p)) while (isspace(*p))
p++; p++;
if (*typestr == '?' || *typestr == '.') { if (*typestr == '?' || *typestr == '.') {
@ -2219,7 +2231,7 @@ static void monitor_handle_command(const char *cmdline)
} else { } else {
if ((nb_args + 1) >= MAX_ARGS) if ((nb_args + 1) >= MAX_ARGS)
goto error_args; goto error_args;
#if TARGET_LONG_BITS == 64 #if TARGET_PHYS_ADDR_BITS > 32
args[nb_args++] = (void *)(long)((val >> 32) & 0xffffffff); args[nb_args++] = (void *)(long)((val >> 32) & 0xffffffff);
#else #else
args[nb_args++] = (void *)0; args[nb_args++] = (void *)0;