core/arm/skyeye_common: Migrate logging macros (#3684)

* core/arm/skyeye_common: Migrate logging macros

Use the new logging macros NGLOG

* Replace specifiers that were missed out

* Replace printf with NGLOG

* skyeye_common: fix NGLOG without log class
This commit is contained in:
Daniel Lim Wee Soong 2018-05-14 16:22:32 +08:00 committed by Weiyi Wang
parent e48662196f
commit 7861be67bb
5 changed files with 86 additions and 84 deletions

View File

@ -183,7 +183,7 @@ void ARMul_State::ResetMPCoreCP15Registers() {
static void CheckMemoryBreakpoint(u32 address, GDBStub::BreakpointType type) {
if (GDBStub::IsServerEnabled() && GDBStub::CheckBreakpoint(address, type)) {
LOG_DEBUG(Debug, "Found memory breakpoint @ %08x", address);
NGLOG_DEBUG(Debug, "Found memory breakpoint @ {:08x}", address);
GDBStub::Break(true);
}
}
@ -428,8 +428,8 @@ u32 ARMul_State::ReadCP15Register(u32 crn, u32 opcode_1, u32 crm, u32 opcode_2)
}
}
LOG_ERROR(Core_ARM11, "MRC CRn=%u, CRm=%u, OP1=%u OP2=%u is not implemented. Returning zero.",
crn, crm, opcode_1, opcode_2);
NGLOG_ERROR(Core_ARM11, "MRC CRn={}, CRm={}, OP1={} OP2={} is not implemented. Returning zero.",
crn, crm, opcode_1, opcode_2);
return 0;
}

View File

@ -90,24 +90,24 @@ void VMOVR(ARMul_State* state, u32 single, u32 d, u32 m) {
/* Miscellaneous functions */
s32 vfp_get_float(ARMul_State* state, unsigned int reg) {
LOG_TRACE(Core_ARM11, "VFP get float: s%d=[%08x]", reg, state->ExtReg[reg]);
NGLOG_TRACE(Core_ARM11, "VFP get float: s{}=[{:08x}]", reg, state->ExtReg[reg]);
return state->ExtReg[reg];
}
void vfp_put_float(ARMul_State* state, s32 val, unsigned int reg) {
LOG_TRACE(Core_ARM11, "VFP put float: s%d <= [%08x]", reg, val);
NGLOG_TRACE(Core_ARM11, "VFP put float: s{} <= [{:08x}]", reg, val);
state->ExtReg[reg] = val;
}
u64 vfp_get_double(ARMul_State* state, unsigned int reg) {
u64 result = ((u64)state->ExtReg[reg * 2 + 1]) << 32 | state->ExtReg[reg * 2];
LOG_TRACE(Core_ARM11, "VFP get double: s[%d-%d]=[%016llx]", reg * 2 + 1, reg * 2, result);
NGLOG_TRACE(Core_ARM11, "VFP get double: s[{}-{}]=[{:016llx}]", reg * 2 + 1, reg * 2, result);
return result;
}
void vfp_put_double(ARMul_State* state, u64 val, unsigned int reg) {
LOG_TRACE(Core_ARM11, "VFP put double: s[%d-%d] <= [%08x-%08x]", reg * 2 + 1, reg * 2,
(u32)(val >> 32), (u32)(val & 0xffffffff));
NGLOG_TRACE(Core_ARM11, "VFP put double: s[{}-{}] <= [{:08x}-{:08x}]", reg * 2 + 1, reg * 2,
(u32)(val >> 32), (u32)(val & 0xffffffff));
state->ExtReg[reg * 2] = (u32)(val & 0xffffffff);
state->ExtReg[reg * 2 + 1] = (u32)(val >> 32);
}
@ -116,10 +116,10 @@ void vfp_put_double(ARMul_State* state, u64 val, unsigned int reg) {
* Process bitmask of exception conditions. (from vfpmodule.c)
*/
void vfp_raise_exceptions(ARMul_State* state, u32 exceptions, u32 inst, u32 fpscr) {
LOG_TRACE(Core_ARM11, "VFP: raising exceptions %08x", exceptions);
NGLOG_TRACE(Core_ARM11, "VFP: raising exceptions {:08x}", exceptions);
if (exceptions == VFP_EXCEPTION_ERROR) {
LOG_CRITICAL(Core_ARM11, "unhandled bounce %x", inst);
NGLOG_CRITICAL(Core_ARM11, "unhandled bounce {:x}", inst);
Crash();
}

View File

@ -22,7 +22,7 @@
#include "core/arm/skyeye_common/vfp/vfp_helper.h" /* for references to cdp SoftFloat functions */
#define VFP_DEBUG_UNTESTED(x) LOG_TRACE(Core_ARM11, "in func %s, " #x " untested", __FUNCTION__);
#define VFP_DEBUG_UNTESTED(x) NGLOG_TRACE(Core_ARM11, "in func {}, " #x " untested", __FUNCTION__);
#define CHECK_VFP_ENABLED
#define CHECK_VFP_CDP_RET vfp_raise_exceptions(cpu, ret, inst_cream->instr, cpu->VFP[VFP_FPSCR]);

View File

@ -64,8 +64,8 @@ static struct vfp_double vfp_double_default_qnan = {
};
static void vfp_double_dump(const char* str, struct vfp_double* d) {
LOG_TRACE(Core_ARM11, "VFP: %s: sign=%d exponent=%d significand=%016llx", str, d->sign != 0,
d->exponent, d->significand);
NGLOG_TRACE(Core_ARM11, "VFP: {}: sign={} exponent={} significand={:016llx}", str, d->sign != 0,
d->exponent, d->significand);
}
static void vfp_double_normalise_denormal(struct vfp_double* vd) {
@ -166,7 +166,7 @@ u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double* vd,
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vd->sign != 0))
incr = (1ULL << (VFP_DOUBLE_LOW_BITS + 1)) - 1;
LOG_TRACE(Core_ARM11, "VFP: rounding increment = 0x%08llx", incr);
NGLOG_TRACE(Core_ARM11, "VFP: rounding increment = 0x{:08llx}", incr);
/*
* Is our rounding going to overflow?
@ -221,7 +221,8 @@ pack:
vfp_double_dump("pack: final", vd);
{
s64 d = vfp_double_pack(vd);
LOG_TRACE(Core_ARM11, "VFP: %s: d(d%d)=%016llx exceptions=%08x", func, dd, d, exceptions);
NGLOG_TRACE(Core_ARM11, "VFP: {}: d(d{})={:016llx} exceptions={:08x}", func, dd, d,
exceptions);
vfp_put_double(state, d, dd);
}
return exceptions;
@ -274,25 +275,25 @@ static u32 vfp_propagate_nan(struct vfp_double* vdd, struct vfp_double* vdn, str
* Extended operations
*/
static u32 vfp_double_fabs(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
vfp_put_double(state, vfp_double_packed_abs(vfp_get_double(state, dm)), dd);
return 0;
}
static u32 vfp_double_fcpy(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
vfp_put_double(state, vfp_get_double(state, dm), dd);
return 0;
}
static u32 vfp_double_fneg(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
vfp_put_double(state, vfp_double_packed_negate(vfp_get_double(state, dm)), dd);
return 0;
}
static u32 vfp_double_fsqrt(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
vfp_double vdm, vdd, *vdp;
int ret, tm;
u32 exceptions = 0;
@ -389,7 +390,8 @@ static u32 vfp_compare(ARMul_State* state, int dd, int signal_on_qnan, s64 m, u3
s64 d;
u32 ret = 0;
LOG_TRACE(Core_ARM11, "In %s, state=0x%p, fpscr=0x%x", __FUNCTION__, state, fpscr);
NGLOG_TRACE(Core_ARM11, "In {}, state=0x{}, fpscr=0x{:x}", __FUNCTION__, fmt::ptr(state),
fpscr);
if (vfp_double_packed_exponent(m) == 2047 && vfp_double_packed_mantissa(m)) {
ret |= FPSCR_CFLAG | FPSCR_VFLAG;
if (signal_on_qnan ||
@ -445,28 +447,28 @@ static u32 vfp_compare(ARMul_State* state, int dd, int signal_on_qnan, s64 m, u3
ret |= FPSCR_CFLAG;
}
}
LOG_TRACE(Core_ARM11, "In %s, state=0x%p, ret=0x%x", __FUNCTION__, state, ret);
NGLOG_TRACE(Core_ARM11, "In {}, state=0x{}, ret=0x{:x}", __FUNCTION__, fmt::ptr(state), ret);
return ret;
}
static u32 vfp_double_fcmp(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_compare(state, dd, 0, vfp_get_double(state, dm), fpscr);
}
static u32 vfp_double_fcmpe(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_compare(state, dd, 1, vfp_get_double(state, dm), fpscr);
}
static u32 vfp_double_fcmpz(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_compare(state, dd, 0, 0, fpscr);
}
static u32 vfp_double_fcmpez(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_compare(state, dd, 1, 0, fpscr);
}
@ -476,7 +478,7 @@ static u32 vfp_double_fcvts(ARMul_State* state, int sd, int unused, int dm, u32
int tm;
u32 exceptions = 0;
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
tm = vfp_double_type(&vdm);
@ -517,7 +519,7 @@ static u32 vfp_double_fuito(ARMul_State* state, int dd, int unused, int dm, u32
struct vfp_double vdm;
u32 m = vfp_get_float(state, dm);
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
vdm.sign = 0;
vdm.exponent = 1023 + 63 - 1;
vdm.significand = (u64)m;
@ -529,7 +531,7 @@ static u32 vfp_double_fsito(ARMul_State* state, int dd, int unused, int dm, u32
struct vfp_double vdm;
u32 m = vfp_get_float(state, dm);
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
vdm.sign = (m & 0x80000000) >> 16;
vdm.exponent = 1023 + 63 - 1;
vdm.significand = vdm.sign ? (~m + 1) : m;
@ -543,7 +545,7 @@ static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32
int rmode = fpscr & FPSCR_RMODE_MASK;
int tm;
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
/*
@ -612,7 +614,7 @@ static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32
}
}
LOG_TRACE(Core_ARM11, "VFP: ftoui: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
NGLOG_TRACE(Core_ARM11, "VFP: ftoui: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
vfp_put_float(state, d, sd);
@ -620,7 +622,7 @@ static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32
}
static u32 vfp_double_ftouiz(ARMul_State* state, int sd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_double_ftoui(state, sd, unused, dm,
(fpscr & ~FPSCR_RMODE_MASK) | FPSCR_ROUND_TOZERO);
}
@ -631,7 +633,7 @@ static u32 vfp_double_ftosi(ARMul_State* state, int sd, int unused, int dm, u32
int rmode = fpscr & FPSCR_RMODE_MASK;
int tm;
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
vfp_double_dump("VDM", &vdm);
@ -695,7 +697,7 @@ static u32 vfp_double_ftosi(ARMul_State* state, int sd, int unused, int dm, u32
}
}
LOG_TRACE(Core_ARM11, "VFP: ftosi: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
NGLOG_TRACE(Core_ARM11, "VFP: ftosi: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
vfp_put_float(state, (s32)d, sd);
@ -703,7 +705,7 @@ static u32 vfp_double_ftosi(ARMul_State* state, int sd, int unused, int dm, u32
}
static u32 vfp_double_ftosiz(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_double_ftosi(state, dd, unused, dm,
(fpscr & ~FPSCR_RMODE_MASK) | FPSCR_ROUND_TOZERO);
}
@ -785,7 +787,7 @@ u32 vfp_double_add(struct vfp_double* vdd, struct vfp_double* vdn, struct vfp_do
u64 m_sig;
if (vdn->significand & (1ULL << 63) || vdm->significand & (1ULL << 63)) {
LOG_INFO(Core_ARM11, "VFP: bad FP values in %s", __func__);
NGLOG_INFO(Core_ARM11, "VFP: bad FP values in {}", __func__);
vfp_double_dump("VDN", vdn);
vfp_double_dump("VDM", vdm);
}
@ -850,7 +852,7 @@ u32 vfp_double_multiply(struct vfp_double* vdd, struct vfp_double* vdn, struct v
*/
if (vdn->exponent < vdm->exponent) {
std::swap(vdm, vdn);
LOG_TRACE(Core_ARM11, "VFP: swapping M <-> N");
NGLOG_TRACE(Core_ARM11, "VFP: swapping M <-> N");
}
vdd->sign = vdn->sign ^ vdm->sign;
@ -932,7 +934,7 @@ static u32 vfp_double_multiply_accumulate(ARMul_State* state, int dd, int dn, in
* sd = sd + (sn * sm)
*/
static u32 vfp_double_fmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, 0, "fmac");
}
@ -940,7 +942,7 @@ static u32 vfp_double_fmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
* sd = sd - (sn * sm)
*/
static u32 vfp_double_fnmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_MULTIPLY, "fnmac");
}
@ -948,7 +950,7 @@ static u32 vfp_double_fnmac(ARMul_State* state, int dd, int dn, int dm, u32 fpsc
* sd = -sd + (sn * sm)
*/
static u32 vfp_double_fmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT, "fmsc");
}
@ -956,7 +958,7 @@ static u32 vfp_double_fmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
* sd = -sd - (sn * sm)
*/
static u32 vfp_double_fnmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr) {
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT | NEG_MULTIPLY,
"fnmsc");
}
@ -968,7 +970,7 @@ static u32 vfp_double_fmul(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
struct vfp_double vdd, vdn, vdm;
u32 exceptions = 0;
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
if (vdn.exponent == 0 && vdn.significand)
vfp_double_normalise_denormal(&vdn);
@ -988,7 +990,7 @@ static u32 vfp_double_fnmul(ARMul_State* state, int dd, int dn, int dm, u32 fpsc
struct vfp_double vdd, vdn, vdm;
u32 exceptions = 0;
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
if (vdn.exponent == 0 && vdn.significand)
vfp_double_normalise_denormal(&vdn);
@ -1010,7 +1012,7 @@ static u32 vfp_double_fadd(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
struct vfp_double vdd, vdn, vdm;
u32 exceptions = 0;
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
if (vdn.exponent == 0 && vdn.significand)
vfp_double_normalise_denormal(&vdn);
@ -1031,7 +1033,7 @@ static u32 vfp_double_fsub(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
struct vfp_double vdd, vdn, vdm;
u32 exceptions = 0;
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
if (vdn.exponent == 0 && vdn.significand)
vfp_double_normalise_denormal(&vdn);
@ -1058,7 +1060,7 @@ static u32 vfp_double_fdiv(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
u32 exceptions = 0;
int tm, tn;
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
exceptions |= vfp_double_unpack(&vdn, vfp_get_double(state, dn), fpscr);
exceptions |= vfp_double_unpack(&vdm, vfp_get_double(state, dm), fpscr);
@ -1176,7 +1178,7 @@ u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
unsigned int vecitr, veclen, vecstride;
struct op* fop;
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
NGLOG_TRACE(Core_ARM11, "In {}", __FUNCTION__);
vecstride = (1 + ((fpscr & FPSCR_STRIDE_MASK) == FPSCR_STRIDE_MASK));
fop = (op == FOP_EXT) ? &fops_ext[FEXT_TO_IDX(inst)] : &fops[FOP_TO_IDX(op)];
@ -1207,11 +1209,11 @@ u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
else
veclen = fpscr & FPSCR_LENGTH_MASK;
LOG_TRACE(Core_ARM11, "VFP: vecstride=%u veclen=%u", vecstride,
(veclen >> FPSCR_LENGTH_BIT) + 1);
NGLOG_TRACE(Core_ARM11, "VFP: vecstride={} veclen={}", vecstride,
(veclen >> FPSCR_LENGTH_BIT) + 1);
if (!fop->fn) {
printf("VFP: could not find double op %d\n", FEXT_TO_IDX(inst));
NGLOG_TRACE(Core_ARM11, "VFP: could not find double op {}", FEXT_TO_IDX(inst));
goto invalid;
}
@ -1221,14 +1223,15 @@ u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
type = (fop->flags & OP_SD) ? 's' : 'd';
if (op == FOP_EXT)
LOG_TRACE(Core_ARM11, "VFP: itr%d (%c%u) = op[%u] (d%u)", vecitr >> FPSCR_LENGTH_BIT,
type, dest, dn, dm);
NGLOG_TRACE(Core_ARM11, "VFP: itr{} ({}{}) = op[{}] (d{})", vecitr >> FPSCR_LENGTH_BIT,
type, dest, dn, dm);
else
LOG_TRACE(Core_ARM11, "VFP: itr%d (%c%u) = (d%u) op[%u] (d%u)",
vecitr >> FPSCR_LENGTH_BIT, type, dest, dn, FOP_TO_IDX(op), dm);
NGLOG_TRACE(Core_ARM11, "VFP: itr{} ({}{}) = (d{}) op[{}] (d{})",
vecitr >> FPSCR_LENGTH_BIT, type, dest, dn, FOP_TO_IDX(op), dm);
except = fop->fn(state, dest, dn, dm, fpscr);
LOG_TRACE(Core_ARM11, "VFP: itr%d: exceptions=%08x", vecitr >> FPSCR_LENGTH_BIT, except);
NGLOG_TRACE(Core_ARM11, "VFP: itr{}: exceptions={:08x}", vecitr >> FPSCR_LENGTH_BIT,
except);
exceptions |= except & ~VFP_NAN_FLAG;

View File

@ -52,7 +52,6 @@
*/
#include <algorithm>
#include <cinttypes>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/logging/log.h"
@ -67,8 +66,8 @@ static struct vfp_single vfp_single_default_qnan = {
};
static void vfp_single_dump(const char* str, struct vfp_single* s) {
LOG_TRACE(Core_ARM11, "%s: sign=%d exponent=%d significand=%08x", str, s->sign != 0,
s->exponent, s->significand);
NGLOG_TRACE(Core_ARM11, "{}: sign={} exponent={} significand={:08x}", str, s->sign != 0,
s->exponent, s->significand);
}
static void vfp_single_normalise_denormal(struct vfp_single* vs) {
@ -169,7 +168,7 @@ u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single* vs,
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vs->sign != 0))
incr = (1 << (VFP_SINGLE_LOW_BITS + 1)) - 1;
LOG_TRACE(Core_ARM11, "rounding increment = 0x%08x", incr);
NGLOG_TRACE(Core_ARM11, "rounding increment = 0x{:08x}", incr);
/*
* Is our rounding going to overflow?
@ -224,7 +223,7 @@ pack:
vfp_single_dump("pack: final", vs);
{
s32 d = vfp_single_pack(vs);
LOG_TRACE(Core_ARM11, "%s: d(s%d)=%08x exceptions=%08x", func, sd, d, exceptions);
NGLOG_TRACE(Core_ARM11, "{}: d(s{})={:08x} exceptions={:08x}", func, sd, d, exceptions);
vfp_put_float(state, d, sd);
}
@ -307,7 +306,7 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand) {
u32 z, a;
if ((significand & 0xc0000000) != 0x40000000) {
LOG_TRACE(Core_ARM11, "invalid significand");
NGLOG_TRACE(Core_ARM11, "invalid significand");
}
a = significand << 1;
@ -397,7 +396,7 @@ static u32 vfp_single_fsqrt(ARMul_State* state, int sd, int unused, s32 m, u32 f
term = (u64)vsd.significand * vsd.significand;
rem = ((u64)vsm.significand << 32) - term;
LOG_TRACE(Core_ARM11, "term=%016" PRIx64 "rem=%016" PRIx64, term, rem);
NGLOG_TRACE(Core_ARM11, "term={} rem={}", term, rem);
while (rem < 0) {
vsd.significand -= 1;
@ -636,7 +635,7 @@ static u32 vfp_single_ftoui(ARMul_State* state, int sd, int unused, s32 m, u32 f
}
}
LOG_TRACE(Core_ARM11, "ftoui: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
NGLOG_TRACE(Core_ARM11, "ftoui: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
vfp_put_float(state, d, sd);
@ -717,7 +716,7 @@ static u32 vfp_single_ftosi(ARMul_State* state, int sd, int unused, s32 m, u32 f
}
}
LOG_TRACE(Core_ARM11, "ftosi: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
NGLOG_TRACE(Core_ARM11, "ftosi: d(s{})={:08x} exceptions={:08x}", sd, d, exceptions);
vfp_put_float(state, (s32)d, sd);
@ -804,7 +803,7 @@ static u32 vfp_single_add(struct vfp_single* vsd, struct vfp_single* vsn, struct
u32 exp_diff, m_sig;
if (vsn->significand & 0x80000000 || vsm->significand & 0x80000000) {
LOG_WARNING(Core_ARM11, "bad FP values");
NGLOG_WARNING(Core_ARM11, "bad FP values");
vfp_single_dump("VSN", vsn);
vfp_single_dump("VSM", vsm);
}
@ -869,7 +868,7 @@ static u32 vfp_single_multiply(struct vfp_single* vsd, struct vfp_single* vsn,
*/
if (vsn->exponent < vsm->exponent) {
std::swap(vsm, vsn);
LOG_TRACE(Core_ARM11, "swapping M <-> N");
NGLOG_TRACE(Core_ARM11, "swapping M <-> N");
}
vsd->sign = vsn->sign ^ vsm->sign;
@ -921,7 +920,7 @@ static u32 vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s3
s32 v;
v = vfp_get_float(state, sn);
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, v);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, v);
exceptions |= vfp_single_unpack(&vsn, v, fpscr);
if (vsn.exponent == 0 && vsn.significand)
vfp_single_normalise_denormal(&vsn);
@ -936,7 +935,7 @@ static u32 vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s3
vsp.sign = vfp_sign_negate(vsp.sign);
v = vfp_get_float(state, sd);
LOG_TRACE(Core_ARM11, "s%u = %08x", sd, v);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sd, v);
exceptions |= vfp_single_unpack(&vsn, v, fpscr);
if (vsn.exponent == 0 && vsn.significand != 0)
vfp_single_normalise_denormal(&vsn);
@ -957,7 +956,7 @@ static u32 vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s3
* sd = sd + (sn * sm)
*/
static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
}
@ -966,7 +965,7 @@ static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
*/
static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
// TODO: this one has its arguments inverted, investigate.
LOG_TRACE(Core_ARM11, "s%u = %08x", sd, sn);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sd, sn);
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_MULTIPLY, "fnmac");
}
@ -974,7 +973,7 @@ static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
* sd = -sd + (sn * sm)
*/
static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT, "fmsc");
}
@ -982,7 +981,7 @@ static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
* sd = -sd - (sn * sm)
*/
static u32 vfp_single_fnmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT | NEG_MULTIPLY,
"fnmsc");
}
@ -995,7 +994,7 @@ static u32 vfp_single_fmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
u32 exceptions = 0;
s32 n = vfp_get_float(state, sn);
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
exceptions |= vfp_single_unpack(&vsn, n, fpscr);
if (vsn.exponent == 0 && vsn.significand)
@ -1017,7 +1016,7 @@ static u32 vfp_single_fnmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
u32 exceptions = 0;
s32 n = vfp_get_float(state, sn);
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
exceptions |= vfp_single_unpack(&vsn, n, fpscr);
if (vsn.exponent == 0 && vsn.significand)
@ -1040,7 +1039,7 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
u32 exceptions = 0;
s32 n = vfp_get_float(state, sn);
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
/*
* Unpack and normalise denormals.
@ -1062,7 +1061,7 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
* sd = sn - sm
*/
static u32 vfp_single_fsub(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, sd);
/*
* Subtraction is addition with one sign inverted. Unpack the second operand to perform FTZ if
* necessary, we can't let fadd do this because a denormal in m might get flushed to +0 in FTZ
@ -1091,7 +1090,7 @@ static u32 vfp_single_fdiv(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
s32 n = vfp_get_float(state, sn);
int tm, tn;
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
NGLOG_TRACE(Core_ARM11, "s{} = {:08x}", sn, n);
exceptions |= vfp_single_unpack(&vsn, n, fpscr);
exceptions |= vfp_single_unpack(&vsm, m, fpscr);
@ -1231,11 +1230,11 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
else
veclen = fpscr & FPSCR_LENGTH_MASK;
LOG_TRACE(Core_ARM11, "vecstride=%u veclen=%u", vecstride, (veclen >> FPSCR_LENGTH_BIT) + 1);
NGLOG_TRACE(Core_ARM11, "vecstride={} veclen={}", vecstride, (veclen >> FPSCR_LENGTH_BIT) + 1);
if (!fop->fn) {
LOG_CRITICAL(Core_ARM11, "could not find single op %d, inst=0x%x@0x%x", FEXT_TO_IDX(inst),
inst, state->Reg[15]);
NGLOG_CRITICAL(Core_ARM11, "could not find single op {}, inst=0x{:x}@0x{:x}",
FEXT_TO_IDX(inst), inst, state->Reg[15]);
Crash();
goto invalid;
}
@ -1247,14 +1246,14 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr) {
type = (fop->flags & OP_DD) ? 'd' : 's';
if (op == FOP_EXT)
LOG_TRACE(Core_ARM11, "itr%d (%c%u) = op[%u] (s%u=%08x)", vecitr >> FPSCR_LENGTH_BIT,
type, dest, sn, sm, m);
NGLOG_TRACE(Core_ARM11, "itr{} ({}{}) = op[{}] (s{}={:08x})",
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn, sm, m);
else
LOG_TRACE(Core_ARM11, "itr%d (%c%u) = (s%u) op[%u] (s%u=%08x)",
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn, FOP_TO_IDX(op), sm, m);
NGLOG_TRACE(Core_ARM11, "itr{} ({}{}) = (s{}) op[{}] (s{}={:08x})",
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn, FOP_TO_IDX(op), sm, m);
except = fop->fn(state, dest, sn, m, fpscr);
LOG_TRACE(Core_ARM11, "itr%d: exceptions=%08x", vecitr >> FPSCR_LENGTH_BIT, except);
NGLOG_TRACE(Core_ARM11, "itr{}: exceptions={:08x}", vecitr >> FPSCR_LENGTH_BIT, except);
exceptions |= except & ~VFP_NAN_FLAG;