Author: aandrejevic
Date: Fri Nov  7 00:00:17 2014
New Revision: 65304

URL: http://svn.reactos.org/svn/reactos?rev=65304&view=rev
Log:
[FAST486]
Store the faulting address in CR2 (PFLA) when a page fault occurs.


Modified:
    trunk/reactos/lib/fast486/common.inl

Modified: trunk/reactos/lib/fast486/common.inl
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.inl?rev=65304&r1=65303&r2=65304&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/common.inl        [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/common.inl        [iso-8859-1] Fri Nov  7 
00:00:17 2014
@@ -170,21 +170,23 @@
             /* Get the table entry */
             TableEntry.Value = Fast486GetPageTableEntry(State, Page, FALSE);
 
+            /* Check if this is the first page */
+            if (Page == PAGE_ALIGN(LinearAddress))
+            {
+                /* Start reading from the offset from the beginning of the 
page */
+                PageOffset = PAGE_OFFSET(LinearAddress);
+                PageLength -= PageOffset;
+            }
+
             if (!TableEntry.Present || (!TableEntry.Usermode && (Cpl > 0)))
             {
+                State->ControlRegisters[FAST486_REG_CR2] = Page + PageOffset;
+
                 /* Exception */
                 Fast486ExceptionWithErrorCode(State,
                                               FAST486_EXCEPTION_PF,
                                               TableEntry.Present | (State->Cpl 
? 0x04 : 0));
                 return FALSE;
-            }
-
-            /* Check if this is the first page */
-            if (Page == PAGE_ALIGN(LinearAddress))
-            {
-                /* Start reading from the offset from the beginning of the 
page */
-                PageOffset = PAGE_OFFSET(LinearAddress);
-                PageLength -= PageOffset;
             }
 
             /* Check if this is the last page */
@@ -237,23 +239,25 @@
             /* Get the table entry */
             TableEntry.Value = Fast486GetPageTableEntry(State, Page, TRUE);
 
+            /* Check if this is the first page */
+            if (Page == PAGE_ALIGN(LinearAddress))
+            {
+                /* Start writing from the offset from the beginning of the 
page */
+                PageOffset = PAGE_OFFSET(LinearAddress);
+                PageLength -= PageOffset;
+            }
+
             if ((!TableEntry.Present || (!TableEntry.Usermode && (Cpl > 0)))
                 || ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_WP)
                 && !TableEntry.Writeable))
             {
+                State->ControlRegisters[FAST486_REG_CR2] = Page + PageOffset;
+
                 /* Exception */
                 Fast486ExceptionWithErrorCode(State,
                                               FAST486_EXCEPTION_PF,
                                               TableEntry.Present | 0x02 | 
(State->Cpl ? 0x04 : 0));
                 return FALSE;
-            }
-
-            /* Check if this is the first page */
-            if (Page == PAGE_ALIGN(LinearAddress))
-            {
-                /* Start writing from the offset from the beginning of the 
page */
-                PageOffset = PAGE_OFFSET(LinearAddress);
-                PageLength -= PageOffset;
             }
 
             /* Check if this is the last page */


Reply via email to