Changeset 301 for soft/giet_vm
- Timestamp:
- Apr 14, 2014, 6:44:51 PM (11 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_common/utils.c
r295 r301 257 257 : "=r"(sr) 258 258 : 259 : "$3" );259 : "$3", "memory" ); 260 260 *save_sr_ptr = sr; 261 261 } … … 269 269 "or $3, $3, $4 \n" 270 270 "mtc0 $3, $12 \n" 271 ::: "$3", "$4" );271 ::: "$3", "$4", "memory" ); 272 272 } 273 273 … … 280 280 asm volatile( "mtc0 %0, $12 \n" 281 281 : 282 : "r"(sr) ); 282 : "r"(sr) 283 : "memory" ); 283 284 } 284 285 … … 325 326 unsigned int lsb = (unsigned int) paddr; 326 327 unsigned int msb = (unsigned int) (paddr >> 32); 327 328 unsigned int sr; 329 330 _it_disable(&sr); 328 331 asm volatile( 329 "li $3, 0xFFFFFFFE \n"330 "mfc0 $2, $12 \n"331 "and $3, $2, $3 \n"332 "mtc0 $3, $12 \n" /* IRQ disabled */333 334 332 "mfc2 $2, $1 \n" /* $2 <= MMU_MODE */ 335 333 "andi $3, $2, 0xb \n" … … 341 339 342 340 "mtc2 $2, $1 \n" /* restore MMU_MODE */ 343 344 "li $3, 0x00000001 \n"345 "mfc0 $2, $12 \n"346 "or $3, $3, $2 \n"347 "mtc0 $3, $12 \n" /* IRQ enabled */348 341 : "=r" (value) 349 342 : "r" (lsb), "r" (msb) 350 343 : "$2", "$3"); 344 _it_restore(&sr); 351 345 return value; 352 346 } … … 360 354 unsigned int lsb = (unsigned int)paddr; 361 355 unsigned int msb = (unsigned int)(paddr >> 32); 362 356 unsigned int sr; 357 358 _it_disable(&sr); 363 359 asm volatile( 364 "li $3, 0xFFFFFFFE \n"365 "mfc0 $2, $12 \n"366 "and $3, $2, $3 \n"367 "mtc0 $3, $12 \n" /* IRQ disabled */368 369 360 "mfc2 $2, $1 \n" /* $2 <= MMU_MODE */ 370 361 "andi $3, $2, 0xb \n" … … 376 367 377 368 "mtc2 $2, $1 \n" /* restore MMU_MODE */ 378 379 "li $3, 0x00000001 \n"380 "mfc0 $2, $12 \n"381 "or $3, $3, $2 \n"382 "mtc0 $3, $12 \n" /* IRQ enabled */383 369 : 384 370 : "r" (value), "r" (lsb), "r" (msb) 385 371 : "$2", "$3"); 372 _it_restore(&sr); 386 373 } 387 374 -
soft/giet_vm/giet_kernel/giet.s
r267 r301 56 56 _sys_handler: 57 57 addiu $29, $29, -24 /* 2 slots for SR&EPC, 4 slots for args passing */ 58 mfc0 $26, $12 /* load SR */59 sw $26, 16($29) /* save it in the stack */60 58 mfc0 $27, $14 /* load EPC */ 61 59 addiu $27, $27, 4 /* increment EPC for return address */ … … 73 71 mtc0 $26, $12 /* interrupt enabled */ 74 72 jalr $3 /* jump to the proper syscall */ 75 mtc0 $0, $12 /* interrupt disbled */76 73 77 lw $26, 16($29) /* load SR from stack */ 78 mtc0 $26, $12 /* restore SR */ 74 mfc0 $26, $12 /* load SR */ 75 ori $26, $26, 0x2 /* set EXL bit */ 76 mtc0 $26, $12 77 79 78 lw $26, 20($29) /* load EPC from stack */ 80 79 mtc0 $26, $14 /* restore EPC */ 81 addiu $29, $29, 24/* restore stack pointer */80 addiu $29, $29, 24 /* restore stack pointer */ 82 81 eret /* exit GIET */ 83 82 -
soft/giet_vm/giet_kernel/switch.s
r263 r301 2 2 * This function receives two arguments that are the current task context 3 3 * (virtual) addresses and the next task context (virtual) address. 4 * 5 * This function should be called in a critical section 4 6 * 5 7 * TODO (AG) Il semble possible de limiter le nombre de registres à sauver: … … 18 20 19 21 _task_switch: 20 21 /* enter critical section */22 li $2, 0xFFFFFFFE23 mfc0 $3, $1224 and $3, $3, $225 mtc0 $3, $1226 22 27 23 /* save _current task context */ … … 123 119 mtc2 $26, $0 /* restore PTPR */ 124 120 125 /* exit critical section */126 li $2, 0x00000001127 mfc0 $3, $12128 or $3, $3, $2129 mtc0 $3, $12130 131 121 /* returns to caller */ 132 122 jr $31 -
soft/giet_vm/giet_kernel/sys_handler.c
r294 r301 55 55 &_sys_ukn, /* 0x17 */ 56 56 &_sys_ukn, /* 0x18 */ 57 &_c tx_switch,/* 0x19 */57 &_context_switch, /* 0x19 */ 58 58 &_vobj_get_vbase, /* 0x1A */ 59 59 &_sys_ukn, /* 0x1B */
Note: See TracChangeset
for help on using the changeset viewer.