From 8389b692ea732288f4882385fdf2112a344263b0 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Mon, 11 Nov 2013 15:27:54 +0000 Subject: [PATCH] [FAST486] Fix Fast486GetCurrentPrivLevel. svn path=/branches/ntvdm/; revision=60939 --- lib/fast486/common.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/fast486/common.h b/lib/fast486/common.h index 39c629da619..a6c05f1249c 100644 --- a/lib/fast486/common.h +++ b/lib/fast486/common.h @@ -167,7 +167,16 @@ Fast486ExceptionWithErrorCode INT Fast486GetCurrentPrivLevel(PFAST486_STATE State) { - return GET_SEGMENT_RPL(State->SegmentRegs[FAST486_REG_CS].Selector); + if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE) + { + /* In protected mode, return the RPL of the CS */ + return GET_SEGMENT_RPL(State->SegmentRegs[FAST486_REG_CS].Selector); + } + else + { + /* Real mode is always in supervisor mode */ + return 0; + } } #include "common.inl"