diff options
| author | Sonicadvance1 <sonicadvance1@gmail.com> | 2010-03-29 09:26:19 +0000 |
|---|---|---|
| committer | Sonicadvance1 <sonicadvance1@gmail.com> | 2010-03-29 09:26:19 +0000 |
| commit | 85a1b2af455157e38a40faa427909f950e9d41d2 (patch) | |
| tree | ab8b482a6330f79d362d74e929f49565cc4d7daf /Source/TestSuite/ASM/source/Helpers.cpp | |
| parent | a8865d21b32f50b45f48cd1f8e4d1cafc5486585 (diff) | |
This should largely go unnoticed
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5251 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/TestSuite/ASM/source/Helpers.cpp')
| -rw-r--r-- | Source/TestSuite/ASM/source/Helpers.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/Source/TestSuite/ASM/source/Helpers.cpp b/Source/TestSuite/ASM/source/Helpers.cpp new file mode 100644 index 0000000000..423ba296ee --- /dev/null +++ b/Source/TestSuite/ASM/source/Helpers.cpp @@ -0,0 +1,59 @@ + +#include "Defines.h" + +u32 GetCR0() +{ + u32 var; + asm( + "mfcr %0" + : "=&r"(var) + ); + return var; +} + +u32 GetCR(u32 num) +{ + u32 var; + if(num == 0) // wtf, silly people + return GetCR0(); + else { + // TODO: Ugly switch is ugly, was failing otherwise + switch (num) { + case 1: + asm("mcrf 0, 1"); + break; + case 2: + asm("mcrf 0, 2"); + break; + case 3: + asm("mcrf 0, 3"); + break; + case 4: + asm("mcrf 0, 4"); + break; + case 5: + asm("mcrf 0, 5"); + break; + case 6: + asm("mcrf 0, 6"); + break; + case 7: + asm("mcrf 0, 7"); + break; + default: + printf("Can this be more than 7?\n"); + break; + } + return GetCR0(); + } +} + +u32 GetXER() +{ + u32 var; + asm( + "mfxer %0" + : "=&r"(var) + ); + return var; +}
\ No newline at end of file |
