Commit 7743e588395535f1bc13f4f747069bae43935432

Authored by blueswir1
1 parent e189e748

Fix >4G physical memory dump for Sparc32


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3229 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 31 additions and 19 deletions
monitor.c
... ... @@ -506,7 +506,7 @@ static void term_printc(int c)
506 506 }
507 507  
508 508 static void memory_dump(int count, int format, int wsize,
509   - target_ulong addr, int is_physical)
  509 + target_phys_addr_t addr, int is_physical)
510 510 {
511 511 CPUState *env;
512 512 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,
569 569 }
570 570  
571 571 while (len > 0) {
572   - term_printf(TARGET_FMT_lx ":", addr);
  572 + if (is_physical)
  573 + term_printf(TARGET_FMT_plx ":", addr);
  574 + else
  575 + term_printf(TARGET_FMT_lx ":", (target_ulong)addr);
573 576 l = len;
574 577 if (l > line_size)
575 578 l = line_size;
... ... @@ -637,18 +640,24 @@ static void do_memory_dump(int count, int format, int size,
637 640 memory_dump(count, format, size, addr, 0);
638 641 }
639 642  
  643 +#if TARGET_PHYS_ADDR_BITS > 32
  644 +#define GET_TPHYSADDR(h, l) (((uint64_t)(h) << 32) | (l))
  645 +#else
  646 +#define GET_TPHYSADDR(h, l) (l)
  647 +#endif
  648 +
640 649 static void do_physical_memory_dump(int count, int format, int size,
641 650 uint32_t addrh, uint32_t addrl)
642 651  
643 652 {
644   - target_long addr = GET_TLONG(addrh, addrl);
  653 + target_phys_addr_t addr = GET_TPHYSADDR(addrh, addrl);
645 654 memory_dump(count, format, size, addr, 1);
646 655 }
647 656  
648 657 static void do_print(int count, int format, int size, unsigned int valh, unsigned int vall)
649 658 {
650   - target_long val = GET_TLONG(valh, vall);
651   -#if TARGET_LONG_BITS == 32
  659 + target_phys_addr_t val = GET_TPHYSADDR(valh, vall);
  660 +#if TARGET_PHYS_ADDR_BITS == 32
652 661 switch(format) {
653 662 case 'o':
654 663 term_printf("%#o", val);
... ... @@ -1752,11 +1761,11 @@ static void next(void)
1752 1761 }
1753 1762 }
1754 1763  
1755   -static target_long expr_sum(void);
  1764 +static target_phys_addr_t expr_sum(void);
1756 1765  
1757   -static target_long expr_unary(void)
  1766 +static target_phys_addr_t expr_unary(void)
1758 1767 {
1759   - target_long n;
  1768 + target_phys_addr_t n;
1760 1769 char *p;
1761 1770 int ret;
1762 1771  
... ... @@ -1794,6 +1803,7 @@ static target_long expr_unary(void)
1794 1803 case '$':
1795 1804 {
1796 1805 char buf[128], *q;
  1806 + target_long reg;
1797 1807  
1798 1808 pch++;
1799 1809 q = buf;
... ... @@ -1808,11 +1818,12 @@ static target_long expr_unary(void)
1808 1818 while (isspace(*pch))
1809 1819 pch++;
1810 1820 *q = 0;
1811   - ret = get_monitor_def(&n, buf);
  1821 + ret = get_monitor_def(&reg, buf);
1812 1822 if (ret == -1)
1813 1823 expr_error("unknown register");
1814 1824 else if (ret == -2)
1815 1825 expr_error("no cpu defined");
  1826 + n = reg;
1816 1827 }
1817 1828 break;
1818 1829 case '\0':
... ... @@ -1820,7 +1831,7 @@ static target_long expr_unary(void)
1820 1831 n = 0;
1821 1832 break;
1822 1833 default:
1823   -#if TARGET_LONG_BITS == 64
  1834 +#if TARGET_PHYS_ADDR_BITS > 32
1824 1835 n = strtoull(pch, &p, 0);
1825 1836 #else
1826 1837 n = strtoul(pch, &p, 0);
... ... @@ -1837,9 +1848,9 @@ static target_long expr_unary(void)
1837 1848 }
1838 1849  
1839 1850  
1840   -static target_long expr_prod(void)
  1851 +static target_phys_addr_t expr_prod(void)
1841 1852 {
1842   - target_long val, val2;
  1853 + target_phys_addr_t val, val2;
1843 1854 int op;
1844 1855  
1845 1856 val = expr_unary();
... ... @@ -1868,9 +1879,9 @@ static target_long expr_prod(void)
1868 1879 return val;
1869 1880 }
1870 1881  
1871   -static target_long expr_logic(void)
  1882 +static target_phys_addr_t expr_logic(void)
1872 1883 {
1873   - target_long val, val2;
  1884 + target_phys_addr_t val, val2;
1874 1885 int op;
1875 1886  
1876 1887 val = expr_prod();
... ... @@ -1896,9 +1907,9 @@ static target_long expr_logic(void)
1896 1907 return val;
1897 1908 }
1898 1909  
1899   -static target_long expr_sum(void)
  1910 +static target_phys_addr_t expr_sum(void)
1900 1911 {
1901   - target_long val, val2;
  1912 + target_phys_addr_t val, val2;
1902 1913 int op;
1903 1914  
1904 1915 val = expr_logic();
... ... @@ -1916,7 +1927,7 @@ static target_long expr_sum(void)
1916 1927 return val;
1917 1928 }
1918 1929  
1919   -static int get_expr(target_long *pval, const char **pp)
  1930 +static int get_expr(target_phys_addr_t *pval, const char **pp)
1920 1931 {
1921 1932 pch = *pp;
1922 1933 if (setjmp(expr_env)) {
... ... @@ -2179,7 +2190,8 @@ static void monitor_handle_command(const char *cmdline)
2179 2190 case 'i':
2180 2191 case 'l':
2181 2192 {
2182   - target_long val;
  2193 + target_phys_addr_t val;
  2194 +
2183 2195 while (isspace(*p))
2184 2196 p++;
2185 2197 if (*typestr == '?' || *typestr == '.') {
... ... @@ -2219,7 +2231,7 @@ static void monitor_handle_command(const char *cmdline)
2219 2231 } else {
2220 2232 if ((nb_args + 1) >= MAX_ARGS)
2221 2233 goto error_args;
2222   -#if TARGET_LONG_BITS == 64
  2234 +#if TARGET_PHYS_ADDR_BITS > 32
2223 2235 args[nb_args++] = (void *)(long)((val >> 32) & 0xffffffff);
2224 2236 #else
2225 2237 args[nb_args++] = (void *)0;
... ...