branch | RCL_3 |
changeset 257 | 3e88ff8f41d5 |
parent 256 | c1f20ce4abcf |
256:c1f20ce4abcf | 257:3e88ff8f41d5 |
---|---|
196 |
196 |
197 //#define __MINIMUM_MACHINE_CODE__ |
197 //#define __MINIMUM_MACHINE_CODE__ |
198 |
198 |
199 #if defined(__WINS__) |
199 #if defined(__WINS__) |
200 #define __NAKED__ __declspec( naked ) |
200 #define __NAKED__ __declspec( naked ) |
201 #if !defined(__MINIMUM_MACHINE_CODE__) && defined(__KERNEL_MODE__) |
201 #ifndef __MINIMUM_MACHINE_CODE__ |
202 // Assembly language memmove() and memcpy() are used for WINS but only in the kernel, not euser |
202 //#define __MEM_MACHINE_CODED__ |
203 #define __MEMMOVE_MACHINE_CODED__ |
|
204 #endif |
203 #endif |
205 #define __CPU_X86 |
204 #define __CPU_X86 |
206 #endif |
205 #endif |
207 |
206 |
208 #if defined(__X86__) |
207 #if defined(__X86__) |
367 #else |
366 #else |
368 #define __SWITCH_TO_ARM |
367 #define __SWITCH_TO_ARM |
369 #define __END_ARM |
368 #define __END_ARM |
370 #endif |
369 #endif |
371 |
370 |
372 #define CC_EQ 0U |
371 #define CC_EQ 0 |
373 #define CC_NE 1U |
372 #define CC_NE 1 |
374 #define CC_CS 2U |
373 #define CC_CS 2 |
375 #define CC_CC 3U |
374 #define CC_CC 3 |
376 #define CC_MI 4U |
375 #define CC_MI 4 |
377 #define CC_PL 5U |
376 #define CC_PL 5 |
378 #define CC_VS 6U |
377 #define CC_VS 6 |
379 #define CC_VC 7U |
378 #define CC_VC 7 |
380 #define CC_HI 8U |
379 #define CC_HI 8 |
381 #define CC_LS 9U |
380 #define CC_LS 9 |
382 #define CC_GE 10U |
381 #define CC_GE 10 |
383 #define CC_LT 11U |
382 #define CC_LT 11 |
384 #define CC_GT 12U |
383 #define CC_GT 12 |
385 #define CC_LE 13U |
384 #define CC_LE 13 |
386 #define CC_AL 14U |
385 #define CC_AL 14 |
387 |
386 |
388 #ifdef __CPU_ARM_HAS_CLZ |
387 #ifdef __CPU_ARM_HAS_CLZ |
389 #if __ARM_ASSEMBLER_ISA__ >= 5 |
388 #if __ARM_ASSEMBLER_ISA__ >= 5 |
390 #define CLZ(Rd,Rm) asm("clz r" #Rd ", r" #Rm) |
389 #define CLZ(Rd,Rm) asm("clz r" #Rd ", r" #Rm) |
391 #else |
390 #else |
604 #define __MSR_CPSR_C(cc,r) asm("msr"#cc" cpsr_c,"#r); |
603 #define __MSR_CPSR_C(cc,r) asm("msr"#cc" cpsr_c,"#r); |
605 #endif |
604 #endif |
606 |
605 |
607 // Causes undefined instruction exception on both ARM and THUMB |
606 // Causes undefined instruction exception on both ARM and THUMB |
608 #define __ASM_CRASH() asm(".word 0xe7ffdeff ") |
607 #define __ASM_CRASH() asm(".word 0xe7ffdeff ") |
609 #if defined(__GNUC__) |
608 #if defined(__GNUC__) |
610 #define __crash() asm(".word 0xe7ffdeff " : : : "memory") |
609 #define __crash() asm(".word 0xe7ffdeff " : : : "memory") |
611 #elif defined(__GCCXML__) |
|
612 #define __crash() (*((TInt *) 0x0) = 0xd1e) |
|
613 #elif defined(__ARMCC__) |
610 #elif defined(__ARMCC__) |
614 // RVCT doesn't let us inline an undefined instruction |
611 // RVCT doesn't let us inline an undefined instruction |
615 // use a CDP to CP15 instead - doesn't work on THUMB but never mind |
612 // use a CDP to CP15 instead - doesn't work on THUMB but never mind |
616 #if __ARMCC_VERSION < 310000 |
613 #if __ARMCC_VERSION < 310000 |
617 #define __crash() asm("cdp p15, 0, c0, c0, c0, 0 ") |
614 #define __crash() asm("cdp p15, 0, c0, c0, c0, 0 ") |
639 |
636 |
640 #ifdef __CPU_X86 |
637 #ifdef __CPU_X86 |
641 #define EXC_TRAP_CTX_SZ 10 // ebx, esp, ebp, esi, edi, ds, es, fs, gs, eip |
638 #define EXC_TRAP_CTX_SZ 10 // ebx, esp, ebp, esi, edi, ds, es, fs, gs, eip |
642 |
639 |
643 // Causes exception |
640 // Causes exception |
644 #if defined(__VC32__) |
641 #if defined(__VC32__) || defined(__CW32__) |
645 #define __crash() do { _asm int 255 } while(0) |
642 #define __crash() do { _asm int 0ffh } while(0) |
646 #elif defined(__CW32__) |
|
647 #define __crash() do { *(volatile TInt*)0 = 0; } while(0) |
|
648 #else |
643 #else |
649 #define __crash() asm("int 0xff " : : : "memory") |
644 #define __crash() asm("int 0xff " : : : "memory") |
650 #endif |
645 #endif |
651 |
646 |
652 #ifdef __VC32__ |
647 #ifdef __VC32__ |