Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ept-devel/vmm/core/cpu_mmu_spt.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 24 by yuichi_xy, Mon Apr 23 13:57:52 2012 UTC revision 25 by yuichi_xy, Fri May 4 15:02:17 2012 UTC
# Line 33  Line 33 
33  /* MMU emulation, Shadow Page Tables (SPT) */  /* MMU emulation, Shadow Page Tables (SPT) */
34    
35  #include <common/list.h>  #include <common/list.h>
 #include <core/assert.h>  
36  #include <core/initfunc.h>  #include <core/initfunc.h>
37  #include <core/printf.h>  #include <core/printf.h>
38  #include <core/spinlock.h>  #include <core/spinlock.h>
# Line 45  Line 44 
44  #include "current.h"  #include "current.h"
45  #include "mm.h"  #include "mm.h"
46  #include "mmio.h"  #include "mmio.h"
47    #include "msr_pass.h"
48  #include "panic.h"  #include "panic.h"
49  #include "pcpu.h"  #include "pcpu.h"
50  #include "vmmcall_status.h"  #include "vmmcall_status.h"
# Line 224  init_vcpu(void) Line 224  init_vcpu(void)
224                  current->spt.spt_page[i].pte_virt = NULL;                  current->spt.spt_page[i].pte_virt = NULL;
225                  LIST2_ADD(current->spt.shadow_free, list, &current->spt.spt_page[i]);                  LIST2_ADD(current->spt.shadow_free, list, &current->spt.spt_page[i]);
226          }          }
         current->spt.initialized = true;  
227  }  }
228    
229  static bool  static bool
# Line 243  guest64 (void) Line 242  guest64 (void)
242  bool  bool
243  cpu_mmu_spt_tlbflush (void)  cpu_mmu_spt_tlbflush (void)
244  {  {
         if (current->spt.initialized == false) {  
                 return false;  
         }  
245          return spt_tlbflush ();          return spt_tlbflush ();
246  }  }
247    
# Line 253  cpu_mmu_spt_tlbflush (void) Line 249  cpu_mmu_spt_tlbflush (void)
249  void  void
250  cpu_mmu_spt_updatecr3 (void)  cpu_mmu_spt_updatecr3 (void)
251  {  {
         if (current->spt.initialized == false) {  
                 return;  
         }  
252          update_cr3 ();          update_cr3 ();
253  }  }
254    
# Line 264  cpu_mmu_spt_updatecr3 (void) Line 257  cpu_mmu_spt_updatecr3 (void)
257  void  void
258  cpu_mmu_spt_invalidate (ulong virtual_addr)  cpu_mmu_spt_invalidate (ulong virtual_addr)
259  {  {
         ASSERT(current->spt.initialized);  
   
260          invalidate_page (virtual_addr);          invalidate_page (virtual_addr);
261  }  }
262    
# Line 275  set_m1 (u64 entry0, bool write, bool use Line 266  set_m1 (u64 entry0, bool write, bool use
266          m1->write = write;          m1->write = write;
267          m1->user = user;          m1->user = user;
268          m1->wp = wp;          m1->wp = wp;
269          m1->cache_flag = current->msr.pte_to_cache_flag(entry0);          m1->cache_flag = msr_pte_to_cache_flag(entry0);
270  }  }
271    
272  static void  static void
# Line 333  cpu_mmu_spt_pagefault (ulong err, ulong Line 324  cpu_mmu_spt_pagefault (ulong err, ulong
324          u64 efer, gfns[5], entries[5];          u64 efer, gfns[5], entries[5];
325          phys_t hphys;          phys_t hphys;
326    
         ASSERT(current->spt.initialized);  
   
327          current->vmctl.read_control_reg(CONTROL_REG_CR0, &cr0);          current->vmctl.read_control_reg(CONTROL_REG_CR0, &cr0);
328          current->vmctl.read_control_reg(CONTROL_REG_CR3, &cr3);          current->vmctl.read_control_reg(CONTROL_REG_CR3, &cr3);
329          current->vmctl.read_control_reg(CONTROL_REG_CR4, &cr4);          current->vmctl.read_control_reg(CONTROL_REG_CR4, &cr4);

Legend:
Removed from v.24  
changed lines
  Added in v.25

SourceForge.JP is a Japanese version of SourceForge.net. For developments that are not related to Japan, we recommend you to use SourceForge.net.