Author: aandrejevic Date: Sun May 3 03:37:06 2015 New Revision: 67528
URL: http://svn.reactos.org/svn/reactos?rev=67528&view=rev Log: [FAST486] Properly check the limit for "expand down" segments.
Modified: trunk/reactos/lib/fast486/common.c
Modified: trunk/reactos/lib/fast486/common.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.c?rev=67... ============================================================================== --- trunk/reactos/lib/fast486/common.c [iso-8859-1] (original) +++ trunk/reactos/lib/fast486/common.c [iso-8859-1] Sun May 3 03:37:06 2015 @@ -47,11 +47,23 @@ /* Get the cached descriptor */ CachedDescriptor = &State->SegmentRegs[SegmentReg];
- if ((Offset + Size - 1) > CachedDescriptor->Limit) - { - /* Read beyond limit */ - Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + if (InstFetch || !CachedDescriptor->DirConf) + { + if ((Offset + Size - 1) > CachedDescriptor->Limit) + { + /* Read beyond limit */ + Fast486Exception(State, FAST486_EXCEPTION_GP); + return FALSE; + } + } + else + { + if (Offset < CachedDescriptor->Limit) + { + /* Read beyond limit */ + Fast486Exception(State, FAST486_EXCEPTION_GP); + return FALSE; + } }
/* Check for protected mode */ @@ -157,11 +169,23 @@ /* Get the cached descriptor */ CachedDescriptor = &State->SegmentRegs[SegmentReg];
- if ((Offset + Size - 1) > CachedDescriptor->Limit) - { - /* Write beyond limit */ - Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + if (!CachedDescriptor->DirConf) + { + if ((Offset + Size - 1) > CachedDescriptor->Limit) + { + /* Write beyond limit */ + Fast486Exception(State, FAST486_EXCEPTION_GP); + return FALSE; + } + } + else + { + if (Offset < CachedDescriptor->Limit) + { + /* Read beyond limit */ + Fast486Exception(State, FAST486_EXCEPTION_GP); + return FALSE; + } }
/* Check for protected mode */