iOS fixes

This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2015-05-16 01:04:30 -07:00
parent 6547d80095
commit 9c2a4dc5a4
8 changed files with 83 additions and 31 deletions

View File

@ -178,6 +178,8 @@ TA_context* read_frame(const char* file, u8* vram_ref) {
ctx->tad.thd_data += t;
fclose(fw);
return ctx;
}
bool rend_frame(TA_context* ctx, bool draw_osd) {

View File

@ -39,7 +39,7 @@ union DoubleReg
f32 sgl[2];
};
INLINE f64 GetDR(u32 n)
static INLINE f64 GetDR(u32 n)
{
#ifdef TRACE
if (n>7)
@ -53,7 +53,7 @@ INLINE f64 GetDR(u32 n)
return t.dbl;
}
INLINE f64 GetXD(u32 n)
static INLINE f64 GetXD(u32 n)
{
#ifdef TRACE
if (n>7)
@ -67,7 +67,7 @@ INLINE f64 GetXD(u32 n)
return t.dbl;
}
INLINE void SetDR(u32 n,f64 val)
static INLINE void SetDR(u32 n,f64 val)
{
#ifdef TRACE
if (n>7)
@ -81,7 +81,7 @@ INLINE void SetDR(u32 n,f64 val)
fr[(n<<1) | 0]=t.sgl[1];
}
INLINE void SetXD(u32 n,f64 val)
static INLINE void SetXD(u32 n,f64 val)
{
#ifdef TRACE
if (n>7)

View File

@ -1,4 +1,4 @@
#include "types.h"
#include "types.h"
#include "cfg/cfg.h"
#if HOST_OS==OS_LINUX || HOST_OS == OS_DARWIN
@ -29,13 +29,16 @@ bool VramLockedWrite(u8* address);
bool BM_LockedWrite(u8* address);
#if HOST_OS == OS_DARWIN
+void sigill_handler(int sn, siginfo_t * si, void *ctxr) {
void sigill_handler(int sn, siginfo_t * si, void *segfault_ctx) {
ucontext_t* ctx = (ucontext_t*)ctxr;
unat pc = (unat)GET_PC_FROM_CONTEXT(ctxr);
bool dyna_cde = ((u32)GET_PC_FROM_CONTEXT(ctxr)>(u32)CodeCache) && ((u32)GET_PC_FROM_CONTEXT(ctxr)<(u32)(CodeCache + CODE_SIZE));
rei_host_context_t ctx;
context_from_segfault(&ctx, segfault_ctx);
unat pc = (unat)ctx.pc;
bool dyna_cde = (pc>(unat)CodeCache) && (pc<(unat)(CodeCache + CODE_SIZE));
printf("SIGILL @ %08X, fault_handler+0x%08X ... %08X -> was not in vram, %d\n", GET_PC_FROM_CONTEXT(ctxr), GET_PC_FROM_CONTEXT(ctxr) - (u32)sigill_handler, (unat)si->si_addr, dyna_cde);
printf("SIGILL @ %08X, fault_handler+0x%08X ... %08X -> was not in vram, %d\n", pc, pc - (u32)sigill_handler, (unat)si->si_addr, dyna_cde);
printf("Entering infiniloop");

View File

@ -277,6 +277,8 @@ void* prof(void *ptr)
fclose(maps);
fclose(prof_out);
return 0;
}
void sample_Start(int freq)

View File

@ -169,10 +169,15 @@ int dc_init(int argc,wchar* argv[])
int rv= 0;
if (settings.bios.UseReios || !LoadRomFiles(GetPath("/data/")))
#if HOST_OS != OS_DARWIN
#define DATA_PATH "/data/"
#else
#define DATA_PATH "/"
#endif
if (settings.bios.UseReios || !LoadRomFiles(GetPath(DATA_PATH)))
{
if (!LoadHle(GetPath("/data/")))
if (!LoadHle(GetPath(DATA_PATH)))
return -3;
else
printf("Did not load bios, using reios\n");

View File

@ -16,7 +16,7 @@ void WriteSample(s16 right, s16 left);
#include <intrin.h>
#endif
u32 INLINE bitscanrev(u32 v)
u32 static INLINE bitscanrev(u32 v)
{
#if (BUILD_COMPILER==COMPILER_GCC)
return 31-__builtin_clz(v);

View File

@ -11,14 +11,16 @@
#if HOST_OS == OS_DARWIN
#define CSYM(n) _##n
#define HIDDEN(n)
#else
#define CSYM(n) n
#define HIDDEN(n) .hidden CSYM(n)
#endif
@@@@@@@@@@ some helpers @@@@@@@@@@
.global CSYM(do_sqw_nommu_area_3)
.hidden CSYM(do_sqw_nommu_area_3)
HIDDEN(do_sqw_nommu_area_3)
@r0: addr
@r1: sq_both
CSYM(do_sqw_nommu_area_3):
@ -33,7 +35,7 @@ vstm r3,{d0-d3}
bx lr
.global CSYM(TAWriteSQ)
.hidden TAWriteSQ
HIDDEN(TAWriteSQ)
@r0: addr
@r1: sq_both
CSYM(TAWriteSQ):
@ -69,7 +71,7 @@ bx lr
@@@@@@@@@@ ngen_LinkBlock_*****_stub @@@@@@@@@@
.global CSYM(ngen_LinkBlock_Generic_stub)
.hidden CSYM(ngen_LinkBlock_Generic_stub)
HIDDEN(ngen_LinkBlock_Generic_stub)
CSYM(ngen_LinkBlock_Generic_stub):
mov r1,r4 @ djump/pc -> in case we need it ..
@ -77,14 +79,14 @@ CSYM(ngen_LinkBlock_Generic_stub):
.global CSYM(ngen_LinkBlock_cond_Branch_stub)
.hidden CSYM(ngen_LinkBlock_cond_Branch_stub)
HIDDEN(ngen_LinkBlock_cond_Branch_stub)
CSYM(ngen_LinkBlock_cond_Branch_stub):
mov r1,#1
b CSYM(ngen_LinkBlock_Shared_stub)
.global CSYM(ngen_LinkBlock_cond_Next_stub)
.hidden CSYM(ngen_LinkBlock_cond_Next_stub)
HIDDEN(ngen_LinkBlock_cond_Next_stub)
CSYM(ngen_LinkBlock_cond_Next_stub):
mov r1,#0
@ -92,7 +94,7 @@ CSYM(ngen_LinkBlock_cond_Next_stub):
.global CSYM(ngen_LinkBlock_Shared_stub)
.hidden CSYM(ngen_LinkBlock_Shared_stub)
HIDDEN(ngen_LinkBlock_Shared_stub)
CSYM(ngen_LinkBlock_Shared_stub):
mov r0,lr
@ -104,7 +106,7 @@ CSYM(ngen_LinkBlock_Shared_stub):
.global CSYM(ngen_FailedToFindBlock_)
.hidden CSYM(ngen_FailedToFindBlock_)
HIDDEN(ngen_FailedToFindBlock_)
CSYM(ngen_FailedToFindBlock_):
mov r0,r4
bl CSYM(rdv_FailedToFindBlock)
@ -113,7 +115,7 @@ CSYM(ngen_FailedToFindBlock_):
@@@@@@@@@@ ngen_blockcheckfail @@@@@@@@@@
.global CSYM(ngen_blockcheckfail)
.hidden CSYM(ngen_blockcheckfail)
HIDDEN(ngen_blockcheckfail)
CSYM(ngen_blockcheckfail):
bl CSYM(rdv_BlockCheckFail)
bx r0
@ -129,7 +131,7 @@ CSYM(ngen_blockcheckfail):
.global CSYM(ngen_mainloop)
.hidden CSYM(ngen_mainloop)
HIDDEN(ngen_mainloop)
CSYM(ngen_mainloop):
push { r4-r12,lr }
@ -149,7 +151,7 @@ push { r4-r12,lr }
@this code is here for fall-through behavior of do_iter
.global CSYM(intc_sched)
.hidden CSYM(intc_sched)
HIDDEN(intc_sched)
CSYM(intc_sched): @ next_pc _MUST_ be on ram
#if HOST_OS == OS_DARWIN
add r11,r11,#SH4_TIMESLICE
@ -168,7 +170,7 @@ do_iter:
mov r4,r0
.global CSYM(no_update)
.hidden CSYM(no_update)
HIDDEN(no_update)
CSYM(no_update): @ next_pc _MUST_ be on r4 *R4 NOT R0 anymore*
sub r2,r8,#33816576
@ -186,7 +188,7 @@ end_ngen_mainloop:
@@@@@@@@@@ ngen_mainloop @@@@@@@@@@
.global CSYM(arm_compilecode)
.hidden CSYM(arm_compilecode)
HIDDEN(arm_compilecode)
CSYM(arm_compilecode):
bl CSYM(CompileCode)
b CSYM(arm_dispatch)
@ -197,7 +199,7 @@ XEntryPoints: .word CSYM(EntryPoints)
#endif
.global CSYM(arm_mainloop)
.hidden CSYM(arm_mainloop)
HIDDEN(arm_mainloop)
CSYM(arm_mainloop): @(cntx,lookup_base,cycles)
#if HOST_OS == OS_DARWIN
@ -220,7 +222,7 @@ push {r4,r5,r8,r9,lr}
b CSYM(arm_dispatch)
.global CSYM(arm_dispatch)
.hidden CSYM(arm_dispatch)
HIDDEN(arm_dispatch)
CSYM(arm_dispatch):
#ifdef TARGET_IPHONE
ldrd r0,r1,[r8,#184] @load: Next PC, interrupt
@ -239,7 +241,7 @@ arm_dofiq:
b CSYM(arm_dispatch)
.global CSYM(arm_exit)
.hidden CSYM(arm_exit)
HIDDEN(arm_exit)
CSYM(arm_exit):
str r5,[r8,#192] @if timeslice is over, save remaining cycles
#if HOST_OS == OS_DARWIN
@ -252,7 +254,7 @@ CSYM(arm_exit):
@matrix mul
#ifndef _ANDROID
.global CSYM(ftrv_asm)
.hidden CSYM(ftrv_asm)
HIDDEN(ftrv_asm)
CSYM(ftrv_asm):
@r0=dst,r1=vec,r2=mtx
@ -271,7 +273,7 @@ vstm r0,{d4,d5}
bx lr
.global CSYM(fipr_asm)
.hidden CSYM(fipr_asm)
HIDDEN(fipr_asm)
CSYM(fipr_asm):
@ vdot

View File

@ -15,6 +15,11 @@
8497BCCA1A41BFBA00EFB9ED /* audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCC51A41BFBA00EFB9ED /* audiostream.cpp */; };
8497BCCB1A41BFBA00EFB9ED /* ds_audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCC71A41BFBA00EFB9ED /* ds_audiostream.cpp */; };
8497BCCF1A41BFD800EFB9ED /* coreio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCCD1A41BFD800EFB9ED /* coreio.cpp */; };
849C0D621B072C07008BAAA4 /* context.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 849C0D601B072C07008BAAA4 /* context.cpp */; };
849C0D661B072CF8008BAAA4 /* reios.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 849C0D641B072CF8008BAAA4 /* reios.cpp */; };
849C0D6D1B072D14008BAAA4 /* descrambl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 849C0D671B072D14008BAAA4 /* descrambl.cpp */; };
849C0D6E1B072D14008BAAA4 /* gdrom_hle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 849C0D691B072D14008BAAA4 /* gdrom_hle.cpp */; };
849C0D6F1B072D14008BAAA4 /* reios_elf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 849C0D6B1B072D14008BAAA4 /* reios_elf.cpp */; };
8703BC3B1A44B8DA00E7E939 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 8703BC371A44B8DA00E7E939 /* Icon-72.png */; };
8703BC3C1A44B8DA00E7E939 /* Icon-72@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8703BC381A44B8DA00E7E939 /* Icon-72@2x.png */; };
8703BC3D1A44B8DA00E7E939 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8703BC391A44B8DA00E7E939 /* Icon.png */; };
@ -239,6 +244,16 @@
8497BCC81A41BFBA00EFB9ED /* oslib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = oslib.h; sourceTree = "<group>"; };
8497BCCD1A41BFD800EFB9ED /* coreio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = coreio.cpp; sourceTree = "<group>"; };
8497BCCE1A41BFD800EFB9ED /* coreio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = coreio.h; sourceTree = "<group>"; };
849C0D601B072C07008BAAA4 /* context.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = context.cpp; sourceTree = "<group>"; };
849C0D611B072C07008BAAA4 /* context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = context.h; sourceTree = "<group>"; };
849C0D641B072CF8008BAAA4 /* reios.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = reios.cpp; path = reios/reios.cpp; sourceTree = "<group>"; };
849C0D651B072CF8008BAAA4 /* reios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = reios.h; path = reios/reios.h; sourceTree = "<group>"; };
849C0D671B072D14008BAAA4 /* descrambl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = descrambl.cpp; path = reios/descrambl.cpp; sourceTree = "<group>"; };
849C0D681B072D14008BAAA4 /* descrambl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = descrambl.h; path = reios/descrambl.h; sourceTree = "<group>"; };
849C0D691B072D14008BAAA4 /* gdrom_hle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = gdrom_hle.cpp; path = reios/gdrom_hle.cpp; sourceTree = "<group>"; };
849C0D6A1B072D14008BAAA4 /* gdrom_hle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gdrom_hle.h; path = reios/gdrom_hle.h; sourceTree = "<group>"; };
849C0D6B1B072D14008BAAA4 /* reios_elf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = reios_elf.cpp; path = reios/reios_elf.cpp; sourceTree = "<group>"; };
849C0D6C1B072D14008BAAA4 /* reios_elf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = reios_elf.h; path = reios/reios_elf.h; sourceTree = "<group>"; };
8703BC371A44B8DA00E7E939 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = "<group>"; };
8703BC381A44B8DA00E7E939 /* Icon-72@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72@2x.png"; sourceTree = "<group>"; };
8703BC391A44B8DA00E7E939 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
@ -612,6 +627,8 @@
8497BCBB1A41A0E900EFB9ED /* linux */ = {
isa = PBXGroup;
children = (
849C0D601B072C07008BAAA4 /* context.cpp */,
849C0D611B072C07008BAAA4 /* context.h */,
8497BCBC1A41A0E900EFB9ED /* common.cpp */,
8497BCBD1A41A0E900EFB9ED /* nixprof.cpp */,
8497BCBE1A41A0E900EFB9ED /* typedefs.h */,
@ -641,6 +658,21 @@
path = deps/coreio;
sourceTree = "<group>";
};
849C0D631B072CE0008BAAA4 /* reios */ = {
isa = PBXGroup;
children = (
849C0D671B072D14008BAAA4 /* descrambl.cpp */,
849C0D681B072D14008BAAA4 /* descrambl.h */,
849C0D691B072D14008BAAA4 /* gdrom_hle.cpp */,
849C0D6A1B072D14008BAAA4 /* gdrom_hle.h */,
849C0D6B1B072D14008BAAA4 /* reios_elf.cpp */,
849C0D6C1B072D14008BAAA4 /* reios_elf.h */,
849C0D641B072CF8008BAAA4 /* reios.cpp */,
849C0D651B072CF8008BAAA4 /* reios.h */,
);
name = reios;
sourceTree = "<group>";
};
8703BC361A44B8DA00E7E939 /* assets */ = {
isa = PBXGroup;
children = (
@ -783,6 +815,7 @@
9C7A393818C806DE0070BB5F /* Emulator Core Code */ = {
isa = PBXGroup;
children = (
849C0D631B072CE0008BAAA4 /* reios */,
8497BCCC1A41BFD800EFB9ED /* coreio */,
8497BCC31A41BFBA00EFB9ED /* oslib */,
8497BCBB1A41A0E900EFB9ED /* linux */,
@ -1481,6 +1514,7 @@
9C7A3B1018C806E00070BB5F /* maple_devs.cpp in Sources */,
9C7A3AE718C806E00070BB5F /* zip_source_function.c in Sources */,
9C7A3AE918C806E00070BB5F /* zip_stat.c in Sources */,
849C0D661B072CF8008BAAA4 /* reios.cpp in Sources */,
9C7A3ABF18C806E00070BB5F /* zip_delete.c in Sources */,
9C7A3B0018C806E00070BB5F /* aica.cpp in Sources */,
9C7A3B3318C806E00070BB5F /* sh4_rom.cpp in Sources */,
@ -1508,6 +1542,7 @@
9C7A3B1418C806E00070BB5F /* drkPvr.cpp in Sources */,
9C7A3AB318C806E00070BB5F /* pngrtran.c in Sources */,
9C7A3AEC18C806E00070BB5F /* zip_strerror.c in Sources */,
849C0D6F1B072D14008BAAA4 /* reios_elf.cpp in Sources */,
9C7A3AB718C806E00070BB5F /* pngwio.c in Sources */,
8497BCCB1A41BFBA00EFB9ED /* ds_audiostream.cpp in Sources */,
9C7A3B2D18C806E00070BB5F /* ubc.cpp in Sources */,
@ -1558,6 +1593,7 @@
9C7A3B2018C806E00070BB5F /* shil.cpp in Sources */,
9C7A3B2518C806E00070BB5F /* ccn.cpp in Sources */,
9C7A3B4618C806E00070BB5F /* ngen_arm.S in Sources */,
849C0D621B072C07008BAAA4 /* context.cpp in Sources */,
9C7A3AD618C806E00070BB5F /* zip_get_file_comment.c in Sources */,
9C7A3AEA18C806E00070BB5F /* zip_stat_index.c in Sources */,
9C7A3ACF18C806E00070BB5F /* zip_filerange_crc.c in Sources */,
@ -1592,6 +1628,7 @@
9C7A3B0918C806E00070BB5F /* gdrom_response.cpp in Sources */,
9C7A3B2218C806E00070BB5F /* sh4_interpreter.cpp in Sources */,
9C7A3B3818C806E00070BB5F /* gdi.cpp in Sources */,
849C0D6D1B072D14008BAAA4 /* descrambl.cpp in Sources */,
9C7A3AF018C806E00070BB5F /* zip_unchange_data.c in Sources */,
9C7A3AB218C806E00070BB5F /* pngrio.c in Sources */,
9C7A3AC118C806E00070BB5F /* zip_entry_free.c in Sources */,
@ -1614,6 +1651,7 @@
9C7A3AF618C806E00070BB5F /* inffast.c in Sources */,
9C7A3B1318C806E00070BB5F /* _vmem.cpp in Sources */,
9C7A3B1118C806E00070BB5F /* maple_helper.cpp in Sources */,
849C0D6E1B072D14008BAAA4 /* gdrom_hle.cpp in Sources */,
9C7A3AD018C806E00070BB5F /* zip_fopen.c in Sources */,
9C7A3B1718C806E00070BB5F /* pvr_sb_regs.cpp in Sources */,
9C7A3B3918C806E00070BB5F /* ImgReader.cpp in Sources */,