(GX) Get rid of warnings while compiling Wii/NGC versions

This commit is contained in:
twinaphex 2014-02-19 18:07:47 +01:00
parent 71b6485bb5
commit 6a4cfc7271
4 changed files with 75 additions and 3 deletions

View File

@ -20,7 +20,7 @@
#include <fat.h>
#include <gctypes.h>
#include <ogc/cache.h>
#include <ogc/lwp_threads.h>
#include "../../gx/ppc_asm.h"
#include <ogc/system.h>
#include <ogc/usbstorage.h>
#include <sdcard/wiisd_io.h>

70
gx/ppc_asm.h Normal file
View File

@ -0,0 +1,70 @@
#ifndef __PPC_ASM_H
#define __PPC_ASM_H
#ifndef __lhbrx
#define __lhbrx(base,index) \
({ register u16 res; \
__asm__ volatile ("lhbrx %0,%1,%2" : "=r"(res) : "b%"(index), "r"(base) : "memory"); \
res; })
#endif
#ifndef __sthbrx
#define __sthbrx(base,index,value) \
__asm__ volatile ("sthbrx %0,%1,%2" : : "r"(value), "b%"(index), "r"(base) : "memory")
#endif
#ifndef __stwbrx
#define __stwbrx(base,index,value) \
__asm__ volatile ("stwbrx %0,%1,%2" : : "r"(value), "b%"(index), "r"(base) : "memory")
#endif
#ifdef GEKKO
#ifndef _CPU_ISR_Enable
#define _CPU_ISR_Enable() \
{ register u32 _val = 0; \
__asm__ __volatile__ ( \
"mfmsr %0\n" \
"ori %0,%0,0x8000\n" \
"mtmsr %0" \
: "=&r" ((_val)) : "0" ((_val)) \
); \
}
#endif
#ifndef _CPU_ISR_Disable
#define _CPU_ISR_Disable( _isr_cookie ) \
{ register u32 _disable_mask = 0; \
_isr_cookie = 0; \
__asm__ __volatile__ ( \
"mfmsr %0\n" \
"rlwinm %1,%0,0,17,15\n" \
"mtmsr %1\n" \
"extrwi %0,%0,1,16" \
: "=&r" ((_isr_cookie)), "=&r" ((_disable_mask)) \
: "0" ((_isr_cookie)), "1" ((_disable_mask)) \
); \
}
#endif
#ifndef _CPU_ISR_Restore
#define _CPU_ISR_Restore( _isr_cookie ) \
{ register u32 _enable_mask = 0; \
__asm__ __volatile__ ( \
" cmpwi %0,0\n" \
" beq 1f\n" \
" mfmsr %1\n" \
" ori %1,%1,0x8000\n" \
" mtmsr %1\n" \
"1:" \
: "=r"((_isr_cookie)),"=&r" ((_enable_mask)) \
: "0"((_isr_cookie)),"1" ((_enable_mask)) \
); \
}
extern void __lwp_thread_stopmultitasking(void (*exitfunc)());
#endif
#endif
#endif

View File

@ -5,7 +5,7 @@
#include <ogc/machine/asm.h>
#include <ogc/lwp_heap.h>
#include <ogc/system.h>
#include <ogc/machine/processor.h>
#include "../gx/ppc_asm.h"
#include <string.h>
#include <malloc.h>
#include <unistd.h>
@ -48,6 +48,7 @@ static u32 __lwp_heap_block_size(heap_cntrl *theheap, void *ptr)
{
heap_block *block;
u32 dsize, level;
(void)level;
_CPU_ISR_Disable(level);
block = __lwp_heap_usrblockat(ptr);

View File

@ -40,7 +40,7 @@
#include <string.h>
#include <gccore.h>
#include <ogcsys.h>
#include <ogc/machine/processor.h>
#include "../gx/ppc_asm.h"
#include "vi_encoder.h"
@ -151,6 +151,7 @@ void VIDEO_SetTrapFilter(bool enable)
}
_CPU_ISR_Disable(level);
(void)level;
__viOpenI2C(1);
__viSetSCL(1);