Changeset 437 for trunk/kernel/mm/ppm.c
- Timestamp:
- Mar 28, 2018, 2:40:29 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/ppm.c
r433 r437 54 54 55 55 cxy_t page_cxy = GET_CXY( page_xp ); 56 page_t * page_ptr = (page_t *)GET_PTR( page_xp );56 page_t * page_ptr = GET_PTR( page_xp ); 57 57 58 58 void * base_ptr = ppm->vaddr_base + … … 69 69 70 70 cxy_t base_cxy = GET_CXY( base_xp ); 71 void * base_ptr = (void *)GET_PTR( base_xp );71 void * base_ptr = GET_PTR( base_xp ); 72 72 73 73 page_t * page_ptr = ppm->pages_tbl + … … 86 86 87 87 cxy_t page_cxy = GET_CXY( page_xp ); 88 page_t * page_ptr = (page_t *)GET_PTR( page_xp );88 page_t * page_ptr = GET_PTR( page_xp ); 89 89 90 90 paddr_t paddr = PADDR( page_cxy , (page_ptr - ppm->pages_tbl)<<CONFIG_PPM_PAGE_SHIFT ); 91 91 92 return paddr >> CONFIG_PPM_PAGE_SHIFT;92 return (ppn_t)(paddr >> CONFIG_PPM_PAGE_SHIFT); 93 93 94 94 } // end hal_page2ppn() … … 97 97 inline xptr_t ppm_ppn2page( ppn_t ppn ) 98 98 { 99 ppm_t * ppm= &LOCAL_CLUSTER->ppm;100 101 paddr_t paddr = ppn<< CONFIG_PPM_PAGE_SHIFT;102 103 cxy_t page_cxy= CXY_FROM_PADDR( paddr );104 lpa_t page_lpa= LPA_FROM_PADDR( paddr );105 106 return XPTR( page_cxy , &ppm->pages_tbl[page_lpa>>CONFIG_PPM_PAGE_SHIFT] );99 ppm_t * ppm = &LOCAL_CLUSTER->ppm; 100 101 paddr_t paddr = ((paddr_t)ppn) << CONFIG_PPM_PAGE_SHIFT; 102 103 cxy_t cxy = CXY_FROM_PADDR( paddr ); 104 lpa_t lpa = LPA_FROM_PADDR( paddr ); 105 106 return XPTR( cxy , &ppm->pages_tbl[lpa>>CONFIG_PPM_PAGE_SHIFT] ); 107 107 108 108 } // end hal_ppn2page … … 113 113 inline xptr_t ppm_ppn2base( ppn_t ppn ) 114 114 { 115 ppm_t * ppm 115 ppm_t * ppm = &LOCAL_CLUSTER->ppm; 116 116 117 paddr_t paddr = ppn << CONFIG_PPM_PAGE_SHIFT; 118 119 cxy_t page_cxy = CXY_FROM_PADDR( paddr ); 120 lpa_t page_lpa = LPA_FROM_PADDR( paddr ); 121 122 void * base_ptr = (void *)ppm->vaddr_base + (page_lpa & ~CONFIG_PPM_PAGE_SHIFT); 123 124 return XPTR( page_cxy , base_ptr ); 117 paddr_t paddr = ((paddr_t)ppn) << CONFIG_PPM_PAGE_SHIFT; 118 119 cxy_t cxy = CXY_FROM_PADDR( paddr ); 120 lpa_t lpa = LPA_FROM_PADDR( paddr ); 121 122 return XPTR( cxy , (void *)ppm->vaddr_base + lpa ); 125 123 126 124 } // end ppm_ppn2base() … … 132 130 133 131 cxy_t base_cxy = GET_CXY( base_xp ); 134 void * base_ptr = (void *)GET_PTR( base_xp );132 void * base_ptr = GET_PTR( base_xp ); 135 133 136 134 paddr_t paddr = PADDR( base_cxy , (base_ptr - ppm->vaddr_base) ); 137 135 138 return paddr >> CONFIG_PPM_PAGE_SHIFT;136 return (ppn_t)(paddr >> CONFIG_PPM_PAGE_SHIFT); 139 137 140 138 } // end ppm_base2ppn()
Note: See TracChangeset
for help on using the changeset viewer.