Changeset 313 for trunk/hal/tsar_mips32/core
- Timestamp:
- Aug 2, 2017, 3:24:57 PM (7 years ago)
- Location:
- trunk/hal/tsar_mips32/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/core/hal_ppm.c
r296 r313 35 35 36 36 ////////////////////////////////////////////////////////////////////////////////////////// 37 // This file contains the TSAR specific code for cores registers, 38 // and for physical memory allocators initialisation in a given cluster. 39 37 // This file contains the TSAR specific code for : 38 // - cores registers initialisation, 39 // - memory allocators initialisation. 40 // 40 41 // For The TSAR architecture, the kernel pointers are identity mapped: 41 42 // - the 32 bits PTR value is identical to the 32 bits LPA value, … … 133 134 134 135 } // end hal_core_init() 136 137 /////////////////////////////////////////// 138 inline ppn_t hal_page2ppn( xptr_t page_xp ) 139 { 140 ppm_t * ppm = &LOCAL_CLUSTER->ppm; 141 142 cxy_t page_cxy = GET_CXY( page_xp ); 143 page_t * page_ptr = (page_t *)GET_PTR( page_xp ); 144 145 return (ppn_t)(page_ptr - ppm->pages_tbl) | (ppn_t)(page_cxy << 20); 146 147 } // end hal_page2ppn() 148 149 //////////////////////////////////////// 150 inline xptr_t hal_ppn2page( ppn_t ppn ) 151 { 152 ppm_t * ppm = &LOCAL_CLUSTER->ppm; 153 154 cxy_t page_cxy = (ppn & 0xFFF00000) >> 20; 155 page_t * page_ptr = &ppm->pages_tbl[ppn & 0x000FFFFF]; 156 157 return XPTR( page_xy , page_ptr ); 158 159 } // end hal_ppn2page 160 161 -
trunk/hal/tsar_mips32/core/hal_remote.c
r296 r313 447 447 448 448 } // end hal_remote_strcpy() 449 450 //////////////////////////////////////// 451 void hal_remote_memset( xptr_t buf_xp, 452 uint8_t byte, 453 uint32_t size ) 454 { 455 uint32_t save_sr; 456 uint32_t i; 457 uint32_t wsize; 458 uint32_t buf_ptr = (uint32_t)GET_PTR( buf_xp ); 459 uint32_t buf_cxy = (uint32_t)GET_CXY( buf_xp ); 460 uint32_t word = ((uint32_t)byte)<<24 | 461 ((uint32_t)byte)<<16 | 462 ((uint32_t)byte)<<8 | 463 ((uint32_t)byte) ; 464 465 hal_disable_irq( &save_sr ); 466 467 if( (buf_ptr & 0x3) ) wsize = 0; // do it all in bytes 468 else wsize = size >> 2; 469 470 for( i = 0 ; i < wsize ; i++ ) // transfer one word per iteration 471 { 472 asm volatile( 473 ".set noreorder \n" 474 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 475 "mtc2 %0, $24 \n" /* PADDR_EXT <= buf_cxy */ 476 "sw %2, 0(%1) \n" /* set one word */ 477 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 478 ".set reorder \n" 479 : : "r"(buf_cxy), "r" (buf_ptr+(i<<2)), "r"(byte) : "$15" ); 480 } 481 482 for( i = wsize << 2 ; i < size ; i++ ) // transfer one byte per iteration 483 { 484 asm volatile( 485 ".set noreorder \n" 486 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 487 "mtc2 %0, $24 \n" /* PADDR_EXT <= buf_cxy */ 488 "sb %2, 0(%1) \n" /* set one byte */ 489 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 490 ".set reorder \n" 491 : : "r"(buf_cxy), "r"(buf_ptr+i), "r"(word) : "$15" ); 492 } 493 494 hal_restore_irq( save_sr ); 495 496 } // end hal_remote_memset() 497
Note: See TracChangeset
for help on using the changeset viewer.