try fixing unresolved link errors with gcc

This commit is contained in:
zeromus 2009-03-03 20:04:16 +00:00
parent 96f784de02
commit fbd906ba8d
4 changed files with 137 additions and 133 deletions

View File

@ -52,116 +52,7 @@
#define ASSERT_UNALIGNED(x)
#endif
static void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val);
static void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val);
static void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val);
static u8 FASTCALL _MMU_ARM9_read08(u32 adr);
static u16 FASTCALL _MMU_ARM9_read16(u32 adr);
static u32 FASTCALL _MMU_ARM9_read32(u32 adr);
static void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val);
static void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val);
static void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val);
static u8 FASTCALL _MMU_ARM7_read08(u32 adr);
static u16 FASTCALL _MMU_ARM7_read16(u32 adr);
static u32 FASTCALL _MMU_ARM7_read32(u32 adr);
u8 _MMU_read08(const int PROCNUM, u32 addr) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
//Returns data from DTCM (ARM9 only)
return T1ReadByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
}
if ( (addr & 0x0F000000) == 0x02000000)
return T1ReadByte( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF);
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read08(addr);
else return _MMU_ARM7_read08(addr);
}
u16 _MMU_read16(const int PROCNUM, u32 addr) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
//Returns data from DTCM (ARM9 only)
return T1ReadWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
}
if ( (addr & 0x0F000000) == 0x02000000)
return T1ReadWord( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF);
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read16(addr);
else return _MMU_ARM7_read16(addr);
}
u32 _MMU_read32(int PROCNUM, u32 addr) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
//Returns data from DTCM (ARM9 only)
return T1ReadLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
}
if ( (addr & 0x0F000000) == 0x02000000)
return T1ReadLong( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF);
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read32(addr);
else return _MMU_ARM7_read32(addr);
}
void _MMU_write08(const int PROCNUM, u32 addr, u8 val) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
T1WriteByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
return;
}
if ( (addr & 0x0F000000) == 0x02000000) {
T1WriteByte( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF, val);
return;
}
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write08(addr,val);
else _MMU_ARM7_write08(addr,val);
}
void _MMU_write16(const int PROCNUM, u32 addr, u16 val) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
T1WriteWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
return;
}
if ( (addr & 0x0F000000) == 0x02000000) {
T1WriteWord( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF, val);
return;
}
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write16(addr,val);
else _MMU_ARM7_write16(addr,val);
}
void _MMU_write32(const int PROCNUM, u32 addr, u32 val) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
T1WriteLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
return;
}
if ( (addr & 0x0F000000) == 0x02000000) {
T1WriteLong( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF, val);
return;
}
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write32(addr,val);
else _MMU_ARM7_write32(addr,val);
}
//http://home.utah.edu/~nahaj/factoring/isqrt.c.html
static u64 isqrt (u64 x) {
@ -1607,7 +1498,7 @@ static INLINE void MMU_IPCSync(u8 proc, u32 val)
//=========================================================================================================
//=========================================================================================================
//================================================= MMU write 08
static void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
{
#ifdef INTERNAL_DTCM_WRITE
if(((adr & ~0x3FFF) == MMU.DTCMRegion))
@ -1821,7 +1712,7 @@ static void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
}
//================================================= MMU ARM9 write 16
static void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
{
#ifdef INTERNAL_DTCM_WRITE
if((adr & ~0x3FFF) == MMU.DTCMRegion)
@ -2404,7 +2295,7 @@ static void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
}
//================================================= MMU ARM9 write 32
static void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
{
#ifdef INTERNAL_DTCM_WRITE
if((adr&(~0x3FFF)) == MMU.DTCMRegion)
@ -2956,7 +2847,7 @@ static void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
}
//================================================= MMU ARM9 read 08
static u8 FASTCALL _MMU_ARM9_read08(u32 adr)
u8 FASTCALL _MMU_ARM9_read08(u32 adr)
{
#ifdef INTERNAL_DTCM_READ
if((adr&(~0x3FFF)) == MMU.DTCMRegion)
@ -2985,7 +2876,7 @@ static u8 FASTCALL _MMU_ARM9_read08(u32 adr)
}
//================================================= MMU ARM9 read 16
static u16 FASTCALL _MMU_ARM9_read16(u32 adr)
u16 FASTCALL _MMU_ARM9_read16(u32 adr)
{
#ifdef INTERNAL_DTCM_READ
if((adr&(~0x3FFF)) == MMU.DTCMRegion)
@ -3056,7 +2947,7 @@ static u16 FASTCALL _MMU_ARM9_read16(u32 adr)
}
//================================================= MMU ARM9 read 32
static u32 FASTCALL _MMU_ARM9_read32(u32 adr)
u32 FASTCALL _MMU_ARM9_read32(u32 adr)
{
#ifdef INTERNAL_DTCM_READ
if((adr&(~0x3FFF)) == MMU.DTCMRegion)
@ -3225,7 +3116,7 @@ static u32 FASTCALL _MMU_ARM9_read32(u32 adr)
//=========================================================================================================
//=========================================================================================================
//================================================= MMU ARM7 write 08
static void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
{
#ifdef EXPERIMENTAL_GBASLOT
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
@ -3278,7 +3169,7 @@ static void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
}
//================================================= MMU ARM7 write 16
static void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
{
#ifdef EXPERIMENTAL_GBASLOT
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
@ -3700,7 +3591,7 @@ static void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][adr>>20], adr&MMU.MMU_MASK[ARMCPU_ARM7][adr>>20], val);
}
//================================================= MMU ARM7 write 32
static void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val)
void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val)
{
#ifdef EXPERIMENTAL_GBASLOT
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
@ -3960,7 +3851,7 @@ static void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val)
}
//================================================= MMU ARM7 read 08
static u8 FASTCALL _MMU_ARM7_read08(u32 adr)
u8 FASTCALL _MMU_ARM7_read08(u32 adr)
{
#ifdef EXPERIMENTAL_WIFI
/* wifi mac access */
@ -3992,7 +3883,7 @@ static u8 FASTCALL _MMU_ARM7_read08(u32 adr)
return MMU.MMU_MEM[ARMCPU_ARM7][(adr>>20)&0xFF][adr&MMU.MMU_MASK[ARMCPU_ARM7][(adr>>20)&0xFF]];
}
//================================================= MMU ARM7 read 16
static u16 FASTCALL _MMU_ARM7_read16(u32 adr)
u16 FASTCALL _MMU_ARM7_read16(u32 adr)
{
#ifdef EXPERIMENTAL_WIFI
/* wifi mac access */
@ -4052,7 +3943,7 @@ static u16 FASTCALL _MMU_ARM7_read16(u32 adr)
return T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][(adr >> 20) & 0xFF], adr & MMU.MMU_MASK[ARMCPU_ARM7][(adr >> 20) & 0xFF]);
}
//================================================= MMU ARM7 read 32
static u32 FASTCALL _MMU_ARM7_read32(u32 adr)
u32 FASTCALL _MMU_ARM7_read32(u32 adr)
{
#ifdef EXPERIMENTAL_WIFI
/* wifi mac access */

View File

@ -27,10 +27,18 @@
#include "FIFO.h"
#include "dscard.h"
#include "mem.h"
#include "ARM9.h"
#include "mc.h"
//HACK!!!! REMOVE ME SOON!
#ifndef ARMCPU_ARM7
#define ARMCPU_ARM7 1
#define ARMCPU_ARM9 0
#define ARMPROC (PROCNUM?NDS_ARM7:NDS_ARM9)
#endif
/* theses macros are designed for reading/writing in memory (m is a pointer to memory, like MMU.MMU_MEM[proc], and a is an address, like 0x04000000 */
#define MEM_8(m, a) (((u8*)(m[((a)>>20)&0xff]))[((a)&0xfff)])
@ -182,12 +190,117 @@ template<int PROCNUM> void _MMU_write08(u32 addr, u8 val);
template<int PROCNUM> void _MMU_write16(u32 addr, u16 val);
template<int PROCNUM> void _MMU_write32(u32 addr, u32 val);
FORCEINLINE extern u8 _MMU_read08(const int PROCNUM, u32 addr);
FORCEINLINE extern u16 _MMU_read16(const int PROCNUM, u32 addr);
FORCEINLINE extern u32 _MMU_read32(const int PROCNUM, u32 addr);
FORCEINLINE extern void _MMU_write08(const int PROCNUM, u32 addr, u8 val);
FORCEINLINE extern void _MMU_write16(const int PROCNUM, u32 addr, u16 val);
FORCEINLINE extern void _MMU_write32(const int PROCNUM, u32 addr, u32 val);
void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val);
void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val);
void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val);
u8 FASTCALL _MMU_ARM9_read08(u32 adr);
u16 FASTCALL _MMU_ARM9_read16(u32 adr);
u32 FASTCALL _MMU_ARM9_read32(u32 adr);
void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val);
void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val);
void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val);
u8 FASTCALL _MMU_ARM7_read08(u32 adr);
u16 FASTCALL _MMU_ARM7_read16(u32 adr);
u32 FASTCALL _MMU_ARM7_read32(u32 adr);
FORCEINLINE u8 _MMU_read08(const int PROCNUM, u32 addr) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
//Returns data from DTCM (ARM9 only)
return T1ReadByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
}
if ( (addr & 0x0F000000) == 0x02000000)
return T1ReadByte( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF);
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read08(addr);
else return _MMU_ARM7_read08(addr);
}
FORCEINLINE u16 _MMU_read16(const int PROCNUM, u32 addr) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
//Returns data from DTCM (ARM9 only)
return T1ReadWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
}
if ( (addr & 0x0F000000) == 0x02000000)
return T1ReadWord( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF);
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read16(addr);
else return _MMU_ARM7_read16(addr);
}
FORCEINLINE u32 _MMU_read32(int PROCNUM, u32 addr) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
//Returns data from DTCM (ARM9 only)
return T1ReadLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF);
}
if ( (addr & 0x0F000000) == 0x02000000)
return T1ReadLong( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF);
if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read32(addr);
else return _MMU_ARM7_read32(addr);
}
FORCEINLINE void _MMU_write08(const int PROCNUM, u32 addr, u8 val) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
T1WriteByte(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
return;
}
if ( (addr & 0x0F000000) == 0x02000000) {
T1WriteByte( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF, val);
return;
}
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write08(addr,val);
else _MMU_ARM7_write08(addr,val);
}
FORCEINLINE void _MMU_write16(const int PROCNUM, u32 addr, u16 val) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
T1WriteWord(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
return;
}
if ( (addr & 0x0F000000) == 0x02000000) {
T1WriteWord( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF, val);
return;
}
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write16(addr,val);
else _MMU_ARM7_write16(addr,val);
}
FORCEINLINE void _MMU_write32(const int PROCNUM, u32 addr, u32 val) {
if(PROCNUM==ARMCPU_ARM9)
if((addr&(~0x3FFF)) == MMU.DTCMRegion)
{
T1WriteLong(ARM9Mem.ARM9_DTCM, addr & 0x3FFF, val);
return;
}
if ( (addr & 0x0F000000) == 0x02000000) {
T1WriteLong( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF, val);
return;
}
if(PROCNUM==ARMCPU_ARM9) _MMU_ARM9_write32(addr,val);
else _MMU_ARM7_write32(addr,val);
}
#ifdef MMU_ENABLE_ACL
void FASTCALL MMU_write8_acl(u32 proc, u32 adr, u8 val);

View File

@ -22,14 +22,14 @@
#ifndef ARM_CPU
#define ARM_CPU
#include "types.h"
#include "bits.h"
#include "MMU.h"
#define ARMCPU_ARM7 1
#define ARMCPU_ARM9 0
#define ARMPROC (PROCNUM?NDS_ARM7:NDS_ARM9)
#include "types.h"
#include "bits.h"
#include "MMU.h"
#define CODE(i) (((i)>>25)&0x7)
#define OPCODE(i) (((i)>>21)&0xF)
#define SIGNEBIT(i) BIT_N(i,20)

View File

@ -1363,7 +1363,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
&arm9_memio, &arm9_direct_memory_iface);
if ( arm9_gdb_stub == NULL) {
MessageBox(hwnd,"Failed to create ARM9 gdbstub","Error",MB_OK);
MessageBox(MainWindow->getHWnd(),"Failed to create ARM9 gdbstub","Error",MB_OK);
return -1;
}
}
@ -1373,7 +1373,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
&arm7_base_memory_iface);
if ( arm7_gdb_stub == NULL) {
MessageBox(hwnd,"Failed to create ARM7 gdbstub","Error",MB_OK);
MessageBox(MainWindow->getHWnd(),"Failed to create ARM7 gdbstub","Error",MB_OK);
return -1;
}
}