1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

Compilation fix

This commit is contained in:
Nekotekina 2015-02-13 23:24:18 +03:00
parent 5fc77fe89e
commit 0d489518ab
4 changed files with 64 additions and 54 deletions

View File

@ -263,6 +263,7 @@ namespace fmt
}
};
#ifdef __APPLE__
template<>
struct get_fmt<unsigned long>
{
@ -286,6 +287,7 @@ namespace fmt
}
}
};
#endif
template<>
struct get_fmt<u64>
@ -383,6 +385,7 @@ namespace fmt
}
};
#ifdef __APPLE__
template<>
struct get_fmt<long>
{
@ -406,6 +409,7 @@ namespace fmt
}
}
};
#endif
template<>
struct get_fmt<s64>

View File

@ -210,49 +210,50 @@ typedef ucontext_t x64_context;
uint64_t* darwin_x64reg(x64_context *context, int reg)
{
auto *state = &context->uc_mcontext->__ss;
switch(reg)
{
case 0: // RAX
return &state->__rax;
case 1: // RCX
return &state->__rcx;
case 2: // RDX
return &state->__rdx;
case 3: // RBX
return &state->__rbx;
case 4: // RSP
return &state->__rsp;
case 5: // RBP
return &state->__rbp;
case 6: // RSI
return &state->__rsi;
case 7: // RDI
return &state->__rdi;
case 8: // R8
return &state->__r8;
case 9: // R9
return &state->__r9;
case 10: // R10
return &state->__r10;
case 11: // R11
return &state->__r11;
case 12: // R12
return &state->__r12;
case 13: // R13
return &state->__r13;
case 14: // R14
return &state->__r14;
case 15: // R15
return &state->__r15;
case 16: // RIP
return &state->__rip;
default: // FAIL
assert(0);
}
auto *state = &context->uc_mcontext->__ss;
switch(reg)
{
case 0: // RAX
return &state->__rax;
case 1: // RCX
return &state->__rcx;
case 2: // RDX
return &state->__rdx;
case 3: // RBX
return &state->__rbx;
case 4: // RSP
return &state->__rsp;
case 5: // RBP
return &state->__rbp;
case 6: // RSI
return &state->__rsi;
case 7: // RDI
return &state->__rdi;
case 8: // R8
return &state->__r8;
case 9: // R9
return &state->__r9;
case 10: // R10
return &state->__r10;
case 11: // R11
return &state->__r11;
case 12: // R12
return &state->__r12;
case 13: // R13
return &state->__r13;
case 14: // R14
return &state->__r14;
case 15: // R15
return &state->__r15;
case 16: // RIP
return &state->__rip;
default: // FAIL
assert(0);
}
}
#else
typedef decltype(REG_RIP) reg_table_t;
static const reg_table_t reg_table[17] =
@ -262,6 +263,7 @@ static const reg_table_t reg_table[17] =
};
#define X64REG(context, reg) (&context->uc_mcontext.gregs[reg_table[reg]])
#endif // __APPLE__
#endif
@ -379,7 +381,7 @@ void signal_handler(int sig, siginfo_t* info, void* uct)
const u64 addr64 = (u64)info->si_addr - (u64)vm::g_base_addr;
#ifdef __APPLE__
const bool is_writing = ((ucontext_t*)uct)->uc_mcontext->__es.__err & 0x2;
const bool is_writing = ((ucontext_t*)uct)->uc_mcontext->__es.__err & 0x2;
#else
const bool is_writing = ((ucontext_t*)uct)->uc_mcontext.gregs[REG_ERR] & 0x2;
#endif

View File

@ -887,6 +887,7 @@ struct cast_ppu_gpr<u32, false>
}
};
#ifdef __APPLE__
template<>
struct cast_ppu_gpr<unsigned long, false>
{
@ -900,6 +901,7 @@ struct cast_ppu_gpr<unsigned long, false>
return static_cast<unsigned long>(reg);
}
};
#endif
template<>
struct cast_ppu_gpr<u64, false>

View File

@ -100,20 +100,22 @@ namespace vm
}
};
template<>
struct cast_ptr<unsigned long>
{
__forceinline static u32 cast(const unsigned long addr, const char* func)
{
const u32 res = static_cast<u32>(addr);
if (res != addr)
{
vm::error(addr, func);
}
#ifdef __APPLE__
template<>
struct cast_ptr<unsigned long>
{
__forceinline static u32 cast(const unsigned long addr, const char* func)
{
const u32 res = static_cast<u32>(addr);
if (res != addr)
{
vm::error(addr, func);
}
return res;
}
};
return res;
}
};
#endif
template<>
struct cast_ptr<u32>