# page_fault.S

Go to the documentation of this file.

    00001 /*****************************************************************************************
    00002  Copyright (c) 2002-2004 The UbixOS Project
    00003  All rights reserved.
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are
    00006  permitted provided that the following conditions are met:
    00007
    00008  Redistributions of source code must retain the above copyright notice, this list of
    00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
    00010  form must reproduce the above copyright notice, this list of conditions, the following
    00011  disclaimer and the list of authors in the documentation and/or other materials provided
    00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
    00013  contributors may be used to endorse or promote products derived from this software
    00014  without specific prior written permission.
    00015
    00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00025
    00026  $Id: page__fault_8S-source.html 88 2016-01-12 00:11:29Z reddawg $
    00027
    00028 *****************************************************************************************/
    00029
    00030 /*
    00031    Page fault wrapper this will aquire some values we need for later use
    00032  */
    00033
    00034 .globl _vmm_pageFault
    00035 .text
    00036 .code32
    00037 _vmm_pageFault:
    00038   xchgl %eax,(%esp)   /* Save EAX                                         */
    00039   movl  4(%esp),%eax  /* Move EIP into EAX to use later                   */
    00040   pushl %ebx          /* Save EBX                                         */
    00041   movl  20(%esp),%ebx /* Save ESP for ring 3 to use later                 */
    00042   pushl %ecx          /* Save ECX,EDX                                     */
    00043   pushl %edx
    00044   push  %ebx          /* Push ESP                                         */
    00045   push  %eax          /* Push EIP                                         */
    00046   movl  %cr2,%eax     /* Push the faulted address                         */
    00047   pushl %eax
    00048   sti                 /* Turn interrupts back on we are now entrant safe  */
    00049   call  vmm_pageFault /* Call our page fault handler                      */
    00050   addl  $0xC,%esp     /* Adjust the stack to compensate for pushed values */
    00051   popl  %edx          /* Restore EAX,EBX,ECX,EDX                          */
    00052   popl  %ecx
    00053   popl  %ebx
    00054   popl  %eax
    00055   iret                /* Return from the interrupt                        */
    00056
    00057
    00058 /***
    00059  END
    00060  ***/