kernel/eka/nkern/arm/ncutils.cia
changeset 36 538db54a451d
parent 0 a41df078684a
child 144 c5e01f2a4bfd
equal deleted inserted replaced
34:f497542af8e4 36:538db54a451d
   362 	__CPOPRET(eq,"r2,r3,r4,");
   362 	__CPOPRET(eq,"r2,r3,r4,");
   363 
   363 
   364 	// set r2 = context id
   364 	// set r2 = context id
   365 	asm("ldrb	r4, [lr, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
   365 	asm("ldrb	r4, [lr, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
   366 	asm("mrs	r2, cpsr");
   366 	asm("mrs	r2, cpsr");
   367 	asm("and	r2, r2, #3");
   367 	asm("and	r2, r2, #0x0f");
   368 	asm("cmp	r2, #3");
   368 	asm("cmp	r2, #3");
       
   369 	asm("movhi	r2, #2");		// r2 = context ID => 1 for FIQ, 2 for IRQ/ABT/UND/SYS
   369 	asm("cmpeq	r4, #0");
   370 	asm("cmpeq	r4, #0");
   370 	asm("ldreq	r2, [lr, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
   371 	asm("ldreq	r2, [lr, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
   371 
   372 
   372 	asm("mov	lr, pc");
   373 	asm("mov	lr, pc");
   373 	asm("ldr	pc, [r12, #%a0]" : : "i" _FOFF(SBTraceData,iHandler));
   374 	asm("ldr	pc, [r12, #%a0]" : : "i" _FOFF(SBTraceData,iHandler));
   397 	asm("strlo	r2, [sp, #4]");		// replace aData with first word if aDataSize is 1-4
   398 	asm("strlo	r2, [sp, #4]");		// replace aData with first word if aDataSize is 1-4
   398 
   399 
   399 	// set r2 = context id
   400 	// set r2 = context id
   400 	asm("ldrb	r4, [lr, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
   401 	asm("ldrb	r4, [lr, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
   401 	asm("mrs	r2, cpsr");
   402 	asm("mrs	r2, cpsr");
   402 	asm("and	r2, r2, #3");
   403 	asm("and	r2, r2, #0x0f");
   403 	asm("cmp	r2, #3");
   404 	asm("cmp	r2, #3");
       
   405 	asm("movhi	r2, #2");		// r2 = context ID => 1 for FIQ, 2 for IRQ/ABT/UND/SYS
   404 	asm("cmpeq	r4, #0");
   406 	asm("cmpeq	r4, #0");
   405 	asm("ldreq	r2, [lr, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
   407 	asm("ldreq	r2, [lr, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
   406 
   408 
   407 	asm("mov	lr, pc");
   409 	asm("mov	lr, pc");
   408 	asm("ldr	pc, [r12, #%a0]" : : "i" _FOFF(SBTraceData,iHandler));
   410 	asm("ldr	pc, [r12, #%a0]" : : "i" _FOFF(SBTraceData,iHandler));
   421 
   423 
   422 	asm("ldr	r12, __TheScheduler");
   424 	asm("ldr	r12, __TheScheduler");
   423 	asm("stmdb	sp!, {lr}");
   425 	asm("stmdb	sp!, {lr}");
   424 	asm("ldrb	lr, [r12, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
   426 	asm("ldrb	lr, [r12, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
   425 	asm("mrs	r4, cpsr");
   427 	asm("mrs	r4, cpsr");
   426 	asm("and	r4, r4, #3");
   428 	asm("and	r4, r4, #0x0f");
   427 	asm("cmp	r4, #3");
   429 	asm("cmp	r4, #3");
       
   430 	asm("movhi	r4, #2");		// r4 = context ID => 1 for FIQ, 2 for IRQ/ABT/UND/SYS
   428 	asm("cmpeq	lr, #0");
   431 	asm("cmpeq	lr, #0");
   429 	asm("ldreq	r4, [r12, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
   432 	asm("ldreq	r4, [r12, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
   430 	asm("stmdb	sp!, {r4}");
   433 	asm("stmdb	sp!, {r4}");
   431 	asm("bl " CSM_ZN6BTrace8DoOutBigEmmPKvimm);
   434 	asm("bl " CSM_ZN6BTrace8DoOutBigEmmPKvimm);
   432 	asm("add	sp, sp, #8");
   435 	asm("add	sp, sp, #8");
   467 	asm("ldr	r12, __TheScheduler");
   470 	asm("ldr	r12, __TheScheduler");
   468 	asm("stmdb	sp!, {r4-r6,lr}");
   471 	asm("stmdb	sp!, {r4-r6,lr}");
   469 	asm("mrs	r2, cpsr");
   472 	asm("mrs	r2, cpsr");
   470 	// r2 = cpsr
   473 	// r2 = cpsr
   471 	asm("ldrb	lr, [r12, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
   474 	asm("ldrb	lr, [r12, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
   472 	asm("and	r4, r2, #3");
   475 	asm("and	r4, r2, #0x0f");
   473 	asm("cmp	r4, #3");
   476 	asm("cmp	r4, #3");
       
   477 	asm("movhi	r4, #2");		// r4 = context ID => 1 for FIQ, 2 for IRQ/ABT/UND/SYS
   474 	asm("cmpeq	lr, #0");
   478 	asm("cmpeq	lr, #0");
   475 	asm("ldreq	lr, [r12, #%a0]" : : "i" _FOFF(TScheduler,iKernCSLocked));
   479 	asm("ldreq	lr, [r12, #%a0]" : : "i" _FOFF(TScheduler,iKernCSLocked));
   476 	asm("ldreq	r4, [r12, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
   480 	asm("ldreq	r4, [r12, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
   477 	asm("cmpeq	lr, #0");
   481 	asm("cmpeq	lr, #0");
   478 	// r4 = context value for trace
   482 	// r4 = context value for trace
   522 	asm("mov	r0, r5");
   526 	asm("mov	r0, r5");
   523 	asm("9:");
   527 	asm("9:");
   524 	asm("mov	r2, r4"); // r2 = context id
   528 	asm("mov	r2, r4"); // r2 = context id
   525 	__POPRET("r4-r6,");
   529 	__POPRET("r4-r6,");
   526 	}
   530 	}
   527 
       
   528 
   531 
   529 __NAKED__ EXPORT_C TBool BTrace::OutFiltered(TUint32 a0, TUint32 a1, TUint32 a2, TUint32 a3)
   532 __NAKED__ EXPORT_C TBool BTrace::OutFiltered(TUint32 a0, TUint32 a1, TUint32 a2, TUint32 a3)
   530 	{
   533 	{
   531 	// fall through to OutFilteredX...
   534 	// fall through to OutFilteredX...
   532 	}
   535 	}