core: Android studio fixes

- Clang edge cases for shifts
- Avoid generating relocs by not using global symbols in ngen_arm.S (fixes #1109)
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2018-07-09 09:31:45 +02:00
parent 70afc60d75
commit 5525d5dde2
5 changed files with 23 additions and 11 deletions

View File

@ -153,18 +153,21 @@ ADD.SP.REG 0x008D0000
for (int i=0;i<=30;i+=2)
{
u32 immv=(imm32<<i) | (imm32>>(32-i));
if (i == 0)
immv = imm32;
if (immv<256)
{
return ((i/2)<<8) | immv;
}
}
return -1;
}
static u32 ARMImmid8r4(u32 imm8r4)
{
u32 rv = ARMImmid8r4_enc(imm8r4);
verify(rv!=-1);
return rv;
}

View File

@ -790,7 +790,7 @@ void armv_prof(OpType opt,u32 op,u32 flg);
extern "C" void arm_dispatch();
extern "C" void arm_exit();
extern "C" void DYNACALL arm_mainloop(u32 cycl);
extern "C" void DYNACALL arm_mainloop(u32 cycl, void* regs, void* entrypoints);
extern "C" void DYNACALL arm_compilecode();
template <bool L, bool B>
@ -1470,7 +1470,7 @@ naked void DYNACALL arm_compilecode()
}
}
naked void DYNACALL arm_mainloop(u32 cycl)
naked void DYNACALL arm_mainloop(u32 cycl, void* regs, void* entrypoints)
{
__asm
{
@ -1590,8 +1590,13 @@ void armv_end(void* codestart, u32 cycl)
SUB(r5,r5,cycl,true);
else
{
SUB(r5,r5,256);
SUB(r5,r5,cycl-256,true);
u32 togo = cycl;
while(ARMImmid8r4_enc(togo) == -1)
{
SUB(r5,r5,256);
togo -= 256;
}
SUB(r5,r5,togo,true);
}
JUMP((u32)&arm_exit,CC_MI); //statically predicted as not taken
JUMP((u32)&arm_dispatch);
@ -1620,7 +1625,7 @@ void arm_Run(u32 CycleCount)
for (int i=0;i<32;i++)
{
arm_mainloop(CycleCount/32);
arm_mainloop(CycleCount/32, arm_Reg, EntryPoints);
libAICA_TimeStep();
}

View File

@ -217,8 +217,8 @@ push {r4,r5,r8,r9,lr}
ldr r8,Xarm_Reg @load cntx
ldr r4,XEntryPoints @load lookup base
#else
ldr r8,=arm_Reg @load cntx
ldr r4,=EntryPoints @load lookup base
mov r8,r1 @load cntx
mov r4,r2 @load lookup base
#endif
ldr r5,[r8,#192] @load cycle count

View File

@ -1609,7 +1609,7 @@ void ngen_compile_opcode(RuntimeBlockInfo* block, shil_opcode* op, bool staging,
if (op->rs2.is_imm())
{
if (!op->rs2.is_imm_u8())
if (!is_i8r4(op->rs2._imm))
MOV32(rs2,(u32)op->rs2._imm);
else
is_imm=true;

View File

@ -339,8 +339,9 @@ int msgboxf(const wchar* Text,unsigned int Type,...)
va_list Args;
va_start(Args,Type);
vsprintf(S,Text,Args);
vsnprintf(S, 2048,Text,Args);
va_end(Args);
puts(S);
int byteCount = strlen(S);
jbyteArray bytes = jenv->NewByteArray(byteCount);
@ -561,5 +562,8 @@ int push_vmu_screen(u8* buffer)
void os_DebugBreak()
{
//notify the parent thread about it ...
// TODO: notify the parent thread about it ...
// Attach debugger here to figure out what went wrong
for(;;) ;
}