@@ -14,10 +14,10 @@ use x86::bits64::paging::*;
1414use x86:: controlregs:: Cr0 ;
1515
1616#[ repr( align( 4096 ) ) ]
17- pub struct Raw4kPage ( pub [ u8 ; 4096 ] ) ;
17+ pub struct Raw4kPage ( pub [ u8 ; BASE_PAGE_SIZE ] ) ;
1818impl Default for Raw4kPage {
1919 fn default ( ) -> Self {
20- Raw4kPage ( [ 0u8 ; 4096 ] )
20+ Raw4kPage ( [ 0u8 ; BASE_PAGE_SIZE ] )
2121 }
2222}
2323
@@ -221,7 +221,7 @@ impl fmt::Debug for HostPhysAddr {
221221#[ derive( PartialEq , Eq , PartialOrd , Ord , Copy , Clone , Debug ) ]
222222pub struct HostPhysFrame ( HostPhysAddr ) ;
223223impl HostPhysFrame {
224- pub const SIZE : usize = 4096 ;
224+ pub const SIZE : usize = BASE_PAGE_SIZE ;
225225
226226 pub fn from_start_address ( addr : HostPhysAddr ) -> Result < Self > {
227227 if !addr. is_frame_aligned ( ) {
@@ -391,7 +391,7 @@ impl GuestAddressSpace {
391391 addr : GuestVirtAddr ,
392392 access : GuestAccess ,
393393 ) -> Result < FrameIter > {
394- //TODO: align the addr to 4096 boundary
394+ //TODO: align the addr to BASE_PAGE_SIZE boundary
395395 Ok ( FrameIter {
396396 view : GuestAddressSpaceView :: new ( cr3, self ) ,
397397 addr : addr,
@@ -561,7 +561,7 @@ impl<'a> Iterator for FrameIter<'a> {
561561
562562 // This is the smallest possible guest page size, so permissions
563563 // can't change except at this granularity
564- self . addr = self . addr + 4096 ;
564+ self . addr = self . addr + BASE_PAGE_SIZE ;
565565
566566 let physaddr =
567567 match self . view . translate_linear_address ( old, self . access ) {
@@ -574,15 +574,15 @@ impl<'a> Iterator for FrameIter<'a> {
574574
575575#[ repr( align( 4096 ) ) ]
576576pub struct EptTable < T > {
577- entries : [ T ; 512 ] ,
577+ entries : [ T ; PAGE_SIZE_ENTRIES ] ,
578578}
579579impl < T > Default for EptTable < T >
580580where
581581 T : Copy + Default ,
582582{
583583 fn default ( ) -> Self {
584584 Self {
585- entries : [ T :: default ( ) ; 512 ] ,
585+ entries : [ T :: default ( ) ; PAGE_SIZE_ENTRIES ] ,
586586 }
587587 }
588588}
0 commit comments