[prev in list] [next in list] [prev in thread] [next in thread]
List: bochs-cvs
Subject: [Bochs-cvs] [13525] trunk/bochs
From: sshwarts--- via Bochs-cvs <bochs-cvs () lists ! sourceforge ! net>
Date: 2018-08-14 8:09:18
Message-ID: 1534234158.547751.6176 () sfp-scm-1 ! v30 ! lw ! sourceforge ! com
[Download RAW message or body]
Revision: 13525
Author: sshwarts
Date: 2018-08-14 08:09:09 +0000 (Tue, 14 Aug 2018)
Log Message:
-----------
support 64-bit in 'info tab' debugger command and also speed it up significantly
Modified Paths:
--------------
trunk/bochs/bx_debug/dbg_main.cc
trunk/bochs/cpu/cpu.h
trunk/bochs/cpu/paging.cc
Modified: trunk/bochs/bx_debug/dbg_main.cc
===================================================================
--- trunk/bochs/bx_debug/dbg_main.cc 2018-07-21 16:14:53 UTC (rev 13524)
+++ trunk/bochs/bx_debug/dbg_main.cc 2018-08-14 08:09:09 UTC (rev 13525)
@@ -1465,9 +1465,11 @@
void bx_dbg_xlate_address(bx_lin_address laddr)
{
bx_phy_address paddr;
+ bx_address lpf_mask;
+
laddr &= BX_CONST64(0xfffffffffffff000);
- bx_bool paddr_valid = BX_CPU(dbg_cpu)->dbg_xlate_linear2phy(laddr, &paddr, 1);
+ bx_bool paddr_valid = BX_CPU(dbg_cpu)->dbg_xlate_linear2phy(laddr, &paddr, \
&lpf_mask, 1); if (paddr_valid) {
dbg_printf("linear page 0x" FMT_ADDRX " maps to physical page 0x" FMT_PHY_ADDRX \
"\n", laddr, paddr); }
@@ -3522,16 +3524,17 @@
void bx_dbg_dump_table(void)
{
- Bit32u lin, start_lin; // show only low 32 bit
+ Bit64u lin, start_lin; // show only low 32 bit
bx_phy_address phy, start_phy; // start of a valid translation interval
+ bx_address lpf_mask = 0;
bx_bool valid;
if (! BX_CPU(dbg_cpu)->cr0.get_PG()) {
- printf("paging off\n");
+ dbg_printf("paging off\n");
return;
}
- printf("cr3: 0x" FMT_PHY_ADDRX "\n", (bx_phy_address)BX_CPU(dbg_cpu)->cr3);
+ dbg_printf("cr3: 0x" FMT_PHY_ADDRX "\n", (bx_phy_address)BX_CPU(dbg_cpu)->cr3);
lin = 0;
phy = 0;
@@ -3539,11 +3542,11 @@
start_lin = 1;
start_phy = 2;
while(1) {
- valid = BX_CPU(dbg_cpu)->dbg_xlate_linear2phy(lin, &phy);
+ valid = BX_CPU(dbg_cpu)->dbg_xlate_linear2phy(lin, &phy, &lpf_mask);
if(valid) {
if((lin - start_lin) != (phy - start_phy)) {
if(start_lin != 1)
- dbg_printf("0x%08x-0x%08x -> 0x" FMT_PHY_ADDRX "-0x" FMT_PHY_ADDRX "\n",
+ dbg_printf("0x" FMT_ADDRX "-0x" FMT_ADDRX " -> 0x" FMT_PHY_ADDRX "-0x" \
FMT_PHY_ADDRX "\n",
start_lin, lin - 1, start_phy, start_phy + (lin-1-start_lin));
start_lin = lin;
start_phy = phy;
@@ -3550,18 +3553,25 @@
}
} else {
if(start_lin != 1)
- dbg_printf("0x%08x-0x%08x -> 0x" FMT_PHY_ADDRX "-0x" FMT_PHY_ADDRX "\n",
+ dbg_printf("0x" FMT_ADDRX "-0x" FMT_ADDRX " -> 0x" FMT_PHY_ADDRX "-0x" \
FMT_PHY_ADDRX "\n", start_lin, lin - 1, start_phy, start_phy + (lin-1-start_lin));
start_lin = 1;
start_phy = 2;
}
- if(lin == 0xfffff000) break;
- lin += 0x1000;
+ lin += lpf_mask;
+ if (!BX_CPU(dbg_cpu)->long64_mode() && lin >= BX_CONST64(0xfffff000)) break;
+ if (lin >= BX_CONST64(0x00007ffffffff000)) {
+ if (lin < BX_CONST64(0xfffff00000000000))
+ lin = BX_CONST64(0xfffff00000000000) - 1;
+ if (lin >= BX_CONST64(0xfffffffffffff000))
+ break;
+ }
+ lin++;
}
if(start_lin != 1)
- dbg_printf("0x%08x-0x%08x -> 0x" FMT_PHY_ADDRX "-0x" FMT_PHY_ADDRX "\n",
- start_lin, 0xffffffff, start_phy, start_phy + (0xffffffff-start_lin));
+ dbg_printf("0x" FMT_ADDRX "-0x" FMT_ADDRX " -> 0x" FMT_PHY_ADDRX "-0x" \
FMT_PHY_ADDRX "\n", + start_lin, lin, start_phy, start_phy + \
(lin-start_lin)); }
void bx_dbg_print_help(void)
Modified: trunk/bochs/cpu/cpu.h
===================================================================
--- trunk/bochs/cpu/cpu.h 2018-07-21 16:14:53 UTC (rev 13524)
+++ trunk/bochs/cpu/cpu.h 2018-08-14 08:09:09 UTC (rev 13525)
@@ -4341,7 +4341,7 @@
BX_SMF bx_bool dbg_instruction_epilog(void);
#endif
#if BX_DEBUGGER || BX_DISASM || BX_INSTRUMENTATION || BX_GDBSTUB
- BX_SMF bx_bool dbg_xlate_linear2phy(bx_address linear, bx_phy_address *phy, \
bx_bool verbose = 0); + BX_SMF bx_bool dbg_xlate_linear2phy(bx_address linear, \
bx_phy_address *phy, bx_address *lpf_mask = 0, bx_bool verbose = 0); #if \
BX_SUPPORT_VMX >= 2 BX_SMF bx_bool dbg_translate_guest_physical(bx_phy_address \
guest_paddr, bx_phy_address *phy, bx_bool verbose = 0); #endif
Modified: trunk/bochs/cpu/paging.cc
===================================================================
--- trunk/bochs/cpu/paging.cc 2018-07-21 16:14:53 UTC (rev 13524)
+++ trunk/bochs/cpu/paging.cc 2018-08-14 08:09:09 UTC (rev 13525)
@@ -2074,9 +2074,10 @@
}
#endif
-bx_bool BX_CPU_C::dbg_xlate_linear2phy(bx_address laddr, bx_phy_address *phy, \
bx_bool verbose) +bx_bool BX_CPU_C::dbg_xlate_linear2phy(bx_address laddr, \
bx_phy_address *phy, bx_address *lpf_mask, bx_bool verbose) {
bx_phy_address paddress;
+ bx_address offset_mask = 0xfff;
#if BX_SUPPORT_X86_64
if (! long_mode()) laddr &= 0xffffffff;
@@ -2090,15 +2091,17 @@
#if BX_CPU_LEVEL >= 6
if (BX_CPU_THIS_PTR cr4.get_PAE()) {
- Bit64u offset_mask = BX_CONST64(0x0000ffffffffffff);
+ offset_mask = BX_CONST64(0x0000ffffffffffff);
int level = 3;
if (! long_mode()) {
pt_address = BX_CPU_THIS_PTR PDPTR_CACHE.entry[(laddr >> 30) & 3];
- if (! (pt_address & 0x1))
+ if (! (pt_address & 0x1)) {
+ offset_mask = 0x3fffffff;
goto page_fault;
+ }
+ offset_mask >>= 18;
pt_address &= BX_CONST64(0x000ffffffffff000);
- offset_mask >>= 18;
level = 1;
}
@@ -2140,7 +2143,7 @@
else // not PAE
#endif
{
- Bit32u offset_mask = 0xfff;
+ offset_mask = 0xfff;
for (int level = 1; level >= 0; --level) {
Bit32u pte;
pt_address += ((laddr >> (10 + 10*level)) & 0xffc);
@@ -2183,10 +2186,14 @@
}
#endif
+ if (lpf_mask)
+ *lpf_mask = offset_mask;
*phy = A20ADDR(paddress);
return 1;
page_fault:
+ if (lpf_mask)
+ *lpf_mask = offset_mask;
*phy = 0;
return 0;
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bochs-cvs mailing list
Bochs-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic