Changeset 315 for trunk/kernel/mm/vmm.c
- Timestamp:
- Aug 3, 2017, 10:15:18 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.c
r313 r315 524 524 525 525 // initialize vseg descriptor 526 vseg_init( vseg , base, size , vpn_base , vpn_size , type , local_cxy , 0 , 0);526 vseg_init( vseg , base, size , vpn_base , vpn_size , type , local_cxy ); 527 527 528 528 // update "heap_vseg" in VMM … … 633 633 634 634 // set page table entry 635 ppn = ppm_page2ppn( page);635 ppn = ppm_page2ppn( XPTR( local_cxy , page ) ); 636 636 error = hal_gpt_set_pte( gpt , vpn , ppn , attr ); 637 637 if( error ) … … 752 752 uint32_t type = vseg->type; 753 753 xptr_t mapper_xp = vseg->mapper_xp; 754 uint32_t flags = vseg->flags; 754 755 755 756 // get mapper cluster and local pointer … … 816 817 817 818 // compute missing page offset in .elf file 818 intptr_t page_offset = vseg->file_offset + (page_index << PPM_PAGE_SHIFT); 819 820 // compute both local and extended pointer on page first byte 821 // WARNING : the pages_offset must have the same value in all clusters !!! 822 // to use this ppm_page2vaddr() function for a remote cluster 823 uint8_t * base_ptr = (uint8_t *)ppm_page2vaddr( page_ptr ); 824 xptr_t base_xp = XPTR( page_cxy , base_ptr ); 819 intptr_t page_offset = vseg->file_offset + 820 (page_index << CONFIG_PPM_PAGE_SHIFT); 821 822 // compute extended pointer on page first byte 823 xptr_t base_xp = ppm_page2base( XPTR( page_cxy , page_ptr ) ); 825 824 826 825 // file_size can be smaller than vseg_size for BSS 827 file_size = vseg->file_size;828 829 if( file_size < page_offset ) // pagefully in BSS826 intptr_t file_size = vseg->file_size; 827 828 if( file_size < page_offset ) // fully in BSS 830 829 { 831 830 if( page_cxy == local_cxy ) 832 831 { 833 memset( base_ptr , 0 ,PPM_PAGE_SIZE );832 memset( GET_PTR( base_xp ) , 0 , CONFIG_PPM_PAGE_SIZE ); 834 833 } 835 834 else 836 835 { 837 hal_remote_memset( base_xp , 0 , PPM_PAGE_SIZE );836 hal_remote_memset( base_xp , 0 , CONFIG_PPM_PAGE_SIZE ); 838 837 } 839 838 } 840 else if( file size >= (page_offset + PPM_PAGE_SIZE) ) // pagefully in mapper841 839 else if( file_size >= (page_offset + CONFIG_PPM_PAGE_SIZE) ) // fully in mapper 840 { 842 841 if( mapper_cxy == local_cxy ) 843 842 { … … 846 845 page_offset, 847 846 base_xp, 848 PPM_PAGE_SIZE );847 CONFIG_PPM_PAGE_SIZE ); 849 848 } 850 849 else … … 856 855 page_offset, 857 856 (uint64_t)base_xp, 858 PPM_PAGE_SIZE,857 CONFIG_PPM_PAGE_SIZE, 859 858 &error ); 860 859 } … … 865 864 { 866 865 // initialize mapper part 867 if( mapper_cxy == local_cxy ) // mapper is local866 if( mapper_cxy == local_cxy ) 868 867 { 869 868 error = mapper_move_kernel( mapper_ptr, 870 true, // to _buffer869 true, // to buffer 871 870 page_offset, 872 871 base_xp, 873 872 file_size - page_offset ); 874 873 } 875 else // mapper is remote874 else 876 875 { 877 876 rpc_mapper_move_buffer_client( mapper_cxy, 878 877 mapper_ptr, 879 true, 878 true, // to buffer 880 879 false, // kernel buffer 881 880 page_offset, … … 889 888 if( page_cxy == local_cxy ) 890 889 { 891 memset( base_ptr+ file_size - page_offset , 0 ,892 page_offset + PPM_PAGE_SIZE - file_size );890 memset( GET_PTR( base_xp ) + file_size - page_offset , 0 , 891 page_offset + CONFIG_PPM_PAGE_SIZE - file_size ); 893 892 } 894 893 else 895 894 { 896 895 hal_remote_memset( base_xp + file_size - page_offset , 0 , 897 page_offset + PPM_PAGE_SIZE - file_size );896 page_offset + CONFIG_PPM_PAGE_SIZE - file_size ); 898 897 } 899 898 } … … 902 901 903 902 // return ppn 904 *ppn = hal_page2ppn( XPTR( page_cxy , page_ptr ) );903 *ppn = ppm_page2ppn( XPTR( page_cxy , page_ptr ) ); 905 904 return 0; 906 905 … … 1064 1063 return error; 1065 1064 1066 } 1067 /* 1065 } // end vmm_v2p_translate() 1066 1067 /* deprecated 1068 1068 1069 1069 ///////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.