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 15
15
#include " divtlb.h"
16
16
17
17
#include " i386dasm.h"
18
+ #include < algorithm>
18
19
19
20
#define INPUT_LINE_A20 1
20
21
#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
3260
3260
{ // check if conforming, these are always readable, regardless of privilege
3261
3261
if (!(seg.flags & 0x04 ))
3262
3262
{
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 ) ))
3265
3265
result = 0 ;
3266
3266
}
3267
3267
}
3268
3268
}
3269
+ else
3270
+ {
3271
+ if (((seg.flags >> 5 ) & 0x03 ) < std::max (m_CPL, (uint8_t )(address & 0x03 )))
3272
+ result = 0 ;
3273
+ }
3269
3274
}
3270
- // check that the descriptor privilege is greater or equal to the selector's privilege level and the current privilege (TODO)
3271
3275
SetZF (result);
3272
3276
}
3273
3277
else
@@ -3308,8 +3312,7 @@ void i386_device::i386_group0F00_16() // Opcode 0x0f 00
3308
3312
result = 0 ;
3309
3313
}
3310
3314
}
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 )))
3313
3316
result = 0 ;
3314
3317
SetZF (result);
3315
3318
}
Original file line number Diff line number Diff line change @@ -3061,14 +3061,18 @@ void i386_device::i386_group0F00_32() // Opcode 0x0f 00
3061
3061
{ // check if conforming, these are always readable, regardless of privilege
3062
3062
if (!(seg.flags & 0x04 ))
3063
3063
{
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 ) ))
3066
3066
result = 0 ;
3067
3067
}
3068
3068
}
3069
3069
}
3070
+ else
3071
+ {
3072
+ if (((seg.flags >> 5 ) & 0x03 ) < std::max (m_CPL, (uint8_t )(address & 0x03 )))
3073
+ result = 0 ;
3074
+ }
3070
3075
}
3071
- // check that the descriptor privilege is greater or equal to the selector's privilege level and the current privilege (TODO)
3072
3076
SetZF (result);
3073
3077
}
3074
3078
else
@@ -3108,8 +3112,7 @@ void i386_device::i386_group0F00_32() // Opcode 0x0f 00
3108
3112
result = 0 ;
3109
3113
}
3110
3114
}
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 )))
3113
3116
result = 0 ;
3114
3117
SetZF (result);
3115
3118
}
You can’t perform that action at this time.
0 commit comments