From: <ssh...@us...> - 2015-09-22 20:10:25
|
Revision: 12836 Author: sshwarts Date: 2015-09-22 20:10:22 +0000 (Tue, 22 Sep 2015) Log Message: ----------- more cases applicable for BX_TLB_ENTRY_OF Modified Paths: -------------- trunk/bochs/cpu/access.cc trunk/bochs/cpu/access2.cc trunk/bochs/cpu/cpu.cc trunk/bochs/cpu/paging.cc trunk/bochs/cpu/proc_ctrl.cc trunk/bochs/cpu/stack.cc trunk/bochs/cpu/tasking.cc trunk/bochs/cpu/tlb.h Modified: trunk/bochs/cpu/access.cc =================================================================== --- trunk/bochs/cpu/access.cc 2015-09-21 20:07:51 UTC (rev 12835) +++ trunk/bochs/cpu/access.cc 2015-09-22 20:10:22 UTC (rev 12836) @@ -297,7 +297,7 @@ Bit8u data; bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -322,9 +322,8 @@ { Bit16u data; - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 1); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 1); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -349,9 +348,8 @@ { Bit32u data; - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 3); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 3); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -376,9 +374,8 @@ { Bit64u data; - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 7); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 7); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -402,7 +399,7 @@ BX_CPU_C::system_write_byte(bx_address laddr, Bit8u data) { Bit32u lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -425,9 +422,8 @@ void BX_CPP_AttrRegparmN(2) BX_CPU_C::system_write_word(bx_address laddr, Bit16u data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 1); Bit32u lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 1); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -450,9 +446,8 @@ void BX_CPP_AttrRegparmN(2) BX_CPU_C::system_write_dword(bx_address laddr, Bit32u data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 3); Bit32u lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 3); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -476,7 +471,7 @@ BX_CPU_C::v2h_read_byte(bx_address laddr, bx_bool user) { bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -495,7 +490,7 @@ BX_CPU_C::v2h_write_byte(bx_address laddr, bx_bool user) { bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access Modified: trunk/bochs/cpu/access2.cc =================================================================== --- trunk/bochs/cpu/access2.cc 2015-09-21 20:07:51 UTC (rev 12835) +++ trunk/bochs/cpu/access2.cc 2015-09-22 20:10:22 UTC (rev 12836) @@ -30,7 +30,7 @@ BX_CPU_C::write_linear_byte(unsigned s, bx_address laddr, Bit8u data) { bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -53,13 +53,12 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::write_linear_word(unsigned s, bx_address laddr, Bit16u data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 1); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 1); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (1 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -82,13 +81,12 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::write_linear_dword(unsigned s, bx_address laddr, Bit32u data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 3); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 3); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (3 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -111,13 +109,12 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::write_linear_qword(unsigned s, bx_address laddr, Bit64u data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 7); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 7); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (7 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -142,9 +139,8 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::write_linear_xmmword(unsigned s, bx_address laddr, const BxPackedXmmRegister *data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 15); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 15); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -169,7 +165,7 @@ BX_CPU_C::write_linear_xmmword_aligned(unsigned s, bx_address laddr, const BxPackedXmmRegister *data) { bx_address lpf = AlignedAccessLPFOf(laddr, 15); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -199,9 +195,8 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::write_linear_ymmword(unsigned s, bx_address laddr, const BxPackedYmmRegister *data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 31); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 31); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -227,7 +222,7 @@ BX_CPU_C::write_linear_ymmword_aligned(unsigned s, bx_address laddr, const BxPackedYmmRegister *data) { bx_address lpf = AlignedAccessLPFOf(laddr, 31); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -259,9 +254,8 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::write_linear_zmmword(unsigned s, bx_address laddr, const BxPackedZmmRegister *data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 63); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 63); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -287,7 +281,7 @@ BX_CPU_C::write_linear_zmmword_aligned(unsigned s, bx_address laddr, const BxPackedZmmRegister *data) { bx_address lpf = AlignedAccessLPFOf(laddr, 63); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -323,7 +317,7 @@ Bit8u data; bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -348,13 +342,12 @@ { Bit16u data; - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 1); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 1); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (1 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -379,13 +372,12 @@ { Bit32u data; - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 3); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 3); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (3 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -410,13 +402,12 @@ { Bit64u data; - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 7); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 7); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (7 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -441,9 +432,8 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::read_linear_xmmword(unsigned s, bx_address laddr, BxPackedXmmRegister *data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 15); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 15); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -466,7 +456,7 @@ BX_CPU_C::read_linear_xmmword_aligned(unsigned s, bx_address laddr, BxPackedXmmRegister *data) { bx_address lpf = AlignedAccessLPFOf(laddr, 15); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -494,9 +484,8 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::read_linear_ymmword(unsigned s, bx_address laddr, BxPackedYmmRegister *data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 31); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 31); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -520,7 +509,7 @@ BX_CPU_C::read_linear_ymmword_aligned(unsigned s, bx_address laddr, BxPackedYmmRegister *data) { bx_address lpf = AlignedAccessLPFOf(laddr, 31); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -550,9 +539,8 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::read_linear_zmmword(unsigned s, bx_address laddr, BxPackedZmmRegister *data) { - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 63); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 63); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -576,7 +564,7 @@ BX_CPU_C::read_linear_zmmword_aligned(unsigned s, bx_address laddr, BxPackedZmmRegister *data) { bx_address lpf = AlignedAccessLPFOf(laddr, 63); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us read access // from this CPL. @@ -614,7 +602,7 @@ { Bit8u data; bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -645,13 +633,12 @@ BX_CPU_C::read_RMW_linear_word(unsigned s, bx_address laddr) { Bit16u data; - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 1); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 1); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (1 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -682,13 +669,12 @@ BX_CPU_C::read_RMW_linear_dword(unsigned s, bx_address laddr) { Bit32u data; - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 3); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 3); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (3 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -719,13 +705,12 @@ BX_CPU_C::read_RMW_linear_qword(unsigned s, bx_address laddr) { Bit64u data; - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 7); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 7); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (7 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -914,7 +899,7 @@ void BX_CPU_C::read_RMW_linear_dqword_aligned_64(unsigned s, bx_address laddr, Bit64u *hi, Bit64u *lo) { bx_address lpf = AlignedAccessLPFOf(laddr, 15); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -976,13 +961,12 @@ void BX_CPU_C::write_new_stack_word(bx_address laddr, unsigned curr_pl, Bit16u data) { bx_bool user = (curr_pl == 3); - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 1); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 1); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (1 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -1005,13 +989,12 @@ void BX_CPU_C::write_new_stack_dword(bx_address laddr, unsigned curr_pl, Bit32u data) { bx_bool user = (curr_pl == 3); - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 3); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 3); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (3 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. @@ -1034,13 +1017,12 @@ void BX_CPU_C::write_new_stack_qword(bx_address laddr, unsigned curr_pl, Bit64u data) { bx_bool user = (curr_pl == 3); - unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 7); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 7); #if BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL >= 4 bx_address lpf = AlignedAccessLPFOf(laddr, (7 & BX_CPU_THIS_PTR alignment_check_mask)); #else bx_address lpf = LPFOf(laddr); #endif - bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex]; if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access // from this CPL. Modified: trunk/bochs/cpu/cpu.cc =================================================================== --- trunk/bochs/cpu/cpu.cc 2015-09-21 20:07:51 UTC (rev 12835) +++ trunk/bochs/cpu/cpu.cc 2015-09-22 20:10:22 UTC (rev 12836) @@ -599,7 +599,7 @@ BX_CPU_THIS_PTR clear_RF(); bx_address lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); Bit8u *fetchPtr = 0; if ((tlbEntry->lpf == lpf) && (tlbEntry->accessBits & (0x10 << USER_PL)) != 0) { Modified: trunk/bochs/cpu/paging.cc =================================================================== --- trunk/bochs/cpu/paging.cc 2015-09-21 20:07:51 UTC (rev 12835) +++ trunk/bochs/cpu/paging.cc 2015-09-22 20:10:22 UTC (rev 12836) @@ -426,7 +426,7 @@ else #endif { - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); bx_address lpf = LPFOf(laddr); if (TLB_LPFOf(tlbEntry->lpf) == lpf) { tlbEntry->invalidate(); @@ -2056,7 +2056,7 @@ { Bit32u pageOffset = PAGE_OFFSET(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); #if BX_SUPPORT_X86_64 if (! IsCanonical(laddr)) { @@ -2108,7 +2108,7 @@ } #endif - bx_TLB_entry *tlbEntry2 = BX_TLB_ENTRY_OF(laddr2); + bx_TLB_entry *tlbEntry2 = BX_TLB_ENTRY_OF(laddr2, 0); BX_CPU_THIS_PTR address_xlation.paddress1 = translate_linear(tlbEntry, laddr, (curr_pl == 3), BX_WRITE); BX_CPU_THIS_PTR address_xlation.paddress2 = translate_linear(tlbEntry2, laddr2, (curr_pl == 3), BX_WRITE); @@ -2174,7 +2174,7 @@ } #endif - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); /* check for reference across multiple pages */ if ((pageOffset + len) <= 4096) { @@ -2207,7 +2207,7 @@ } #endif - bx_TLB_entry *tlbEntry2 = BX_TLB_ENTRY_OF(laddr2); + bx_TLB_entry *tlbEntry2 = BX_TLB_ENTRY_OF(laddr2, 0); BX_CPU_THIS_PTR address_xlation.paddress1 = translate_linear(tlbEntry, laddr, (curr_pl == 3), xlate_rw); BX_CPU_THIS_PTR address_xlation.paddress2 = translate_linear(tlbEntry2, laddr2, (curr_pl == 3), xlate_rw); Modified: trunk/bochs/cpu/proc_ctrl.cc =================================================================== --- trunk/bochs/cpu/proc_ctrl.cc 2015-09-21 20:07:51 UTC (rev 12835) +++ trunk/bochs/cpu/proc_ctrl.cc 2015-09-22 20:10:22 UTC (rev 12836) @@ -291,7 +291,7 @@ #if BX_INSTRUMENTATION bx_phy_address paddr = #endif - translate_linear(BX_TLB_ENTRY_OF(laddr), laddr, USER_PL, BX_READ); + translate_linear(BX_TLB_ENTRY_OF(laddr, 0), laddr, USER_PL, BX_READ); BX_INSTR_CLFLUSH(BX_CPU_ID, laddr, paddr); @@ -761,7 +761,7 @@ } } - bx_phy_address paddr = translate_linear(BX_TLB_ENTRY_OF(laddr), laddr, USER_PL, BX_READ); + bx_phy_address paddr = translate_linear(BX_TLB_ENTRY_OF(laddr, 0), laddr, USER_PL, BX_READ); #if BX_SUPPORT_SVM if (BX_CPU_THIS_PTR in_svm_guest) { Modified: trunk/bochs/cpu/stack.cc =================================================================== --- trunk/bochs/cpu/stack.cc 2015-09-21 20:07:51 UTC (rev 12835) +++ trunk/bochs/cpu/stack.cc 2015-09-22 20:10:22 UTC (rev 12836) @@ -108,7 +108,7 @@ } Bit64u lpf = LPFOf(laddr); - bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr); + bx_TLB_entry *tlbEntry = BX_TLB_ENTRY_OF(laddr, 0); if (tlbEntry->lpf == lpf) { // See if the TLB entry privilege level allows us write access from this CPL // Assuming that we always can read if write access is OK Modified: trunk/bochs/cpu/tasking.cc =================================================================== --- trunk/bochs/cpu/tasking.cc 2015-09-21 20:07:51 UTC (rev 12835) +++ trunk/bochs/cpu/tasking.cc 2015-09-22 20:10:22 UTC (rev 12836) @@ -196,8 +196,8 @@ // used in the task switch are paged in. if (BX_CPU_THIS_PTR cr0.get_PG()) { - translate_linear(BX_TLB_ENTRY_OF(nbase32), nbase32, 0, BX_READ); // old TSS - translate_linear(BX_TLB_ENTRY_OF(nbase32 + new_TSS_max), nbase32 + new_TSS_max, 0, BX_READ); + translate_linear(BX_TLB_ENTRY_OF(nbase32, 0), nbase32, 0, BX_READ); // old TSS + translate_linear(BX_TLB_ENTRY_OF(nbase32 + new_TSS_max, 0), nbase32 + new_TSS_max, 0, BX_READ); // ??? Humm, we check the new TSS region with READ above, // but sometimes we need to write the link field in that @@ -208,8 +208,8 @@ if (source == BX_TASK_FROM_CALL || source == BX_TASK_FROM_INT) { - translate_linear(BX_TLB_ENTRY_OF(nbase32), nbase32, 0, BX_WRITE); - translate_linear(BX_TLB_ENTRY_OF(nbase32 + 1), nbase32 + 1, 0, BX_WRITE); + translate_linear(BX_TLB_ENTRY_OF(nbase32, 0), nbase32, 0, BX_WRITE); + translate_linear(BX_TLB_ENTRY_OF(nbase32 + 1, 0), nbase32 + 1, 0, BX_WRITE); } } @@ -252,8 +252,8 @@ if (BX_CPU_THIS_PTR cr0.get_PG()) { Bit32u start = Bit32u(obase32 + 14), end = Bit32u(obase32 + 41); - translate_linear(BX_TLB_ENTRY_OF(start), start, 0, BX_WRITE); - translate_linear(BX_TLB_ENTRY_OF(end), end, 0, BX_WRITE); + translate_linear(BX_TLB_ENTRY_OF(start, 0), start, 0, BX_WRITE); + translate_linear(BX_TLB_ENTRY_OF(end, 0), end, 0, BX_WRITE); } system_write_word(Bit32u(obase32 + 14), IP); @@ -281,8 +281,8 @@ if (BX_CPU_THIS_PTR cr0.get_PG()) { Bit32u start = Bit32u(obase32 + 0x20), end = Bit32u(obase32 + 0x5d); - translate_linear(BX_TLB_ENTRY_OF(start), start, 0, BX_WRITE); - translate_linear(BX_TLB_ENTRY_OF(end), end, 0, BX_WRITE); + translate_linear(BX_TLB_ENTRY_OF(start, 0), start, 0, BX_WRITE); + translate_linear(BX_TLB_ENTRY_OF(end, 0), end, 0, BX_WRITE); } system_write_dword(Bit32u(obase32 + 0x20), EIP); Modified: trunk/bochs/cpu/tlb.h =================================================================== --- trunk/bochs/cpu/tlb.h 2015-09-21 20:07:51 UTC (rev 12835) +++ trunk/bochs/cpu/tlb.h 2015-09-22 20:10:22 UTC (rev 12836) @@ -93,6 +93,6 @@ return laddr & (LPF_MASK | alignment_mask); } -#define BX_TLB_ENTRY_OF(lpf) (&BX_CPU_THIS_PTR TLB.entry[BX_TLB_INDEX_OF((lpf), 0)]) +#define BX_TLB_ENTRY_OF(lpf, len) (&BX_CPU_THIS_PTR TLB.entry[BX_TLB_INDEX_OF((lpf), (len))]) #endif |