File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed
Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 1515#include " divtlb.h"
1616
1717#include " i386dasm.h"
18+ #include < algorithm>
1819
1920#define INPUT_LINE_A20 1
2021#define INPUT_LINE_SMI 2
Original file line number Diff line number Diff line change @@ -3260,14 +3260,18 @@ void i386_device::i386_group0F00_16() // Opcode 0x0f 00
32603260 { // check if conforming, these are always readable, regardless of privilege
32613261 if (!(seg.flags & 0x04 ))
32623262 {
3263- // if not conforming, then we must check privilege levels (TODO: current privilege level check)
3264- if (((seg.flags >> 5 ) & 0x03 ) < ( address & 0x03 ))
3263+ // if not conforming, then we must check privilege levels
3264+ if (((seg.flags >> 5 ) & 0x03 ) < std::max (m_CPL, ( uint8_t )( address & 0x03 ) ))
32653265 result = 0 ;
32663266 }
32673267 }
32683268 }
3269+ else
3270+ {
3271+ if (((seg.flags >> 5 ) & 0x03 ) < std::max (m_CPL, (uint8_t )(address & 0x03 )))
3272+ result = 0 ;
3273+ }
32693274 }
3270- // check that the descriptor privilege is greater or equal to the selector's privilege level and the current privilege (TODO)
32713275 SetZF (result);
32723276 }
32733277 else
@@ -3308,8 +3312,7 @@ void i386_device::i386_group0F00_16() // Opcode 0x0f 00
33083312 result = 0 ;
33093313 }
33103314 }
3311- // check that the descriptor privilege is greater or equal to the selector's privilege level and the current privilege (TODO)
3312- if (((seg.flags >> 5 ) & 0x03 ) < (address & 0x03 ))
3315+ if (((seg.flags >> 5 ) & 0x03 ) < std::max (m_CPL, (uint8_t )(address & 0x03 )))
33133316 result = 0 ;
33143317 SetZF (result);
33153318 }
Original file line number Diff line number Diff line change @@ -3061,14 +3061,18 @@ void i386_device::i386_group0F00_32() // Opcode 0x0f 00
30613061 { // check if conforming, these are always readable, regardless of privilege
30623062 if (!(seg.flags & 0x04 ))
30633063 {
3064- // if not conforming, then we must check privilege levels (TODO: current privilege level check)
3065- if (((seg.flags >> 5 ) & 0x03 ) < ( address & 0x03 ))
3064+ // if not conforming, then we must check privilege levels
3065+ if (((seg.flags >> 5 ) & 0x03 ) < std::max (m_CPL, ( uint8_t )( address & 0x03 ) ))
30663066 result = 0 ;
30673067 }
30683068 }
30693069 }
3070+ else
3071+ {
3072+ if (((seg.flags >> 5 ) & 0x03 ) < std::max (m_CPL, (uint8_t )(address & 0x03 )))
3073+ result = 0 ;
3074+ }
30703075 }
3071- // check that the descriptor privilege is greater or equal to the selector's privilege level and the current privilege (TODO)
30723076 SetZF (result);
30733077 }
30743078 else
@@ -3108,8 +3112,7 @@ void i386_device::i386_group0F00_32() // Opcode 0x0f 00
31083112 result = 0 ;
31093113 }
31103114 }
3111- // check that the descriptor privilege is greater or equal to the selector's privilege level and the current privilege (TODO)
3112- if (((seg.flags >> 5 ) & 0x03 ) < (address & 0x03 ))
3115+ if (((seg.flags >> 5 ) & 0x03 ) < std::max (m_CPL, (uint8_t )(address & 0x03 )))
31133116 result = 0 ;
31143117 SetZF (result);
31153118 }
You can’t perform that action at this time.
0 commit comments