Common: Remove src/common/logging/log.*
This commit is contained in:
parent
07eaf100ba
commit
181f78f36e
13 changed files with 124 additions and 222 deletions
|
@ -5,7 +5,6 @@ set(SRCS
|
||||||
backend_x64/interface_x64.cpp
|
backend_x64/interface_x64.cpp
|
||||||
backend_x64/reg_alloc.cpp
|
backend_x64/reg_alloc.cpp
|
||||||
backend_x64/routines.cpp
|
backend_x64/routines.cpp
|
||||||
common/logging/log.cpp
|
|
||||||
common/memory_util.cpp
|
common/memory_util.cpp
|
||||||
common/string_util.cpp
|
common/string_util.cpp
|
||||||
common/x64/abi.cpp
|
common/x64/abi.cpp
|
||||||
|
@ -28,7 +27,6 @@ set(HEADERS
|
||||||
common/bit_util.h
|
common/bit_util.h
|
||||||
common/code_block.h
|
common/code_block.h
|
||||||
common/common_types.h
|
common/common_types.h
|
||||||
common/logging/log.h
|
|
||||||
common/memory_util.h
|
common/memory_util.h
|
||||||
common/mp.h
|
common/mp.h
|
||||||
common/scope_exit.h
|
common/scope_exit.h
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
|
|
||||||
// For asserts we'd like to keep all the junk executed when an assert happens away from the
|
// For asserts we'd like to keep all the junk executed when an assert happens away from the
|
||||||
// important code in the function. One way of doing this is to put all the relevant code inside a
|
// important code in the function. One way of doing this is to put all the relevant code inside a
|
||||||
// lambda and force the compiler to not inline it. Unfortunately, MSVC seems to have no syntax to
|
// lambda and force the compiler to not inline it. Unfortunately, MSVC seems to have no syntax to
|
||||||
|
@ -28,13 +27,13 @@ static void assert_noinline_call(const Fn& fn) {
|
||||||
|
|
||||||
#define ASSERT(_a_) \
|
#define ASSERT(_a_) \
|
||||||
do if (!(_a_)) { assert_noinline_call([] { \
|
do if (!(_a_)) { assert_noinline_call([] { \
|
||||||
LOG_CRITICAL(Debug, "Assertion Failed!"); \
|
fprintf(stderr, "Assertion Failed!\n" #_a_); \
|
||||||
throw ""; \
|
throw ""; \
|
||||||
}); } while (0)
|
}); } while (0)
|
||||||
|
|
||||||
#define ASSERT_MSG(_a_, ...) \
|
#define ASSERT_MSG(_a_, ...) \
|
||||||
do if (!(_a_)) { assert_noinline_call([&] { \
|
do if (!(_a_)) { assert_noinline_call([&] { \
|
||||||
LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); \
|
fprintf(stderr, "Assertion Failed!\n" #_a_ "\n" __VA_ARGS__); \
|
||||||
throw ""; \
|
throw ""; \
|
||||||
}); } while (0)
|
}); } while (0)
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* This software may be used and distributed according to the terms of the GNU
|
|
||||||
* General Public License version 2 or any later version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <cstdarg>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
|
|
||||||
namespace Log {
|
|
||||||
|
|
||||||
void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_nr, const char* function, const char* format, ...) {
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
vprintf(format, args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Log
|
|
|
@ -1,69 +0,0 @@
|
||||||
// Copyright 2014 Citra Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
|
||||||
|
|
||||||
namespace Log {
|
|
||||||
|
|
||||||
/// Specifies the severity or level of detail of the log message.
|
|
||||||
enum class Level : u8 {
|
|
||||||
Trace, ///< Extremely detailed and repetitive debugging information that is likely to
|
|
||||||
/// pollute logs.
|
|
||||||
Debug, ///< Less detailed debugging information.
|
|
||||||
Info, ///< Status information from important points during execution.
|
|
||||||
Warning, ///< Minor or potential problems found during execution of a task.
|
|
||||||
Error, ///< Major problems found during execution of a task that prevent it from being
|
|
||||||
/// completed.
|
|
||||||
Critical, ///< Major problems during execution that threathen the stability of the entire
|
|
||||||
/// application.
|
|
||||||
|
|
||||||
Count ///< Total number of logging levels
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef u8 ClassType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the sub-system that generated the log message.
|
|
||||||
*
|
|
||||||
* @note If you add a new entry here, also add a corresponding one to `ALL_LOG_CLASSES` in backend.cpp.
|
|
||||||
*/
|
|
||||||
enum class Class : ClassType {
|
|
||||||
Log,
|
|
||||||
Common,
|
|
||||||
Common_Memory,
|
|
||||||
Core_ARM11,
|
|
||||||
Debug,
|
|
||||||
Count ///< Total number of logging classes
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Logs a message to the global logger.
|
|
||||||
void LogMessage(Class log_class, Level log_level,
|
|
||||||
const char* filename, unsigned int line_nr, const char* function,
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
_Printf_format_string_
|
|
||||||
#endif
|
|
||||||
const char* format, ...)
|
|
||||||
#if defined(__GNUC__) && !defined(__clang__)
|
|
||||||
__attribute__((format(gnu_printf, 6, 7)))
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
} // namespace Log
|
|
||||||
|
|
||||||
#define LOG_GENERIC(log_class, log_level, ...) \
|
|
||||||
::Log::LogMessage(log_class, log_level, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#define LOG_TRACE( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Trace, __VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define LOG_TRACE( log_class, ...) (void(0))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LOG_DEBUG( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Debug, __VA_ARGS__)
|
|
||||||
#define LOG_INFO( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Info, __VA_ARGS__)
|
|
||||||
#define LOG_WARNING( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Warning, __VA_ARGS__)
|
|
||||||
#define LOG_ERROR( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Error, __VA_ARGS__)
|
|
||||||
#define LOG_CRITICAL(log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Critical, __VA_ARGS__)
|
|
|
@ -2,8 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "common/memory_util.h"
|
#include "common/memory_util.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -80,7 +79,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
|
||||||
{
|
{
|
||||||
ptr = nullptr;
|
ptr = nullptr;
|
||||||
#endif
|
#endif
|
||||||
LOG_ERROR(Common_Memory, "Failed to allocate executable memory");
|
ASSERT_MSG(false, "Failed to allocate executable memory");
|
||||||
}
|
}
|
||||||
#if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT)
|
#if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT)
|
||||||
else
|
else
|
||||||
|
@ -95,7 +94,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
|
||||||
|
|
||||||
#if EMU_ARCH_BITS == 64
|
#if EMU_ARCH_BITS == 64
|
||||||
if ((u64)ptr >= 0x80000000 && low == true)
|
if ((u64)ptr >= 0x80000000 && low == true)
|
||||||
LOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!");
|
ASSERT_MSG(false, "Executable memory ended up above 2GB!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
|
@ -114,7 +113,7 @@ void* AllocateMemoryPages(size_t size)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ptr == nullptr)
|
if (ptr == nullptr)
|
||||||
LOG_ERROR(Common_Memory, "Failed to allocate raw memory");
|
ASSERT_MSG(false, "Failed to allocate raw memory");
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
@ -129,12 +128,12 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
|
||||||
ptr = memalign(alignment, size);
|
ptr = memalign(alignment, size);
|
||||||
#else
|
#else
|
||||||
if (posix_memalign(&ptr, alignment, size) != 0)
|
if (posix_memalign(&ptr, alignment, size) != 0)
|
||||||
LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
|
ASSERT_MSG(false, "Failed to allocate aligned memory");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ptr == nullptr)
|
if (ptr == nullptr)
|
||||||
LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
|
ASSERT_MSG(false, "Failed to allocate aligned memory");
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +144,7 @@ void FreeMemoryPages(void* ptr, size_t size)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
||||||
LOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n%s", GetLastErrorMsg());
|
ASSERT_MSG(false, "FreeMemoryPages failed!\n%s", GetLastErrorMsg());
|
||||||
#else
|
#else
|
||||||
munmap(ptr, size);
|
munmap(ptr, size);
|
||||||
#endif
|
#endif
|
||||||
|
@ -169,7 +168,7 @@ void WriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD oldValue;
|
DWORD oldValue;
|
||||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
|
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
|
||||||
LOG_ERROR(Common_Memory, "WriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
ASSERT_MSG(false, "WriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||||
#else
|
#else
|
||||||
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ);
|
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ);
|
||||||
#endif
|
#endif
|
||||||
|
@ -180,7 +179,7 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD oldValue;
|
DWORD oldValue;
|
||||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue))
|
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue))
|
||||||
LOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
ASSERT_MSG(false, "UnWriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||||
#else
|
#else
|
||||||
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);
|
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "common/memory_util.h"
|
#include "common/memory_util.h"
|
||||||
|
|
||||||
#include "abi.h"
|
#include "abi.h"
|
||||||
|
@ -1316,7 +1315,7 @@ void XEmitter::XOR (int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); W
|
||||||
void XEmitter::MOV (int bits, const OpArg& a1, const OpArg& a2)
|
void XEmitter::MOV (int bits, const OpArg& a1, const OpArg& a2)
|
||||||
{
|
{
|
||||||
if (a1.IsSimpleReg() && a2.IsSimpleReg() && a1.GetSimpleReg() == a2.GetSimpleReg())
|
if (a1.IsSimpleReg() && a2.IsSimpleReg() && a1.GetSimpleReg() == a2.GetSimpleReg())
|
||||||
LOG_ERROR(Common, "Redundant MOV @ %p - bug in JIT?", code);
|
ASSERT_MSG(false, "Redundant MOV @ %p - bug in JIT?", code);
|
||||||
WriteNormalOp(this, bits, nrmMOV, a1, a2);
|
WriteNormalOp(this, bits, nrmMOV, a1, a2);
|
||||||
}
|
}
|
||||||
void XEmitter::TEST(int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmTEST, a1, a2);}
|
void XEmitter::TEST(int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmTEST, a1, a2);}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/logging/log.h"
|
|
||||||
|
|
||||||
#include "skyeye_interpreter/dyncom/arm_dyncom_dec.h"
|
#include "skyeye_interpreter/dyncom/arm_dyncom_dec.h"
|
||||||
#include "skyeye_interpreter/dyncom/arm_dyncom_interpreter.h"
|
#include "skyeye_interpreter/dyncom/arm_dyncom_interpreter.h"
|
||||||
|
@ -245,7 +245,7 @@ struct ldst_inst {
|
||||||
unsigned int inst;
|
unsigned int inst;
|
||||||
get_addr_fp_t get_addr;
|
get_addr_fp_t get_addr;
|
||||||
};
|
};
|
||||||
#define DEBUG_MSG LOG_DEBUG(Core_ARM11, "inst is %x", inst); CITRA_IGNORE_EXIT(0)
|
#define DEBUG_MSG //LOG_DEBUG(Core_ARM11, "inst is %x", inst); CITRA_IGNORE_EXIT(0)
|
||||||
|
|
||||||
#define LnSWoUB(s) glue(LnSWoUB, s)
|
#define LnSWoUB(s) glue(LnSWoUB, s)
|
||||||
#define MLnS(s) glue(MLnS, s)
|
#define MLnS(s) glue(MLnS, s)
|
||||||
|
@ -1131,7 +1131,7 @@ static inline void *AllocBuffer(unsigned int size) {
|
||||||
int start = top;
|
int start = top;
|
||||||
top += size;
|
top += size;
|
||||||
if (top > CACHE_BUFFER_SIZE) {
|
if (top > CACHE_BUFFER_SIZE) {
|
||||||
LOG_ERROR(Core_ARM11, "inst_buf is full");
|
ASSERT_MSG(false, "inst_buf is full");
|
||||||
CITRA_IGNORE_EXIT(-1);
|
CITRA_IGNORE_EXIT(-1);
|
||||||
}
|
}
|
||||||
return (void *)&inst_buf[start];
|
return (void *)&inst_buf[start];
|
||||||
|
@ -1383,7 +1383,7 @@ static ARM_INST_PTR INTERPRETER_TRANSLATE(cdp)(unsigned int inst, int index) {
|
||||||
inst_cream->opcode_1 = BITS(inst, 20, 23);
|
inst_cream->opcode_1 = BITS(inst, 20, 23);
|
||||||
inst_cream->inst = inst;
|
inst_cream->inst = inst;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "inst %x index %x", inst, index);
|
//LOG_TRACE(Core_ARM11, "inst %x index %x", inst, index);
|
||||||
return inst_base;
|
return inst_base;
|
||||||
}
|
}
|
||||||
static ARM_INST_PTR INTERPRETER_TRANSLATE(clrex)(unsigned int inst, int index)
|
static ARM_INST_PTR INTERPRETER_TRANSLATE(clrex)(unsigned int inst, int index)
|
||||||
|
@ -3424,7 +3424,7 @@ static ThumbDecodeStatus DecodeThumbInstruction(u32 inst, u32 addr, u32* arm_ins
|
||||||
inst_index = table_length - 4;
|
inst_index = table_length - 4;
|
||||||
*ptr_inst_base = arm_instruction_trans[inst_index](tinstr, inst_index);
|
*ptr_inst_base = arm_instruction_trans[inst_index](tinstr, inst_index);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Core_ARM11, "thumb decoder error");
|
ASSERT_MSG(false, "thumb decoder error");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 28:
|
case 28:
|
||||||
|
@ -3480,8 +3480,8 @@ static unsigned int InterpreterTranslateInstruction(const ARMul_State* cpu, cons
|
||||||
|
|
||||||
int idx;
|
int idx;
|
||||||
if (DecodeARMInstruction(inst, &idx) == ARMDecodeStatus::FAILURE) {
|
if (DecodeARMInstruction(inst, &idx) == ARMDecodeStatus::FAILURE) {
|
||||||
LOG_ERROR(Core_ARM11, "Decode failure.\tPC : [0x%x]\tInstruction : %s [%x]", phys_addr, "", inst);
|
ASSERT_MSG(false, "Decode failure.\tPC : [0x%x]\tInstruction : %s [%x]", phys_addr, "", inst);
|
||||||
LOG_ERROR(Core_ARM11, "cpsr=0x%x, cpu->TFlag=%d, r15=0x%x", cpu->Cpsr, cpu->TFlag, cpu->Reg[15]);
|
ASSERT_MSG(false, "cpsr=0x%x, cpu->TFlag=%d, r15=0x%x", cpu->Cpsr, cpu->TFlag, cpu->Reg[15]);
|
||||||
CITRA_IGNORE_EXIT(-1);
|
CITRA_IGNORE_EXIT(-1);
|
||||||
}
|
}
|
||||||
inst_base = arm_instruction_trans[idx](inst, idx);
|
inst_base = arm_instruction_trans[idx](inst, idx);
|
||||||
|
@ -4002,8 +4002,8 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
BKPT_INST:
|
BKPT_INST:
|
||||||
{
|
{
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
bkpt_inst* const inst_cream = (bkpt_inst*)inst_base->component;
|
//bkpt_inst* const inst_cream = (bkpt_inst*)inst_base->component;
|
||||||
LOG_DEBUG(Core_ARM11, "Breakpoint instruction hit. Immediate: 0x%08X", inst_cream->imm);
|
//LOG_DEBUG(Core_ARM11, "Breakpoint instruction hit. Immediate: 0x%08X", inst_cream->imm);
|
||||||
}
|
}
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
INC_PC(sizeof(bkpt_inst));
|
INC_PC(sizeof(bkpt_inst));
|
||||||
|
@ -4576,7 +4576,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
mcr_inst* inst_cream = (mcr_inst*)inst_base->component;
|
mcr_inst* inst_cream = (mcr_inst*)inst_base->component;
|
||||||
|
|
||||||
unsigned int inst = inst_cream->inst;
|
//unsigned int inst = inst_cream->inst;
|
||||||
if (inst_cream->Rd == 15) {
|
if (inst_cream->Rd == 15) {
|
||||||
DEBUG_MSG;
|
DEBUG_MSG;
|
||||||
} else {
|
} else {
|
||||||
|
@ -4597,7 +4597,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component;
|
mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component;
|
||||||
|
|
||||||
LOG_ERROR(Core_ARM11, "MCRR executed | Coprocessor: %u, CRm %u, opc1: %u, Rt: %u, Rt2: %u",
|
ASSERT_MSG(false, "MCRR executed | Coprocessor: %u, CRm %u, opc1: %u, Rt: %u, Rt2: %u",
|
||||||
inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt, inst_cream->rt2);
|
inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt, inst_cream->rt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4683,7 +4683,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component;
|
mcrr_inst* const inst_cream = (mcrr_inst*)inst_base->component;
|
||||||
|
|
||||||
LOG_ERROR(Core_ARM11, "MRRC executed | Coprocessor: %u, CRm %u, opc1: %u, Rt: %u, Rt2: %u",
|
ASSERT_MSG(false, "MRRC executed | Coprocessor: %u, CRm %u, opc1: %u, Rt: %u, Rt2: %u",
|
||||||
inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt, inst_cream->rt2);
|
inst_cream->cp_num, inst_cream->crm, inst_cream->opcode_1, inst_cream->rt, inst_cream->rt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5326,7 +5326,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
else
|
else
|
||||||
cpu->Cpsr &= ~(1 << 9);
|
cpu->Cpsr &= ~(1 << 9);
|
||||||
|
|
||||||
LOG_WARNING(Core_ARM11, "SETEND %s executed", big_endian ? "BE" : "LE");
|
//LOG_WARNING(Core_ARM11, "SETEND %s executed", big_endian ? "BE" : "LE");
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
INC_PC(sizeof(setend_inst));
|
INC_PC(sizeof(setend_inst));
|
||||||
|
@ -5338,7 +5338,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
{
|
{
|
||||||
// Stubbed, as SEV is a hint instruction.
|
// Stubbed, as SEV is a hint instruction.
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
LOG_TRACE(Core_ARM11, "SEV executed.");
|
//LOG_TRACE(Core_ARM11, "SEV executed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
|
@ -6826,7 +6826,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
{
|
{
|
||||||
// Stubbed, as WFE is a hint instruction.
|
// Stubbed, as WFE is a hint instruction.
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
LOG_TRACE(Core_ARM11, "WFE executed.");
|
//LOG_TRACE(Core_ARM11, "WFE executed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
|
@ -6839,7 +6839,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
{
|
{
|
||||||
// Stubbed, as WFI is a hint instruction.
|
// Stubbed, as WFI is a hint instruction.
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
LOG_TRACE(Core_ARM11, "WFI executed.");
|
//LOG_TRACE(Core_ARM11, "WFI executed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
|
@ -6852,7 +6852,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
|
||||||
{
|
{
|
||||||
// Stubbed, as YIELD is a hint instruction.
|
// Stubbed, as YIELD is a hint instruction.
|
||||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||||
LOG_TRACE(Core_ARM11, "YIELD executed.");
|
//LOG_TRACE(Core_ARM11, "YIELD executed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->Reg[15] += cpu->GetInstructionSize();
|
cpu->Reg[15] += cpu->GetInstructionSize();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "common/logging/log.h"
|
#include "common/assert.h"
|
||||||
#include "skyeye_interpreter/skyeye_common/armstate.h"
|
#include "skyeye_interpreter/skyeye_common/armstate.h"
|
||||||
#include "skyeye_interpreter/skyeye_common/vfp/vfp.h"
|
#include "skyeye_interpreter/skyeye_common/vfp/vfp.h"
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ 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);
|
ASSERT_MSG(false, "MRC CRn=%u, CRm=%u, OP1=%u OP2=%u is not implemented. Returning zero.", crn, crm, opcode_1, opcode_2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
|
|
||||||
#include "skyeye_interpreter/skyeye_common/arm_regformat.h"
|
#include "skyeye_interpreter/skyeye_common/arm_regformat.h"
|
||||||
#include "skyeye_interpreter/skyeye_common/armstate.h"
|
#include "skyeye_interpreter/skyeye_common/armstate.h"
|
||||||
#include "skyeye_interpreter/skyeye_common/armsupp.h"
|
#include "skyeye_interpreter/skyeye_common/armsupp.h"
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
/* Note: this file handles interface with arm core and vfp registers */
|
/* Note: this file handles interface with arm core and vfp registers */
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/logging/log.h"
|
|
||||||
|
|
||||||
#include "skyeye_interpreter/skyeye_common/armstate.h"
|
#include "skyeye_interpreter/skyeye_common/armstate.h"
|
||||||
#include "skyeye_interpreter/skyeye_common/vfp/asm_vfp.h"
|
#include "skyeye_interpreter/skyeye_common/vfp/asm_vfp.h"
|
||||||
|
@ -112,26 +112,26 @@ void VMOVR(ARMul_State* state, u32 single, u32 d, u32 m)
|
||||||
/* Miscellaneous functions */
|
/* Miscellaneous functions */
|
||||||
s32 vfp_get_float(ARMul_State* state, unsigned int reg)
|
s32 vfp_get_float(ARMul_State* state, unsigned int reg)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "VFP get float: s%d=[%08x]", reg, state->ExtReg[reg]);
|
//LOG_TRACE(Core_ARM11, "VFP get float: s%d=[%08x]", reg, state->ExtReg[reg]);
|
||||||
return state->ExtReg[reg];
|
return state->ExtReg[reg];
|
||||||
}
|
}
|
||||||
|
|
||||||
void vfp_put_float(ARMul_State* state, s32 val, unsigned int 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);
|
//LOG_TRACE(Core_ARM11, "VFP put float: s%d <= [%08x]", reg, val);
|
||||||
state->ExtReg[reg] = val;
|
state->ExtReg[reg] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 vfp_get_double(ARMul_State* state, unsigned int reg)
|
u64 vfp_get_double(ARMul_State* state, unsigned int reg)
|
||||||
{
|
{
|
||||||
u64 result = ((u64) state->ExtReg[reg*2+1])<<32 | state->ExtReg[reg*2];
|
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);
|
//LOG_TRACE(Core_ARM11, "VFP get double: s[%d-%d]=[%016llx]", reg * 2 + 1, reg * 2, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vfp_put_double(ARMul_State* state, u64 val, unsigned int reg)
|
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));
|
//LOG_TRACE(Core_ARM11, "VFP put double: s[%d-%d] <= [%08x-%08x]", reg * 2 + 1, reg * 2, (u32)(val >> 32), (u32)(val & 0xffffffff));
|
||||||
state->ExtReg[reg*2] = (u32) (val & 0xffffffff);
|
state->ExtReg[reg*2] = (u32) (val & 0xffffffff);
|
||||||
state->ExtReg[reg*2+1] = (u32) (val>>32);
|
state->ExtReg[reg*2+1] = (u32) (val>>32);
|
||||||
}
|
}
|
||||||
|
@ -141,10 +141,10 @@ void vfp_put_double(ARMul_State* state, u64 val, unsigned int reg)
|
||||||
*/
|
*/
|
||||||
void vfp_raise_exceptions(ARMul_State* state, u32 exceptions, u32 inst, u32 fpscr)
|
void vfp_raise_exceptions(ARMul_State* state, u32 exceptions, u32 inst, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "VFP: raising exceptions %08x", exceptions);
|
//LOG_TRACE(Core_ARM11, "VFP: raising exceptions %08x", exceptions);
|
||||||
|
|
||||||
if (exceptions == VFP_EXCEPTION_ERROR) {
|
if (exceptions == VFP_EXCEPTION_ERROR) {
|
||||||
LOG_CRITICAL(Core_ARM11, "unhandled bounce %x", inst);
|
ASSERT_MSG(false, "unhandled bounce %x", inst);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "skyeye_interpreter/skyeye_common/vfp/vfp_helper.h" /* for references to cdp SoftFloat functions */
|
#include "skyeye_interpreter/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) //LOG_TRACE(Core_ARM11, "in func %s, " #x " untested", __FUNCTION__);
|
||||||
#define CHECK_VFP_ENABLED
|
#define CHECK_VFP_ENABLED
|
||||||
#define CHECK_VFP_CDP_RET vfp_raise_exceptions(cpu, ret, inst_cream->instr, cpu->VFP[VFP_FPSCR]);
|
#define CHECK_VFP_CDP_RET vfp_raise_exceptions(cpu, ret, inst_cream->instr, cpu->VFP[VFP_FPSCR]);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "skyeye_interpreter/skyeye_common/vfp/vfp.h"
|
#include "skyeye_interpreter/skyeye_common/vfp/vfp.h"
|
||||||
#include "skyeye_interpreter/skyeye_common/vfp/vfp_helper.h"
|
#include "skyeye_interpreter/skyeye_common/vfp/vfp_helper.h"
|
||||||
#include "skyeye_interpreter/skyeye_common/vfp/asm_vfp.h"
|
#include "skyeye_interpreter/skyeye_common/vfp/asm_vfp.h"
|
||||||
|
@ -65,8 +64,8 @@ static struct vfp_double vfp_double_default_qnan = {
|
||||||
|
|
||||||
static void vfp_double_dump(const char *str, struct vfp_double *d)
|
static void vfp_double_dump(const char *str, struct vfp_double *d)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "VFP: %s: sign=%d exponent=%d significand=%016llx",
|
//LOG_TRACE(Core_ARM11, "VFP: %s: sign=%d exponent=%d significand=%016llx",
|
||||||
str, d->sign != 0, d->exponent, d->significand);
|
// str, d->sign != 0, d->exponent, d->significand);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfp_double_normalise_denormal(struct vfp_double *vd)
|
static void vfp_double_normalise_denormal(struct vfp_double *vd)
|
||||||
|
@ -155,7 +154,7 @@ u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double *vd,
|
||||||
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vd->sign != 0))
|
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vd->sign != 0))
|
||||||
incr = (1ULL << (VFP_DOUBLE_LOW_BITS + 1)) - 1;
|
incr = (1ULL << (VFP_DOUBLE_LOW_BITS + 1)) - 1;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "VFP: rounding increment = 0x%08llx", incr);
|
//LOG_TRACE(Core_ARM11, "VFP: rounding increment = 0x%08llx", incr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is our rounding going to overflow?
|
* Is our rounding going to overflow?
|
||||||
|
@ -210,8 +209,8 @@ pack:
|
||||||
vfp_double_dump("pack: final", vd);
|
vfp_double_dump("pack: final", vd);
|
||||||
{
|
{
|
||||||
s64 d = vfp_double_pack(vd);
|
s64 d = vfp_double_pack(vd);
|
||||||
LOG_TRACE(Core_ARM11, "VFP: %s: d(d%d)=%016llx exceptions=%08x", func,
|
//LOG_TRACE(Core_ARM11, "VFP: %s: d(d%d)=%016llx exceptions=%08x", func,
|
||||||
dd, d, exceptions);
|
// dd, d, exceptions);
|
||||||
vfp_put_double(state, d, dd);
|
vfp_put_double(state, d, dd);
|
||||||
}
|
}
|
||||||
return exceptions;
|
return exceptions;
|
||||||
|
@ -267,28 +266,28 @@ vfp_propagate_nan(struct vfp_double *vdd, struct vfp_double *vdn,
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fabs(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
static u32 vfp_double_fabs(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_put_double(state, vfp_double_packed_abs(vfp_get_double(state, dm)), dd);
|
vfp_put_double(state, vfp_double_packed_abs(vfp_get_double(state, dm)), dd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcpy(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
static u32 vfp_double_fcpy(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_put_double(state, vfp_get_double(state, dm), dd);
|
vfp_put_double(state, vfp_get_double(state, dm), dd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fneg(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
static u32 vfp_double_fneg(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_put_double(state, vfp_double_packed_negate(vfp_get_double(state, dm)), dd);
|
vfp_put_double(state, vfp_double_packed_negate(vfp_get_double(state, dm)), dd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fsqrt(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
static u32 vfp_double_fsqrt(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_double vdm, vdd, *vdp;
|
vfp_double vdm, vdd, *vdp;
|
||||||
int ret, tm;
|
int ret, tm;
|
||||||
|
|
||||||
|
@ -383,7 +382,7 @@ static u32 vfp_compare(ARMul_State* state, int dd, int signal_on_qnan, int dm, u
|
||||||
s64 d, m;
|
s64 d, m;
|
||||||
u32 ret = 0;
|
u32 ret = 0;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s, state=0x%p, fpscr=0x%x", __FUNCTION__, state, fpscr);
|
//LOG_TRACE(Core_ARM11, "In %s, state=0x%p, fpscr=0x%x", __FUNCTION__, state, fpscr);
|
||||||
m = vfp_get_double(state, dm);
|
m = vfp_get_double(state, dm);
|
||||||
if (vfp_double_packed_exponent(m) == 2047 && vfp_double_packed_mantissa(m)) {
|
if (vfp_double_packed_exponent(m) == 2047 && vfp_double_packed_mantissa(m)) {
|
||||||
ret |= FPSCR_CFLAG | FPSCR_VFLAG;
|
ret |= FPSCR_CFLAG | FPSCR_VFLAG;
|
||||||
|
@ -438,32 +437,32 @@ static u32 vfp_compare(ARMul_State* state, int dd, int signal_on_qnan, int dm, u
|
||||||
ret |= FPSCR_CFLAG;
|
ret |= FPSCR_CFLAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_TRACE(Core_ARM11, "In %s, state=0x%p, ret=0x%x", __FUNCTION__, state, ret);
|
//LOG_TRACE(Core_ARM11, "In %s, state=0x%p, ret=0x%x", __FUNCTION__, state, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcmp(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
static u32 vfp_double_fcmp(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_compare(state, dd, 0, dm, fpscr);
|
return vfp_compare(state, dd, 0, dm, fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcmpe(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
static u32 vfp_double_fcmpe(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_compare(state, dd, 1, dm, fpscr);
|
return vfp_compare(state, dd, 1, dm, fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcmpz(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
static u32 vfp_double_fcmpz(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_compare(state, dd, 0, VFP_REG_ZERO, fpscr);
|
return vfp_compare(state, dd, 0, VFP_REG_ZERO, fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 vfp_double_fcmpez(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
static u32 vfp_double_fcmpez(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_compare(state, dd, 1, VFP_REG_ZERO, fpscr);
|
return vfp_compare(state, dd, 1, VFP_REG_ZERO, fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +473,7 @@ static u32 vfp_double_fcvts(ARMul_State* state, int sd, int unused, int dm, u32
|
||||||
int tm;
|
int tm;
|
||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_double_unpack(&vdm, vfp_get_double(state, dm), &fpscr);
|
vfp_double_unpack(&vdm, vfp_get_double(state, dm), &fpscr);
|
||||||
|
|
||||||
tm = vfp_double_type(&vdm);
|
tm = vfp_double_type(&vdm);
|
||||||
|
@ -516,7 +515,7 @@ static u32 vfp_double_fuito(ARMul_State* state, int dd, int unused, int dm, u32
|
||||||
struct vfp_double vdm;
|
struct vfp_double vdm;
|
||||||
u32 m = vfp_get_float(state, dm);
|
u32 m = vfp_get_float(state, dm);
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vdm.sign = 0;
|
vdm.sign = 0;
|
||||||
vdm.exponent = 1023 + 63 - 1;
|
vdm.exponent = 1023 + 63 - 1;
|
||||||
vdm.significand = (u64)m;
|
vdm.significand = (u64)m;
|
||||||
|
@ -529,7 +528,7 @@ static u32 vfp_double_fsito(ARMul_State* state, int dd, int unused, int dm, u32
|
||||||
struct vfp_double vdm;
|
struct vfp_double vdm;
|
||||||
u32 m = vfp_get_float(state, dm);
|
u32 m = vfp_get_float(state, dm);
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vdm.sign = (m & 0x80000000) >> 16;
|
vdm.sign = (m & 0x80000000) >> 16;
|
||||||
vdm.exponent = 1023 + 63 - 1;
|
vdm.exponent = 1023 + 63 - 1;
|
||||||
vdm.significand = vdm.sign ? (~m + 1) : m;
|
vdm.significand = vdm.sign ? (~m + 1) : m;
|
||||||
|
@ -544,7 +543,7 @@ static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32
|
||||||
int rmode = fpscr & FPSCR_RMODE_MASK;
|
int rmode = fpscr & FPSCR_RMODE_MASK;
|
||||||
int tm;
|
int tm;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_double_unpack(&vdm, vfp_get_double(state, dm), &fpscr);
|
vfp_double_unpack(&vdm, vfp_get_double(state, dm), &fpscr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -605,7 +604,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);
|
//LOG_TRACE(Core_ARM11, "VFP: ftoui: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, d, sd);
|
vfp_put_float(state, d, sd);
|
||||||
|
|
||||||
|
@ -614,7 +613,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)
|
static u32 vfp_double_ftouiz(ARMul_State* state, int sd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_double_ftoui(state, sd, unused, dm, FPSCR_ROUND_TOZERO);
|
return vfp_double_ftoui(state, sd, unused, dm, FPSCR_ROUND_TOZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,7 +624,7 @@ static u32 vfp_double_ftosi(ARMul_State* state, int sd, int unused, int dm, u32
|
||||||
int rmode = fpscr & FPSCR_RMODE_MASK;
|
int rmode = fpscr & FPSCR_RMODE_MASK;
|
||||||
int tm;
|
int tm;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_double_unpack(&vdm, vfp_get_double(state, dm), &fpscr);
|
vfp_double_unpack(&vdm, vfp_get_double(state, dm), &fpscr);
|
||||||
vfp_double_dump("VDM", &vdm);
|
vfp_double_dump("VDM", &vdm);
|
||||||
|
|
||||||
|
@ -682,7 +681,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);
|
//LOG_TRACE(Core_ARM11, "VFP: ftosi: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, (s32)d, sd);
|
vfp_put_float(state, (s32)d, sd);
|
||||||
|
|
||||||
|
@ -691,7 +690,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)
|
static u32 vfp_double_ftosiz(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_double_ftosi(state, dd, unused, dm, FPSCR_ROUND_TOZERO);
|
return vfp_double_ftosi(state, dd, unused, dm, FPSCR_ROUND_TOZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,7 +774,7 @@ u32 vfp_double_add(struct vfp_double *vdd, struct vfp_double *vdn,struct vfp_dou
|
||||||
|
|
||||||
if (vdn->significand & (1ULL << 63) ||
|
if (vdn->significand & (1ULL << 63) ||
|
||||||
vdm->significand & (1ULL << 63)) {
|
vdm->significand & (1ULL << 63)) {
|
||||||
LOG_INFO(Core_ARM11, "VFP: bad FP values in %s", __func__);
|
// LOG_INFO(Core_ARM11, "VFP: bad FP values in %s", __func__);
|
||||||
vfp_double_dump("VDN", vdn);
|
vfp_double_dump("VDN", vdn);
|
||||||
vfp_double_dump("VDM", vdm);
|
vfp_double_dump("VDM", vdm);
|
||||||
}
|
}
|
||||||
|
@ -843,7 +842,7 @@ vfp_double_multiply(struct vfp_double *vdd, struct vfp_double *vdn,
|
||||||
*/
|
*/
|
||||||
if (vdn->exponent < vdm->exponent) {
|
if (vdn->exponent < vdm->exponent) {
|
||||||
std::swap(vdm, vdn);
|
std::swap(vdm, vdn);
|
||||||
LOG_TRACE(Core_ARM11, "VFP: swapping M <-> N");
|
//LOG_TRACE(Core_ARM11, "VFP: swapping M <-> N");
|
||||||
}
|
}
|
||||||
|
|
||||||
vdd->sign = vdn->sign ^ vdm->sign;
|
vdd->sign = vdn->sign ^ vdm->sign;
|
||||||
|
@ -927,7 +926,7 @@ vfp_double_multiply_accumulate(ARMul_State* state, int dd, int dn, int dm, u32 f
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr)
|
static u32 vfp_double_fmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, 0, "fmac");
|
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, 0, "fmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -936,7 +935,7 @@ static u32 vfp_double_fmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fnmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr)
|
static u32 vfp_double_fnmac(ARMul_State* state, int dd, int dn, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_MULTIPLY, "fnmac");
|
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_MULTIPLY, "fnmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,7 +944,7 @@ static u32 vfp_double_fnmac(ARMul_State* state, int dd, int dn, int dm, u32 fpsc
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr)
|
static u32 vfp_double_fmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT, "fmsc");
|
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT, "fmsc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -954,7 +953,7 @@ static u32 vfp_double_fmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
||||||
*/
|
*/
|
||||||
static u32 vfp_double_fnmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr)
|
static u32 vfp_double_fnmsc(ARMul_State* state, int dd, int dn, int dm, u32 fpscr)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT | NEG_MULTIPLY, "fnmsc");
|
return vfp_double_multiply_accumulate(state, dd, dn, dm, fpscr, NEG_SUBTRACT | NEG_MULTIPLY, "fnmsc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -966,7 +965,7 @@ static u32 vfp_double_fmul(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
||||||
struct vfp_double vdd, vdn, vdm;
|
struct vfp_double vdd, vdn, vdm;
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
||||||
if (vdn.exponent == 0 && vdn.significand)
|
if (vdn.exponent == 0 && vdn.significand)
|
||||||
vfp_double_normalise_denormal(&vdn);
|
vfp_double_normalise_denormal(&vdn);
|
||||||
|
@ -987,7 +986,7 @@ static u32 vfp_double_fnmul(ARMul_State* state, int dd, int dn, int dm, u32 fpsc
|
||||||
struct vfp_double vdd, vdn, vdm;
|
struct vfp_double vdd, vdn, vdm;
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
||||||
if (vdn.exponent == 0 && vdn.significand)
|
if (vdn.exponent == 0 && vdn.significand)
|
||||||
vfp_double_normalise_denormal(&vdn);
|
vfp_double_normalise_denormal(&vdn);
|
||||||
|
@ -1010,7 +1009,7 @@ static u32 vfp_double_fadd(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
||||||
struct vfp_double vdd, vdn, vdm;
|
struct vfp_double vdd, vdn, vdm;
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
||||||
if (vdn.exponent == 0 && vdn.significand)
|
if (vdn.exponent == 0 && vdn.significand)
|
||||||
vfp_double_normalise_denormal(&vdn);
|
vfp_double_normalise_denormal(&vdn);
|
||||||
|
@ -1032,7 +1031,7 @@ static u32 vfp_double_fsub(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
||||||
struct vfp_double vdd, vdn, vdm;
|
struct vfp_double vdd, vdn, vdm;
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
||||||
if (vdn.exponent == 0 && vdn.significand)
|
if (vdn.exponent == 0 && vdn.significand)
|
||||||
vfp_double_normalise_denormal(&vdn);
|
vfp_double_normalise_denormal(&vdn);
|
||||||
|
@ -1060,7 +1059,7 @@ static u32 vfp_double_fdiv(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
|
||||||
u32 exceptions = 0;
|
u32 exceptions = 0;
|
||||||
int tm, tn;
|
int tm, tn;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
vfp_double_unpack(&vdn, vfp_get_double(state, dn), &fpscr);
|
||||||
vfp_double_unpack(&vdm, vfp_get_double(state, dm), &fpscr);
|
vfp_double_unpack(&vdm, vfp_get_double(state, dm), &fpscr);
|
||||||
|
|
||||||
|
@ -1185,7 +1184,7 @@ u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr)
|
||||||
unsigned int vecitr, veclen, vecstride;
|
unsigned int vecitr, veclen, vecstride;
|
||||||
struct op *fop;
|
struct op *fop;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
//LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
|
||||||
vecstride = (1 + ((fpscr & FPSCR_STRIDE_MASK) == FPSCR_STRIDE_MASK));
|
vecstride = (1 + ((fpscr & FPSCR_STRIDE_MASK) == FPSCR_STRIDE_MASK));
|
||||||
|
|
||||||
fop = (op == FOP_EXT) ? &fops_ext[FEXT_TO_IDX(inst)] : &fops[FOP_TO_IDX(op)];
|
fop = (op == FOP_EXT) ? &fops_ext[FEXT_TO_IDX(inst)] : &fops[FOP_TO_IDX(op)];
|
||||||
|
@ -1216,8 +1215,8 @@ u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr)
|
||||||
else
|
else
|
||||||
veclen = fpscr & FPSCR_LENGTH_MASK;
|
veclen = fpscr & FPSCR_LENGTH_MASK;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "VFP: vecstride=%u veclen=%u", vecstride,
|
//LOG_TRACE(Core_ARM11, "VFP: vecstride=%u veclen=%u", vecstride,
|
||||||
(veclen >> FPSCR_LENGTH_BIT) + 1);
|
// (veclen >> FPSCR_LENGTH_BIT) + 1);
|
||||||
|
|
||||||
if (!fop->fn) {
|
if (!fop->fn) {
|
||||||
printf("VFP: could not find double op %d\n", FEXT_TO_IDX(inst));
|
printf("VFP: could not find double op %d\n", FEXT_TO_IDX(inst));
|
||||||
|
@ -1231,18 +1230,18 @@ u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr)
|
||||||
type = (fop->flags & OP_SD) ? 's' : 'd';
|
type = (fop->flags & OP_SD) ? 's' : 'd';
|
||||||
(void)type;
|
(void)type;
|
||||||
|
|
||||||
if (op == FOP_EXT)
|
//if (op == FOP_EXT)
|
||||||
LOG_TRACE(Core_ARM11, "VFP: itr%d (%c%u) = op[%u] (d%u)",
|
// LOG_TRACE(Core_ARM11, "VFP: itr%d (%c%u) = op[%u] (d%u)",
|
||||||
vecitr >> FPSCR_LENGTH_BIT,
|
// vecitr >> FPSCR_LENGTH_BIT,
|
||||||
type, dest, dn, dm);
|
// type, dest, dn, dm);
|
||||||
else
|
//else
|
||||||
LOG_TRACE(Core_ARM11, "VFP: itr%d (%c%u) = (d%u) op[%u] (d%u)",
|
// LOG_TRACE(Core_ARM11, "VFP: itr%d (%c%u) = (d%u) op[%u] (d%u)",
|
||||||
vecitr >> FPSCR_LENGTH_BIT,
|
// vecitr >> FPSCR_LENGTH_BIT,
|
||||||
type, dest, dn, FOP_TO_IDX(op), dm);
|
// type, dest, dn, FOP_TO_IDX(op), dm);
|
||||||
|
|
||||||
except = fop->fn(state, dest, dn, dm, fpscr);
|
except = fop->fn(state, dest, dn, dm, fpscr);
|
||||||
LOG_TRACE(Core_ARM11, "VFP: itr%d: exceptions=%08x",
|
//LOG_TRACE(Core_ARM11, "VFP: itr%d: exceptions=%08x",
|
||||||
vecitr >> FPSCR_LENGTH_BIT, except);
|
// vecitr >> FPSCR_LENGTH_BIT, except);
|
||||||
|
|
||||||
exceptions |= except;
|
exceptions |= except;
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,8 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/logging/log.h"
|
|
||||||
|
|
||||||
#include "skyeye_interpreter/skyeye_common/vfp/vfp_helper.h"
|
#include "skyeye_interpreter/skyeye_common/vfp/vfp_helper.h"
|
||||||
#include "skyeye_interpreter/skyeye_common/vfp/asm_vfp.h"
|
#include "skyeye_interpreter/skyeye_common/vfp/asm_vfp.h"
|
||||||
|
@ -69,8 +69,8 @@ static struct vfp_single vfp_single_default_qnan = {
|
||||||
|
|
||||||
static void vfp_single_dump(const char *str, struct vfp_single *s)
|
static void vfp_single_dump(const char *str, struct vfp_single *s)
|
||||||
{
|
{
|
||||||
LOG_TRACE(Core_ARM11, "%s: sign=%d exponent=%d significand=%08x",
|
//LOG_TRACE(Core_ARM11, "%s: sign=%d exponent=%d significand=%08x",
|
||||||
str, s->sign != 0, s->exponent, s->significand);
|
// str, s->sign != 0, s->exponent, s->significand);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfp_single_normalise_denormal(struct vfp_single *vs)
|
static void vfp_single_normalise_denormal(struct vfp_single *vs)
|
||||||
|
@ -160,7 +160,7 @@ u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs,
|
||||||
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vs->sign != 0))
|
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vs->sign != 0))
|
||||||
incr = (1 << (VFP_SINGLE_LOW_BITS + 1)) - 1;
|
incr = (1 << (VFP_SINGLE_LOW_BITS + 1)) - 1;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "rounding increment = 0x%08x", incr);
|
//LOG_TRACE(Core_ARM11, "rounding increment = 0x%08x", incr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is our rounding going to overflow?
|
* Is our rounding going to overflow?
|
||||||
|
@ -215,8 +215,8 @@ pack:
|
||||||
vfp_single_dump("pack: final", vs);
|
vfp_single_dump("pack: final", vs);
|
||||||
{
|
{
|
||||||
s32 d = vfp_single_pack(vs);
|
s32 d = vfp_single_pack(vs);
|
||||||
LOG_TRACE(Core_ARM11, "%s: d(s%d)=%08x exceptions=%08x", func,
|
//LOG_TRACE(Core_ARM11, "%s: d(s%d)=%08x exceptions=%08x", func,
|
||||||
sd, d, exceptions);
|
// sd, d, exceptions);
|
||||||
vfp_put_float(state, d, sd);
|
vfp_put_float(state, d, sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand)
|
||||||
u32 z, a;
|
u32 z, a;
|
||||||
|
|
||||||
if ((significand & 0xc0000000) != 0x40000000) {
|
if ((significand & 0xc0000000) != 0x40000000) {
|
||||||
LOG_TRACE(Core_ARM11, "invalid significand");
|
//LOG_TRACE(Core_ARM11, "invalid significand");
|
||||||
}
|
}
|
||||||
|
|
||||||
a = significand << 1;
|
a = significand << 1;
|
||||||
|
@ -396,7 +396,7 @@ sqrt_invalid:
|
||||||
term = (u64)vsd.significand * vsd.significand;
|
term = (u64)vsd.significand * vsd.significand;
|
||||||
rem = ((u64)vsm.significand << 32) - term;
|
rem = ((u64)vsm.significand << 32) - term;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "term=%016" PRIx64 "rem=%016" PRIx64, term, rem);
|
//LOG_TRACE(Core_ARM11, "term=%016" PRIx64 "rem=%016" PRIx64, term, rem);
|
||||||
|
|
||||||
while (rem < 0) {
|
while (rem < 0) {
|
||||||
vsd.significand -= 1;
|
vsd.significand -= 1;
|
||||||
|
@ -628,7 +628,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);
|
//LOG_TRACE(Core_ARM11, "ftoui: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, d, sd);
|
vfp_put_float(state, d, sd);
|
||||||
|
|
||||||
|
@ -707,7 +707,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);
|
//LOG_TRACE(Core_ARM11, "ftosi: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, (s32)d, sd);
|
vfp_put_float(state, (s32)d, sd);
|
||||||
|
|
||||||
|
@ -804,7 +804,7 @@ vfp_single_add(struct vfp_single *vsd, struct vfp_single *vsn,
|
||||||
|
|
||||||
if (vsn->significand & 0x80000000 ||
|
if (vsn->significand & 0x80000000 ||
|
||||||
vsm->significand & 0x80000000) {
|
vsm->significand & 0x80000000) {
|
||||||
LOG_WARNING(Core_ARM11, "bad FP values");
|
//LOG_WARNING(Core_ARM11, "bad FP values");
|
||||||
vfp_single_dump("VSN", vsn);
|
vfp_single_dump("VSN", vsn);
|
||||||
vfp_single_dump("VSM", vsm);
|
vfp_single_dump("VSM", vsm);
|
||||||
}
|
}
|
||||||
|
@ -871,7 +871,7 @@ vfp_single_multiply(struct vfp_single *vsd, struct vfp_single *vsn, struct vfp_s
|
||||||
*/
|
*/
|
||||||
if (vsn->exponent < vsm->exponent) {
|
if (vsn->exponent < vsm->exponent) {
|
||||||
std::swap(vsm, vsn);
|
std::swap(vsm, vsn);
|
||||||
LOG_TRACE(Core_ARM11, "swapping M <-> N");
|
//LOG_TRACE(Core_ARM11, "swapping M <-> N");
|
||||||
}
|
}
|
||||||
|
|
||||||
vsd->sign = vsn->sign ^ vsm->sign;
|
vsd->sign = vsn->sign ^ vsm->sign;
|
||||||
|
@ -924,7 +924,7 @@ vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fp
|
||||||
s32 v;
|
s32 v;
|
||||||
|
|
||||||
v = vfp_get_float(state, sn);
|
v = vfp_get_float(state, sn);
|
||||||
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, v);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sn, v);
|
||||||
vfp_single_unpack(&vsn, v, &fpscr);
|
vfp_single_unpack(&vsn, v, &fpscr);
|
||||||
if (vsn.exponent == 0 && vsn.significand)
|
if (vsn.exponent == 0 && vsn.significand)
|
||||||
vfp_single_normalise_denormal(&vsn);
|
vfp_single_normalise_denormal(&vsn);
|
||||||
|
@ -939,7 +939,7 @@ vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fp
|
||||||
vsp.sign = vfp_sign_negate(vsp.sign);
|
vsp.sign = vfp_sign_negate(vsp.sign);
|
||||||
|
|
||||||
v = vfp_get_float(state, sd);
|
v = vfp_get_float(state, sd);
|
||||||
LOG_TRACE(Core_ARM11, "s%u = %08x", sd, v);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sd, v);
|
||||||
vfp_single_unpack(&vsn, v, &fpscr);
|
vfp_single_unpack(&vsn, v, &fpscr);
|
||||||
if (vsn.exponent == 0 && vsn.significand != 0)
|
if (vsn.exponent == 0 && vsn.significand != 0)
|
||||||
vfp_single_normalise_denormal(&vsn);
|
vfp_single_normalise_denormal(&vsn);
|
||||||
|
@ -961,7 +961,7 @@ vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fp
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
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);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -971,7 +971,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)
|
static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
{
|
{
|
||||||
// TODO: this one has its arguments inverted, investigate.
|
// TODO: this one has its arguments inverted, investigate.
|
||||||
LOG_TRACE(Core_ARM11, "s%u = %08x", sd, sn);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sd, sn);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_MULTIPLY, "fnmac");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_MULTIPLY, "fnmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -980,7 +980,7 @@ static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
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);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT, "fmsc");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT, "fmsc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,7 +989,7 @@ static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fnmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
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);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT | NEG_MULTIPLY, "fnmsc");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT | NEG_MULTIPLY, "fnmsc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1002,7 +1002,7 @@ static u32 vfp_single_fmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
|
||||||
|
|
||||||
vfp_single_unpack(&vsn, n, &fpscr);
|
vfp_single_unpack(&vsn, n, &fpscr);
|
||||||
if (vsn.exponent == 0 && vsn.significand)
|
if (vsn.exponent == 0 && vsn.significand)
|
||||||
|
@ -1025,7 +1025,7 @@ static u32 vfp_single_fnmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
|
||||||
|
|
||||||
vfp_single_unpack(&vsn, n, &fpscr);
|
vfp_single_unpack(&vsn, n, &fpscr);
|
||||||
if (vsn.exponent == 0 && vsn.significand)
|
if (vsn.exponent == 0 && vsn.significand)
|
||||||
|
@ -1049,7 +1049,7 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unpack and normalise denormals.
|
* Unpack and normalise denormals.
|
||||||
|
@ -1072,7 +1072,7 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fsub(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
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);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
|
||||||
/*
|
/*
|
||||||
* Subtraction is addition with one sign inverted.
|
* Subtraction is addition with one sign inverted.
|
||||||
*/
|
*/
|
||||||
|
@ -1092,7 +1092,7 @@ static u32 vfp_single_fdiv(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
int tm, tn;
|
int tm, tn;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
|
//LOG_TRACE(Core_ARM11, "s%u = %08x", sn, n);
|
||||||
|
|
||||||
vfp_single_unpack(&vsn, n, &fpscr);
|
vfp_single_unpack(&vsn, n, &fpscr);
|
||||||
vfp_single_unpack(&vsm, m, &fpscr);
|
vfp_single_unpack(&vsm, m, &fpscr);
|
||||||
|
@ -1239,11 +1239,11 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr)
|
||||||
else
|
else
|
||||||
veclen = fpscr & FPSCR_LENGTH_MASK;
|
veclen = fpscr & FPSCR_LENGTH_MASK;
|
||||||
|
|
||||||
LOG_TRACE(Core_ARM11, "vecstride=%u veclen=%u", vecstride,
|
//LOG_TRACE(Core_ARM11, "vecstride=%u veclen=%u", vecstride,
|
||||||
(veclen >> FPSCR_LENGTH_BIT) + 1);
|
// (veclen >> FPSCR_LENGTH_BIT) + 1);
|
||||||
|
|
||||||
if (!fop->fn) {
|
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]);
|
ASSERT_MSG(false, "could not find single op %d, inst=0x%x@0x%x", FEXT_TO_IDX(inst), inst, state->Reg[15]);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
@ -1256,18 +1256,18 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr)
|
||||||
type = (fop->flags & OP_DD) ? 'd' : 's';
|
type = (fop->flags & OP_DD) ? 'd' : 's';
|
||||||
(void)type;
|
(void)type;
|
||||||
|
|
||||||
if (op == FOP_EXT)
|
//if (op == FOP_EXT)
|
||||||
LOG_TRACE(Core_ARM11, "itr%d (%c%u) = op[%u] (s%u=%08x)",
|
// LOG_TRACE(Core_ARM11, "itr%d (%c%u) = op[%u] (s%u=%08x)",
|
||||||
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn,
|
// vecitr >> FPSCR_LENGTH_BIT, type, dest, sn,
|
||||||
sm, m);
|
// sm, m);
|
||||||
else
|
//else
|
||||||
LOG_TRACE(Core_ARM11, "itr%d (%c%u) = (s%u) op[%u] (s%u=%08x)",
|
// LOG_TRACE(Core_ARM11, "itr%d (%c%u) = (s%u) op[%u] (s%u=%08x)",
|
||||||
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn,
|
// vecitr >> FPSCR_LENGTH_BIT, type, dest, sn,
|
||||||
FOP_TO_IDX(op), sm, m);
|
// FOP_TO_IDX(op), sm, m);
|
||||||
|
|
||||||
except = fop->fn(state, dest, sn, m, fpscr);
|
except = fop->fn(state, dest, sn, m, fpscr);
|
||||||
LOG_TRACE(Core_ARM11, "itr%d: exceptions=%08x",
|
//LOG_TRACE(Core_ARM11, "itr%d: exceptions=%08x",
|
||||||
vecitr >> FPSCR_LENGTH_BIT, except);
|
// vecitr >> FPSCR_LENGTH_BIT, except);
|
||||||
|
|
||||||
exceptions |= except;
|
exceptions |= except;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue