yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Convert old logging calls to new logging macros

This commit is contained in:
Yuri Kunde Schlesner 2014-12-05 23:53:49 -02:00
parent 6390c66e95
commit 0600e2d8b5
65 changed files with 502 additions and 516 deletions

View File

@ -27,7 +27,7 @@ int __cdecl main(int argc, char **argv) {
}); });
if (argc < 2) { if (argc < 2) {
ERROR_LOG(BOOT, "Failed to load ROM: No ROM specified"); LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
return -1; return -1;
} }
@ -40,7 +40,7 @@ int __cdecl main(int argc, char **argv) {
Loader::ResultStatus load_result = Loader::LoadFile(boot_filename); Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
if (Loader::ResultStatus::Success != load_result) { if (Loader::ResultStatus::Success != load_result) {
ERROR_LOG(BOOT, "Failed to load ROM (Error %i)!", load_result); LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result);
return -1; return -1;
} }

View File

@ -22,17 +22,17 @@ Config::Config() {
bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) { bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) {
if (config->ParseError() < 0) { if (config->ParseError() < 0) {
if (retry) { if (retry) {
ERROR_LOG(CONFIG, "Failed to load %s. Creating file from defaults...", location); LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location);
FileUtil::CreateFullPath(location); FileUtil::CreateFullPath(location);
FileUtil::WriteStringToFile(true, default_contents, location); FileUtil::WriteStringToFile(true, default_contents, location);
*config = INIReader(location); // Reopen file *config = INIReader(location); // Reopen file
return LoadINI(config, location, default_contents, false); return LoadINI(config, location, default_contents, false);
} }
ERROR_LOG(CONFIG, "Failed."); LOG_ERROR(Config, "Failed.");
return false; return false;
} }
INFO_LOG(CONFIG, "Successfully loaded %s", location); LOG_INFO(Config, "Successfully loaded %s", location);
return true; return true;
} }

View File

@ -36,15 +36,15 @@ const bool EmuWindow_GLFW::IsOpen() {
} }
void EmuWindow_GLFW::OnFramebufferResizeEvent(GLFWwindow* win, int width, int height) { void EmuWindow_GLFW::OnFramebufferResizeEvent(GLFWwindow* win, int width, int height) {
_dbg_assert_(GUI, width > 0); _dbg_assert_(Frontend, width > 0);
_dbg_assert_(GUI, height > 0); _dbg_assert_(Frontend, height > 0);
GetEmuWindow(win)->NotifyFramebufferSizeChanged(std::pair<unsigned,unsigned>(width, height)); GetEmuWindow(win)->NotifyFramebufferSizeChanged(std::pair<unsigned,unsigned>(width, height));
} }
void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int height) { void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int height) {
_dbg_assert_(GUI, width > 0); _dbg_assert_(Frontend, width > 0);
_dbg_assert_(GUI, height > 0); _dbg_assert_(Frontend, height > 0);
// NOTE: GLFW provides no proper way to set a minimal window size. // NOTE: GLFW provides no proper way to set a minimal window size.
// Hence, we just ignore the corresponding EmuWindow hint. // Hence, we just ignore the corresponding EmuWindow hint.
@ -59,12 +59,12 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
ReloadSetKeymaps(); ReloadSetKeymaps();
glfwSetErrorCallback([](int error, const char *desc){ glfwSetErrorCallback([](int error, const char *desc){
ERROR_LOG(GUI, "GLFW 0x%08x: %s", error, desc); LOG_ERROR(Frontend, "GLFW 0x%08x: %s", error, desc);
}); });
// Initialize the window // Initialize the window
if(glfwInit() != GL_TRUE) { if(glfwInit() != GL_TRUE) {
ERROR_LOG(GUI, "Failed to initialize GLFW! Exiting..."); LOG_CRITICAL(Frontend, "Failed to initialize GLFW! Exiting...");
exit(1); exit(1);
} }
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@ -79,7 +79,7 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
window_title.c_str(), nullptr, nullptr); window_title.c_str(), nullptr, nullptr);
if (m_render_window == nullptr) { if (m_render_window == nullptr) {
ERROR_LOG(GUI, "Failed to create GLFW window! Exiting..."); LOG_CRITICAL(Frontend, "Failed to create GLFW window! Exiting...");
exit(1); exit(1);
} }
@ -149,7 +149,7 @@ void EmuWindow_GLFW::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,u
std::pair<int,int> current_size; std::pair<int,int> current_size;
glfwGetWindowSize(m_render_window, &current_size.first, &current_size.second); glfwGetWindowSize(m_render_window, &current_size.first, &current_size.second);
_dbg_assert_(GUI, (int)minimal_size.first > 0 && (int)minimal_size.second > 0); _dbg_assert_(Frontend, (int)minimal_size.first > 0 && (int)minimal_size.second > 0);
int new_width = std::max(current_size.first, (int)minimal_size.first); int new_width = std::max(current_size.first, (int)minimal_size.first);
int new_height = std::max(current_size.second, (int)minimal_size.second); int new_height = std::max(current_size.second, (int)minimal_size.second);

View File

@ -62,7 +62,7 @@ void EmuThread::Stop()
{ {
if (!isRunning()) if (!isRunning())
{ {
INFO_LOG(MASTER_LOG, "EmuThread::Stop called while emu thread wasn't running, returning..."); LOG_WARNING(Frontend, "EmuThread::Stop called while emu thread wasn't running, returning...");
return; return;
} }
stop_run = true; stop_run = true;
@ -76,7 +76,7 @@ void EmuThread::Stop()
wait(1000); wait(1000);
if (isRunning()) if (isRunning())
{ {
WARN_LOG(MASTER_LOG, "EmuThread still running, terminating..."); LOG_WARNING(Frontend, "EmuThread still running, terminating...");
quit(); quit();
// TODO: Waiting 50 seconds can be necessary if the logging subsystem has a lot of spam // TODO: Waiting 50 seconds can be necessary if the logging subsystem has a lot of spam
@ -84,11 +84,11 @@ void EmuThread::Stop()
wait(50000); wait(50000);
if (isRunning()) if (isRunning())
{ {
WARN_LOG(MASTER_LOG, "EmuThread STILL running, something is wrong here..."); LOG_CRITICAL(Frontend, "EmuThread STILL running, something is wrong here...");
terminate(); terminate();
} }
} }
INFO_LOG(MASTER_LOG, "EmuThread stopped"); LOG_INFO(Frontend, "EmuThread stopped");
} }

View File

@ -45,7 +45,7 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const
map.insert({Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")}); map.insert({Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")});
map.insert({Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")}); map.insert({Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")});
_dbg_assert_(GUI, map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents)); _dbg_assert_(Debug_GPU, map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents));
return map[event]; return map[event];
} }

View File

@ -158,18 +158,18 @@ GMainWindow::~GMainWindow()
void GMainWindow::BootGame(std::string filename) void GMainWindow::BootGame(std::string filename)
{ {
NOTICE_LOG(MASTER_LOG, "Citra starting...\n"); LOG_INFO(Frontend, "Citra starting...\n");
System::Init(render_window); System::Init(render_window);
if (Core::Init()) { if (Core::Init()) {
ERROR_LOG(MASTER_LOG, "Core initialization failed, exiting..."); LOG_CRITICAL(Frontend, "Core initialization failed, exiting...");
Core::Stop(); Core::Stop();
exit(1); exit(1);
} }
// Load a game or die... // Load a game or die...
if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) { if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) {
ERROR_LOG(BOOT, "Failed to load ROM!"); LOG_CRITICAL(Frontend, "Failed to load ROM!");
} }
disasmWidget->Init(); disasmWidget->Init();

View File

@ -244,7 +244,7 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const
if (strpos >= input.length() - HasSign() - suffix.length()) if (strpos >= input.length() - HasSign() - suffix.length())
return QValidator::Intermediate; return QValidator::Intermediate;
_dbg_assert_(GUI, base <= 10 || base == 16); _dbg_assert_(Frontend, base <= 10 || base == 16);
QString regexp; QString regexp;
// Demand sign character for negative ranges // Demand sign character for negative ranges

View File

@ -180,7 +180,7 @@ void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr,
{ {
if (Log) if (Log)
{ {
INFO_LOG(MEMMAP, "CHK %08x (%s) %s%i %0*x at %08x (%s)", LOG_DEBUG(Debug_Breakpoint, "CHK %08x (%s) %s%i %0*x at %08x (%s)",
pc, debug_interface->getDescription(pc).c_str(), pc, debug_interface->getDescription(pc).c_str(),
write ? "Write" : "Read", size*8, size*2, iValue, addr, write ? "Write" : "Read", size*8, size*2, iValue, addr,
debug_interface->getDescription(addr).c_str() debug_interface->getDescription(addr).c_str()

View File

@ -154,7 +154,7 @@ public:
Do(foundVersion); Do(foundVersion);
if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) { if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) {
WARN_LOG(COMMON, "Savestate failure: wrong version %d found for %s", foundVersion, title); LOG_ERROR(Common, "Savestate failure: wrong version %d found for %s", foundVersion, title);
SetError(ERROR_FAILURE); SetError(ERROR_FAILURE);
return PointerWrapSection(*this, -1, title); return PointerWrapSection(*this, -1, title);
} }
@ -178,7 +178,14 @@ public:
case MODE_READ: if (memcmp(data, *ptr, size) != 0) return false; break; case MODE_READ: if (memcmp(data, *ptr, size) != 0) return false; break;
case MODE_WRITE: memcpy(*ptr, data, size); break; case MODE_WRITE: memcpy(*ptr, data, size); break;
case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything
case MODE_VERIFY: for(int i = 0; i < size; i++) _dbg_assert_msg_(COMMON, ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break; case MODE_VERIFY:
for (int i = 0; i < size; i++) {
_dbg_assert_msg_(Common, ((u8*)data)[i] == (*ptr)[i],
"Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n",
((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i],
(*ptr)[i], (*ptr)[i], &(*ptr)[i]);
}
break;
default: break; // throw an error? default: break; // throw an error?
} }
(*ptr) += size; (*ptr) += size;
@ -191,7 +198,14 @@ public:
case MODE_READ: memcpy(data, *ptr, size); break; case MODE_READ: memcpy(data, *ptr, size); break;
case MODE_WRITE: memcpy(*ptr, data, size); break; case MODE_WRITE: memcpy(*ptr, data, size); break;
case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything
case MODE_VERIFY: for(int i = 0; i < size; i++) _dbg_assert_msg_(COMMON, ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break; case MODE_VERIFY:
for (int i = 0; i < size; i++) {
_dbg_assert_msg_(Common, ((u8*)data)[i] == (*ptr)[i],
"Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n",
((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i],
(*ptr)[i], (*ptr)[i], &(*ptr)[i]);
}
break;
default: break; // throw an error? default: break; // throw an error?
} }
(*ptr) += size; (*ptr) += size;
@ -476,7 +490,7 @@ public:
break; break;
default: default:
ERROR_LOG(COMMON, "Savestate error: invalid mode %d.", mode); LOG_ERROR(Common, "Savestate error: invalid mode %d.", mode);
} }
} }
@ -490,7 +504,12 @@ public:
case MODE_READ: x = (char*)*ptr; break; case MODE_READ: x = (char*)*ptr; break;
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
case MODE_MEASURE: break; case MODE_MEASURE: break;
case MODE_VERIFY: _dbg_assert_msg_(COMMON, !strcmp(x.c_str(), (char*)*ptr), "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (char*)*ptr, ptr); break; case MODE_VERIFY:
_dbg_assert_msg_(Common,
!strcmp(x.c_str(), (char*)*ptr),
"Savestate verification failure: \"%s\" != \"%s\" (at %p).\n",
x.c_str(), (char*)*ptr, ptr);
break;
} }
(*ptr) += stringLen; (*ptr) += stringLen;
} }
@ -504,7 +523,11 @@ public:
case MODE_READ: x = (wchar_t*)*ptr; break; case MODE_READ: x = (wchar_t*)*ptr; break;
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
case MODE_MEASURE: break; case MODE_MEASURE: break;
case MODE_VERIFY: _dbg_assert_msg_(COMMON, x == (wchar_t*)*ptr, "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break; case MODE_VERIFY:
_dbg_assert_msg_(Common, x == (wchar_t*)*ptr,
"Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n",
x.c_str(), (wchar_t*)*ptr, ptr);
break;
} }
(*ptr) += stringLen; (*ptr) += stringLen;
} }

View File

@ -88,7 +88,7 @@ bool IsDirectory(const std::string &filename)
#endif #endif
if (result < 0) { if (result < 0) {
WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", LOG_WARNING(Common_Filesystem, "stat failed on %s: %s",
filename.c_str(), GetLastErrorMsg()); filename.c_str(), GetLastErrorMsg());
return false; return false;
} }
@ -100,33 +100,33 @@ bool IsDirectory(const std::string &filename)
// Doesn't supports deleting a directory // Doesn't supports deleting a directory
bool Delete(const std::string &filename) bool Delete(const std::string &filename)
{ {
INFO_LOG(COMMON, "Delete: file %s", filename.c_str()); LOG_INFO(Common_Filesystem, "file %s", filename.c_str());
// Return true because we care about the file no // Return true because we care about the file no
// being there, not the actual delete. // being there, not the actual delete.
if (!Exists(filename)) if (!Exists(filename))
{ {
WARN_LOG(COMMON, "Delete: %s does not exist", filename.c_str()); LOG_WARNING(Common_Filesystem, "%s does not exist", filename.c_str());
return true; return true;
} }
// We can't delete a directory // We can't delete a directory
if (IsDirectory(filename)) if (IsDirectory(filename))
{ {
WARN_LOG(COMMON, "Delete failed: %s is a directory", filename.c_str()); LOG_ERROR(Common_Filesystem, "Failed: %s is a directory", filename.c_str());
return false; return false;
} }
#ifdef _WIN32 #ifdef _WIN32
if (!DeleteFile(Common::UTF8ToTStr(filename).c_str())) if (!DeleteFile(Common::UTF8ToTStr(filename).c_str()))
{ {
WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", LOG_ERROR(Common_Filesystem, "DeleteFile failed on %s: %s",
filename.c_str(), GetLastErrorMsg()); filename.c_str(), GetLastErrorMsg());
return false; return false;
} }
#else #else
if (unlink(filename.c_str()) == -1) { if (unlink(filename.c_str()) == -1) {
WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", LOG_ERROR(Common_Filesystem, "unlink failed on %s: %s",
filename.c_str(), GetLastErrorMsg()); filename.c_str(), GetLastErrorMsg());
return false; return false;
} }
@ -138,17 +138,17 @@ bool Delete(const std::string &filename)
// Returns true if successful, or path already exists. // Returns true if successful, or path already exists.
bool CreateDir(const std::string &path) bool CreateDir(const std::string &path)
{ {
INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str()); LOG_TRACE(Common_Filesystem, "directory %s", path.c_str());
#ifdef _WIN32 #ifdef _WIN32
if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), nullptr)) if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), nullptr))
return true; return true;
DWORD error = GetLastError(); DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS) if (error == ERROR_ALREADY_EXISTS)
{ {
WARN_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: already exists", path.c_str()); LOG_WARNING(Common_Filesystem, "CreateDirectory failed on %s: already exists", path.c_str());
return true; return true;
} }
ERROR_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: %i", path.c_str(), error); LOG_ERROR(Common_Filesystem, "CreateDirectory failed on %s: %i", path.c_str(), error);
return false; return false;
#else #else
if (mkdir(path.c_str(), 0755) == 0) if (mkdir(path.c_str(), 0755) == 0)
@ -158,11 +158,11 @@ bool CreateDir(const std::string &path)
if (err == EEXIST) if (err == EEXIST)
{ {
WARN_LOG(COMMON, "CreateDir: mkdir failed on %s: already exists", path.c_str()); LOG_WARNING(Common_Filesystem, "mkdir failed on %s: already exists", path.c_str());
return true; return true;
} }
ERROR_LOG(COMMON, "CreateDir: mkdir failed on %s: %s", path.c_str(), strerror(err)); LOG_ERROR(Common_Filesystem, "mkdir failed on %s: %s", path.c_str(), strerror(err));
return false; return false;
#endif #endif
} }
@ -171,11 +171,11 @@ bool CreateDir(const std::string &path)
bool CreateFullPath(const std::string &fullPath) bool CreateFullPath(const std::string &fullPath)
{ {
int panicCounter = 100; int panicCounter = 100;
INFO_LOG(COMMON, "CreateFullPath: path %s", fullPath.c_str()); LOG_TRACE(Common_Filesystem, "path %s", fullPath.c_str());
if (FileUtil::Exists(fullPath)) if (FileUtil::Exists(fullPath))
{ {
INFO_LOG(COMMON, "CreateFullPath: path exists %s", fullPath.c_str()); LOG_WARNING(Common_Filesystem, "path exists %s", fullPath.c_str());
return true; return true;
} }
@ -192,7 +192,7 @@ bool CreateFullPath(const std::string &fullPath)
// Include the '/' so the first call is CreateDir("/") rather than CreateDir("") // Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
std::string const subPath(fullPath.substr(0, position + 1)); std::string const subPath(fullPath.substr(0, position + 1));
if (!FileUtil::IsDirectory(subPath) && !FileUtil::CreateDir(subPath)) { if (!FileUtil::IsDirectory(subPath) && !FileUtil::CreateDir(subPath)) {
ERROR_LOG(COMMON, "CreateFullPath: directory creation failed"); LOG_ERROR(Common, "CreateFullPath: directory creation failed");
return false; return false;
} }
@ -200,7 +200,7 @@ bool CreateFullPath(const std::string &fullPath)
panicCounter--; panicCounter--;
if (panicCounter <= 0) if (panicCounter <= 0)
{ {
ERROR_LOG(COMMON, "CreateFullPath: directory structure is too deep"); LOG_ERROR(Common, "CreateFullPath: directory structure is too deep");
return false; return false;
} }
position++; position++;
@ -211,12 +211,12 @@ bool CreateFullPath(const std::string &fullPath)
// Deletes a directory filename, returns true on success // Deletes a directory filename, returns true on success
bool DeleteDir(const std::string &filename) bool DeleteDir(const std::string &filename)
{ {
INFO_LOG(COMMON, "DeleteDir: directory %s", filename.c_str()); LOG_INFO(Common_Filesystem, "directory %s", filename.c_str());
// check if a directory // check if a directory
if (!FileUtil::IsDirectory(filename)) if (!FileUtil::IsDirectory(filename))
{ {
ERROR_LOG(COMMON, "DeleteDir: Not a directory %s", filename.c_str()); LOG_ERROR(Common_Filesystem, "Not a directory %s", filename.c_str());
return false; return false;
} }
@ -227,7 +227,7 @@ bool DeleteDir(const std::string &filename)
if (rmdir(filename.c_str()) == 0) if (rmdir(filename.c_str()) == 0)
return true; return true;
#endif #endif
ERROR_LOG(COMMON, "DeleteDir: %s: %s", filename.c_str(), GetLastErrorMsg()); LOG_ERROR(Common_Filesystem, "failed %s: %s", filename.c_str(), GetLastErrorMsg());
return false; return false;
} }
@ -235,11 +235,11 @@ bool DeleteDir(const std::string &filename)
// renames file srcFilename to destFilename, returns true on success // renames file srcFilename to destFilename, returns true on success
bool Rename(const std::string &srcFilename, const std::string &destFilename) bool Rename(const std::string &srcFilename, const std::string &destFilename)
{ {
INFO_LOG(COMMON, "Rename: %s --> %s", LOG_TRACE(Common_Filesystem, "%s --> %s",
srcFilename.c_str(), destFilename.c_str()); srcFilename.c_str(), destFilename.c_str());
if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) if (rename(srcFilename.c_str(), destFilename.c_str()) == 0)
return true; return true;
ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false; return false;
} }
@ -247,13 +247,13 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename)
// copies file srcFilename to destFilename, returns true on success // copies file srcFilename to destFilename, returns true on success
bool Copy(const std::string &srcFilename, const std::string &destFilename) bool Copy(const std::string &srcFilename, const std::string &destFilename)
{ {
INFO_LOG(COMMON, "Copy: %s --> %s", LOG_TRACE(Common_Filesystem, "%s --> %s",
srcFilename.c_str(), destFilename.c_str()); srcFilename.c_str(), destFilename.c_str());
#ifdef _WIN32 #ifdef _WIN32
if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE)) if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE))
return true; return true;
ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false; return false;
#else #else
@ -267,7 +267,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
FILE *input = fopen(srcFilename.c_str(), "rb"); FILE *input = fopen(srcFilename.c_str(), "rb");
if (!input) if (!input)
{ {
ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", LOG_ERROR(Common_Filesystem, "opening input failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false; return false;
} }
@ -277,7 +277,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
if (!output) if (!output)
{ {
fclose(input); fclose(input);
ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", LOG_ERROR(Common_Filesystem, "opening output failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false; return false;
} }
@ -291,8 +291,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
{ {
if (ferror(input) != 0) if (ferror(input) != 0)
{ {
ERROR_LOG(COMMON, LOG_ERROR(Common_Filesystem,
"Copy: failed reading from source, %s --> %s: %s", "failed reading from source, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
goto bail; goto bail;
} }
@ -302,8 +302,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
int wnum = fwrite(buffer, sizeof(char), rnum, output); int wnum = fwrite(buffer, sizeof(char), rnum, output);
if (wnum != rnum) if (wnum != rnum)
{ {
ERROR_LOG(COMMON, LOG_ERROR(Common_Filesystem,
"Copy: failed writing to output, %s --> %s: %s", "failed writing to output, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
goto bail; goto bail;
} }
@ -326,13 +326,13 @@ u64 GetSize(const std::string &filename)
{ {
if (!Exists(filename)) if (!Exists(filename))
{ {
WARN_LOG(COMMON, "GetSize: failed %s: No such file", filename.c_str()); LOG_ERROR(Common_Filesystem, "failed %s: No such file", filename.c_str());
return 0; return 0;
} }
if (IsDirectory(filename)) if (IsDirectory(filename))
{ {
WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str()); LOG_ERROR(Common_Filesystem, "failed %s: is a directory", filename.c_str());
return 0; return 0;
} }
@ -343,12 +343,12 @@ u64 GetSize(const std::string &filename)
if (stat64(filename.c_str(), &buf) == 0) if (stat64(filename.c_str(), &buf) == 0)
#endif #endif
{ {
DEBUG_LOG(COMMON, "GetSize: %s: %lld", LOG_TRACE(Common_Filesystem, "%s: %lld",
filename.c_str(), (long long)buf.st_size); filename.c_str(), (long long)buf.st_size);
return buf.st_size; return buf.st_size;
} }
ERROR_LOG(COMMON, "GetSize: Stat failed %s: %s", LOG_ERROR(Common_Filesystem, "Stat failed %s: %s",
filename.c_str(), GetLastErrorMsg()); filename.c_str(), GetLastErrorMsg());
return 0; return 0;
} }
@ -358,7 +358,7 @@ u64 GetSize(const int fd)
{ {
struct stat64 buf; struct stat64 buf;
if (fstat64(fd, &buf) != 0) { if (fstat64(fd, &buf) != 0) {
ERROR_LOG(COMMON, "GetSize: stat failed %i: %s", LOG_ERROR(Common_Filesystem, "GetSize: stat failed %i: %s",
fd, GetLastErrorMsg()); fd, GetLastErrorMsg());
return 0; return 0;
} }
@ -371,13 +371,13 @@ u64 GetSize(FILE *f)
// can't use off_t here because it can be 32-bit // can't use off_t here because it can be 32-bit
u64 pos = ftello(f); u64 pos = ftello(f);
if (fseeko(f, 0, SEEK_END) != 0) { if (fseeko(f, 0, SEEK_END) != 0) {
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s",
f, GetLastErrorMsg()); f, GetLastErrorMsg());
return 0; return 0;
} }
u64 size = ftello(f); u64 size = ftello(f);
if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) { if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) {
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s",
f, GetLastErrorMsg()); f, GetLastErrorMsg());
return 0; return 0;
} }
@ -387,11 +387,11 @@ u64 GetSize(FILE *f)
// creates an empty file filename, returns true on success // creates an empty file filename, returns true on success
bool CreateEmptyFile(const std::string &filename) bool CreateEmptyFile(const std::string &filename)
{ {
INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str()); LOG_TRACE(Common_Filesystem, "%s", filename.c_str());
if (!FileUtil::IOFile(filename, "wb")) if (!FileUtil::IOFile(filename, "wb"))
{ {
ERROR_LOG(COMMON, "CreateEmptyFile: failed %s: %s", LOG_ERROR(Common_Filesystem, "failed %s: %s",
filename.c_str(), GetLastErrorMsg()); filename.c_str(), GetLastErrorMsg());
return false; return false;
} }
@ -404,7 +404,7 @@ bool CreateEmptyFile(const std::string &filename)
// results into parentEntry. Returns the number of files+directories found // results into parentEntry. Returns the number of files+directories found
u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
{ {
INFO_LOG(COMMON, "ScanDirectoryTree: directory %s", directory.c_str()); LOG_TRACE(Common_Filesystem, "directory %s", directory.c_str());
// How many files + directories we found // How many files + directories we found
u32 foundEntries = 0; u32 foundEntries = 0;
#ifdef _WIN32 #ifdef _WIN32
@ -474,7 +474,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
// Deletes the given directory and anything under it. Returns true on success. // Deletes the given directory and anything under it. Returns true on success.
bool DeleteDirRecursively(const std::string &directory) bool DeleteDirRecursively(const std::string &directory)
{ {
INFO_LOG(COMMON, "DeleteDirRecursively: %s", directory.c_str()); LOG_TRACE(Common_Filesystem, "%s", directory.c_str());
#ifdef _WIN32 #ifdef _WIN32
// Find the first file in the directory. // Find the first file in the directory.
WIN32_FIND_DATA ffd; WIN32_FIND_DATA ffd;
@ -588,7 +588,7 @@ std::string GetCurrentDir()
// Get the current working directory (getcwd uses malloc) // Get the current working directory (getcwd uses malloc)
if (!(dir = __getcwd(nullptr, 0))) { if (!(dir = __getcwd(nullptr, 0))) {
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s",
GetLastErrorMsg()); GetLastErrorMsg());
return nullptr; return nullptr;
} }
@ -647,7 +647,7 @@ std::string GetSysDirectory()
#endif #endif
sysDir += DIR_SEP; sysDir += DIR_SEP;
INFO_LOG(COMMON, "GetSysDirectory: Setting to %s:", sysDir.c_str()); LOG_DEBUG(Common_Filesystem, "Setting to %s:", sysDir.c_str());
return sysDir; return sysDir;
} }
@ -695,7 +695,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
{ {
if (!FileUtil::IsDirectory(newPath)) if (!FileUtil::IsDirectory(newPath))
{ {
WARN_LOG(COMMON, "Invalid path specified %s", newPath.c_str()); LOG_ERROR(Common_Filesystem, "Invalid path specified %s", newPath.c_str());
return paths[DirIDX]; return paths[DirIDX];
} }
else else

View File

@ -126,23 +126,23 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
//#define INFO_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } while (0) //#define INFO_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } while (0)
//#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } while (0) //#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } while (0)
#define OS_LOG(t,...) LOG_INFO(Common, __VA_ARGS__) //#define OS_LOG(t,...) LOG_INFO(Common, __VA_ARGS__)
#define ERROR_LOG(t,...) LOG_ERROR(Common_Filesystem, __VA_ARGS__) //#define ERROR_LOG(t,...) LOG_ERROR(Common_Filesystem, __VA_ARGS__)
#define WARN_LOG(t,...) LOG_WARNING(Kernel_SVC, __VA_ARGS__) //#define WARN_LOG(t,...) LOG_WARNING(Kernel_SVC, __VA_ARGS__)
#define NOTICE_LOG(t,...) LOG_INFO(Service, __VA_ARGS__) //#define NOTICE_LOG(t,...) LOG_INFO(Service, __VA_ARGS__)
#define INFO_LOG(t,...) LOG_INFO(Service_FS, __VA_ARGS__) //#define INFO_LOG(t,...) LOG_INFO(Service_FS, __VA_ARGS__)
#define DEBUG_LOG(t,...) LOG_DEBUG(Common, __VA_ARGS__) //#define DEBUG_LOG(t,...) LOG_DEBUG(Common, __VA_ARGS__)
#if MAX_LOGLEVEL >= DEBUG_LEVEL #if MAX_LOGLEVEL >= DEBUG_LEVEL
#define _dbg_assert_(_t_, _a_) \ #define _dbg_assert_(_t_, _a_) \
if (!(_a_)) {\ if (!(_a_)) {\
ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \ LOG_CRITICAL(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
__LINE__, __FILE__, __TIME__); \ __LINE__, __FILE__, __TIME__); \
if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \ if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
} }
#define _dbg_assert_msg_(_t_, _a_, ...)\ #define _dbg_assert_msg_(_t_, _a_, ...)\
if (!(_a_)) {\ if (!(_a_)) {\
ERROR_LOG(_t_, __VA_ARGS__); \ LOG_CRITICAL(_t_, __VA_ARGS__); \
if (!PanicYesNo(__VA_ARGS__)) {Crash();} \ if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
} }
#define _dbg_update_() Host_UpdateLogDisplay(); #define _dbg_update_() Host_UpdateLogDisplay();

View File

@ -71,7 +71,7 @@ int ashmem_create_region(const char *name, size_t size)
return fd; return fd;
error: error:
ERROR_LOG(MEMMAP, "NASTY ASHMEM ERROR: ret = %08x", ret); LOG_ERROR(Common_Memory, "NASTY ASHMEM ERROR: ret = %08x", ret);
close(fd); close(fd);
return ret; return ret;
} }
@ -130,7 +130,7 @@ void MemArena::GrabLowMemSpace(size_t size)
// Note that it appears that ashmem is pinned by default, so no need to pin. // Note that it appears that ashmem is pinned by default, so no need to pin.
if (fd < 0) if (fd < 0)
{ {
ERROR_LOG(MEMMAP, "Failed to grab ashmem space of size: %08x errno: %d", (int)size, (int)(errno)); LOG_ERROR(Common_Memory, "Failed to grab ashmem space of size: %08x errno: %d", (int)size, (int)(errno));
return; return;
} }
#else #else
@ -148,12 +148,12 @@ void MemArena::GrabLowMemSpace(size_t size)
} }
else if (errno != EEXIST) else if (errno != EEXIST)
{ {
ERROR_LOG(MEMMAP, "shm_open failed: %s", strerror(errno)); LOG_ERROR(Common_Memory, "shm_open failed: %s", strerror(errno));
return; return;
} }
} }
if (ftruncate(fd, size) < 0) if (ftruncate(fd, size) < 0)
ERROR_LOG(MEMMAP, "Failed to allocate low memory space"); LOG_ERROR(Common_Memory, "Failed to allocate low memory space");
#endif #endif
} }
@ -197,7 +197,7 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base)
if (retval == MAP_FAILED) if (retval == MAP_FAILED)
{ {
NOTICE_LOG(MEMMAP, "mmap failed"); LOG_ERROR(Common_Memory, "mmap failed");
return nullptr; return nullptr;
} }
return retval; return retval;
@ -423,7 +423,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
base = (u8 *)base_addr; base = (u8 *)base_addr;
if (Memory_TryBase(base, views, num_views, flags, arena)) if (Memory_TryBase(base, views, num_views, flags, arena))
{ {
INFO_LOG(MEMMAP, "Found valid memory base at %p after %i tries.", base, base_attempts); LOG_DEBUG(Common_Memory, "Found valid memory base at %p after %i tries.", base, base_attempts);
base_attempts = 0; base_attempts = 0;
break; break;
} }
@ -442,7 +442,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
u8 *base = MemArena::Find4GBBase(); u8 *base = MemArena::Find4GBBase();
if (!Memory_TryBase(base, views, num_views, flags, arena)) if (!Memory_TryBase(base, views, num_views, flags, arena))
{ {
ERROR_LOG(MEMMAP, "MemoryMap_Setup: Failed finding a memory base."); LOG_ERROR(Common_Memory, "MemoryMap_Setup: Failed finding a memory base.");
PanicAlert("MemoryMap_Setup: Failed finding a memory base."); PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
return 0; return 0;
} }

View File

@ -109,7 +109,7 @@ 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)
ERROR_LOG(MEMMAP, "Failed to allocate aligned memory"); LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
#endif #endif
#endif #endif

View File

@ -75,7 +75,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
Common::CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args); Common::CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args);
va_end(args); va_end(args);
ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer); LOG_INFO(Common, "%s: %s", caption.c_str(), buffer);
// Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored // Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored
if (msg_handler && (AlertEnabled || Style == QUESTION || Style == CRITICAL)) if (msg_handler && (AlertEnabled || Style == QUESTION || Style == CRITICAL))

View File

@ -107,7 +107,7 @@ std::string StringFromFormat(const char* format, ...)
#else #else
va_start(args, format); va_start(args, format);
if (vasprintf(&buf, format, args) < 0) if (vasprintf(&buf, format, args) < 0)
ERROR_LOG(COMMON, "Unable to allocate memory for string"); LOG_ERROR(Common, "Unable to allocate memory for string");
va_end(args); va_end(args);
std::string temp = buf; std::string temp = buf;
@ -475,7 +475,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>&
iconv_t const conv_desc = iconv_open("UTF-8", fromcode); iconv_t const conv_desc = iconv_open("UTF-8", fromcode);
if ((iconv_t)(-1) == conv_desc) if ((iconv_t)(-1) == conv_desc)
{ {
ERROR_LOG(COMMON, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno)); LOG_ERROR(Common, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno));
iconv_close(conv_desc); iconv_close(conv_desc);
return {}; return {};
} }
@ -510,7 +510,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>&
} }
else else
{ {
ERROR_LOG(COMMON, "iconv failure [%s]: %s", fromcode, strerror(errno)); LOG_ERROR(Common, "iconv failure [%s]: %s", fromcode, strerror(errno));
break; break;
} }
} }
@ -531,7 +531,7 @@ std::u16string UTF8ToUTF16(const std::string& input)
iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8"); iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8");
if ((iconv_t)(-1) == conv_desc) if ((iconv_t)(-1) == conv_desc)
{ {
ERROR_LOG(COMMON, "Iconv initialization failure [UTF-8]: %s", strerror(errno)); LOG_ERROR(Common, "Iconv initialization failure [UTF-8]: %s", strerror(errno));
iconv_close(conv_desc); iconv_close(conv_desc);
return {}; return {};
} }
@ -566,7 +566,7 @@ std::u16string UTF8ToUTF16(const std::string& input)
} }
else else
{ {
ERROR_LOG(COMMON, "iconv failure [UTF-8]: %s", strerror(errno)); LOG_ERROR(Common, "iconv failure [UTF-8]: %s", strerror(errno));
break; break;
} }
} }

View File

@ -433,9 +433,7 @@ typedef struct _ldst_inst {
unsigned int inst; unsigned int inst;
get_addr_fp_t get_addr; get_addr_fp_t get_addr;
} ldst_inst; } ldst_inst;
#define DEBUG_MSG DEBUG_LOG(ARM11, "in %s %d\n", __FUNCTION__, __LINE__); \ #define DEBUG_MSG LOG_DEBUG(Core_ARM11, "inst is %x", inst); CITRA_IGNORE_EXIT(0)
DEBUG_LOG(ARM11, "inst is %x\n", inst); \
CITRA_IGNORE_EXIT(0)
int CondPassed(arm_processor *cpu, unsigned int cond); int CondPassed(arm_processor *cpu, unsigned int cond);
#define LnSWoUB(s) glue(LnSWoUB, s) #define LnSWoUB(s) glue(LnSWoUB, s)
@ -1423,7 +1421,7 @@ 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) {
DEBUG_LOG(ARM11, "inst_buf is full\n"); LOG_ERROR(Core_ARM11, "inst_buf is full");
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
} }
return (void *)&inst_buf[start]; return (void *)&inst_buf[start];
@ -1609,6 +1607,10 @@ get_addr_fp_t get_calc_addr_op(unsigned int inst)
#define CHECK_RM (inst_cream->Rm == 15) #define CHECK_RM (inst_cream->Rm == 15)
#define CHECK_RS (inst_cream->Rs == 15) #define CHECK_RS (inst_cream->Rs == 15)
#define UNIMPLEMENTED_INSTRUCTION(mnemonic) \
LOG_ERROR(Core_ARM11, "unimplemented instruction: %s", mnemonic); \
CITRA_IGNORE_EXIT(-1); \
return nullptr;
ARM_INST_PTR INTERPRETER_TRANSLATE(adc)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(adc)(unsigned int inst, int index)
{ {
@ -1723,7 +1725,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(bic)(unsigned int inst, int index)
inst_base->br = INDIRECT_BRANCH; inst_base->br = INDIRECT_BRANCH;
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(bkpt)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(bkpt)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("BKPT"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(blx)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(blx)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(blx_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(blx_inst));
@ -1758,7 +1760,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(bx)(unsigned int inst, int index)
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(bxj)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(bxj)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("BXJ"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(cdp)(unsigned int inst, int index){ ARM_INST_PTR INTERPRETER_TRANSLATE(cdp)(unsigned int inst, int index){
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(cdp_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(cdp_inst));
cdp_inst *inst_cream = (cdp_inst *)inst_base->component; cdp_inst *inst_cream = (cdp_inst *)inst_base->component;
@ -1775,7 +1777,7 @@ 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;
DEBUG_LOG(ARM11, "in func %s inst %x index %x\n", __FUNCTION__, inst, index); LOG_TRACE(Core_ARM11, "inst %x index %x", inst, index);
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(clrex)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(clrex)(unsigned int inst, int index)
@ -2205,7 +2207,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(mcr)(unsigned int inst, int index)
inst_cream->inst = inst; inst_cream->inst = inst;
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(mcrr)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(mcrr)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("MCRR"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(mla)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(mla)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mla_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mla_inst));
@ -2264,7 +2266,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(mrc)(unsigned int inst, int index)
inst_cream->inst = inst; inst_cream->inst = inst;
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(mrrc)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(mrrc)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("MRRC"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(mrs)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(mrs)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mrs_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(mrs_inst));
@ -2358,8 +2360,8 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(orr)(unsigned int inst, int index)
} }
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(pkhbt)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(pkhbt)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("PKHBT"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(pkhtb)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(pkhtb)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("PKHTB"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(pld)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(pld)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(pld_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(pld_inst));
@ -2371,16 +2373,16 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(pld)(unsigned int inst, int index)
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(qadd)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(qadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(qadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(qaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADDSUBX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(qdadd)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qdadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDADD"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(qdsub)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qdsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDSUB"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(qsub)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(qsub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qsub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(qsub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(qsubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(qsubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUBADDX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(rev)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(rev)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rev_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rev_inst));
@ -2410,8 +2412,8 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(rev16)(unsigned int inst, int index){
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(revsh)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(revsh)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("REVSH"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(rfe)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(rfe)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("RFE"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(rsb)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(rsb)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rsb_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rsb_inst));
@ -2460,9 +2462,9 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(rsc)(unsigned int inst, int index)
} }
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(sadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(sadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADD16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(sadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(sadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADD8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(saddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(saddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADDSUBX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(sbc)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(sbc)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(sbc_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(sbc_inst));
@ -2487,14 +2489,14 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(sbc)(unsigned int inst, int index)
} }
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(sel)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(sel)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SEL"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(setend)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(setend)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SETEND"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(shadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(shadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADD16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(shadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(shadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADD8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(shaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(shaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADDSUBX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(shsub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(shsub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHSUB16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(shsub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(shsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHSUB8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(shsubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(shsubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHSUBADDX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smla)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(smla)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smla_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smla_inst));
@ -2553,15 +2555,15 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(smlal)(unsigned int inst, int index)
inst_base->load_r15 = 1; inst_base->load_r15 = 1;
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALXY"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALD"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLAW"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smlsd)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smlsd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLSD"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smlsld)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smlsld)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLSLD"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smmla)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smmla)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMLA"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smmls)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smmls)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMLS"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smmul)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smmul)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMUL"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smuad)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smuad)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMUAD"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(smul)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(smul)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smul_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smul_inst));
@ -2624,13 +2626,13 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(smulw)(unsigned int inst, int index)
inst_base->load_r15 = 1; inst_base->load_r15 = 1;
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(smusd)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(smusd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMUSD"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(srs)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(srs)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SRS"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(ssat)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(ssat)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSAT"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(ssat16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(ssat16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSAT16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(ssub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(ssub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUB16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(ssub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(ssub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUB8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(ssubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(ssubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUBADDX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(stc)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(stc)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(stc_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(stc_inst));
@ -2937,9 +2939,9 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(sxtab)(unsigned int inst, int index){
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(sxtab16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(sxtab16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SXTAB16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(sxtah)(unsigned int inst, int index){ ARM_INST_PTR INTERPRETER_TRANSLATE(sxtah)(unsigned int inst, int index){
DEBUG_LOG(ARM11, "in func %s, SXTAH untested\n", __func__); LOG_WARNING(Core_ARM11, "SXTAH untested");
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(sxtah_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(sxtah_inst));
sxtah_inst *inst_cream = (sxtah_inst *)inst_base->component; sxtah_inst *inst_cream = (sxtah_inst *)inst_base->component;
@ -2955,7 +2957,7 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(sxtah)(unsigned int inst, int index){
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(sxtb16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(sxtb16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SXTB16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(teq)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(teq)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(teq_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(teq_inst));
@ -2999,16 +3001,16 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(tst)(unsigned int inst, int index)
inst_base->load_r15 = 1; inst_base->load_r15 = 1;
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(uadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UADD16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UADD8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UADDSUBX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uhadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uhadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHADD16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uhadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uhadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHADD8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uhaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uhaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHADDSUBX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uhsub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uhsub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHSUB16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uhsub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uhsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHSUB8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uhsubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uhsubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UHSUBADDX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(umaal)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(umaal)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UMAAL"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(umlal)(unsigned int inst, int index) ARM_INST_PTR INTERPRETER_TRANSLATE(umlal)(unsigned int inst, int index)
{ {
arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(umlal_inst)); arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(umlal_inst));
@ -3111,21 +3113,21 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(blx_1_thumb)(unsigned int tinst, int index)
return inst_base; return inst_base;
} }
ARM_INST_PTR INTERPRETER_TRANSLATE(uqadd16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uqadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQADD16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uqadd8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uqadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQADD8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uqaddsubx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uqaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQADDSUBX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uqsub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uqsub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQSUB16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uqsub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uqsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQSUB8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uqsubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uqsubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UQSUBADDX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(usad8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(usad8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USAD8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(usada8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(usada8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USADA8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(usat)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(usat)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USAT"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(usat16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(usat16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USAT16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(usub16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(usub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USUB16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(usub8)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(usub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USUB8"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(usubaddx)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(usubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("USUBADDX"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uxtab16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uxtab16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UXTAB16"); }
ARM_INST_PTR INTERPRETER_TRANSLATE(uxtb16)(unsigned int inst, int index){DEBUG_LOG(ARM11, "in func %s\n", __FUNCTION__);CITRA_IGNORE_EXIT(-1); return nullptr;} ARM_INST_PTR INTERPRETER_TRANSLATE(uxtb16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("UXTB16"); }
@ -3391,7 +3393,7 @@ static tdstate decode_thumb_instr(arm_processor *cpu, uint32_t inst, addr_t addr
} }
else{ else{
/* something wrong */ /* something wrong */
DEBUG_LOG(ARM11, "In %s, thumb decoder error\n", __FUNCTION__); LOG_ERROR(Core_ARM11, "thumb decoder error");
} }
break; break;
case 28: case 28:
@ -3599,7 +3601,7 @@ int InterpreterTranslate(arm_processor *cpu, int &bb_start, addr_t addr)
bank->bank_read(32, phys_addr, &inst); bank->bank_read(32, phys_addr, &inst);
} }
else { else {
DEBUG_LOG(ARM11, "SKYEYE: Read physical addr 0x%x error!!\n", phys_addr); LOG_ERROR(Core_ARM11, "SKYEYE: Read physical addr 0x%x error!!\n", phys_addr);
return FETCH_FAILURE; return FETCH_FAILURE;
} }
#else #else
@ -3629,8 +3631,8 @@ int InterpreterTranslate(arm_processor *cpu, int &bb_start, addr_t addr)
ret = decode_arm_instr(inst, &idx); ret = decode_arm_instr(inst, &idx);
if (ret == DECODE_FAILURE) { if (ret == DECODE_FAILURE) {
DEBUG_LOG(ARM11, "[info] : Decode failure.\tPC : [0x%x]\tInstruction : [%x]\n", phys_addr, inst); LOG_ERROR(Core_ARM11, "Decode failure.\tPC : [0x%x]\tInstruction : [%x]", phys_addr, inst);
DEBUG_LOG(ARM11, "cpsr=0x%x, cpu->TFlag=%d, r15=0x%x\n", cpu->Cpsr, cpu->TFlag, cpu->Reg[15]); LOG_ERROR(Core_ARM11, "cpsr=0x%x, cpu->TFlag=%d, r15=0x%x", cpu->Cpsr, cpu->TFlag, cpu->Reg[15]);
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
} }
// DEBUG_LOG(ARM11, "PC : [0x%x] INST : %s\n", cpu->translate_pc, arm_instruction[idx].name); // DEBUG_LOG(ARM11, "PC : [0x%x] INST : %s\n", cpu->translate_pc, arm_instruction[idx].name);
@ -3674,7 +3676,7 @@ void InterpreterInitInstLength(unsigned long long int *ptr, size_t size)
} }
} }
for (int i = 0; i < array_size - 4; i ++) for (int i = 0; i < array_size - 4; i ++)
DEBUG_LOG(ARM11, "[%d]:%d\n", i, InstLength[i]); LOG_DEBUG(Core_ARM11, "[%d]:%d", i, InstLength[i]);
} }
int clz(unsigned int x) int clz(unsigned int x)
@ -3721,7 +3723,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
//if (debug_function(core)) \ //if (debug_function(core)) \
if (core->check_int_flag) \ if (core->check_int_flag) \
goto END goto END
//DEBUG_LOG(ARM11, "icounter is %llx line is %d pc is %x\n", cpu->icounter, __LINE__, cpu->Reg[15]) //LOG_TRACE(Core_ARM11, "icounter is %llx pc is %x\n", cpu->icounter, cpu->Reg[15])
#else #else
#define INC_ICOUNTER ; #define INC_ICOUNTER ;
#endif #endif
@ -4348,7 +4350,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
bx_inst *inst_cream = (bx_inst *)inst_base->component; bx_inst *inst_cream = (bx_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
if (inst_cream->Rm == 15) if (inst_cream->Rm == 15)
DEBUG_LOG(ARM11, "In %s, BX at pc %x: use of Rm = R15 is discouraged\n", __FUNCTION__, cpu->Reg[15]); LOG_WARNING(Core_ARM11, "BX at pc %x: use of Rm = R15 is discouraged", cpu->Reg[15]);
cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1; cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1;
cpu->Reg[15] = cpu->Reg[inst_cream->Rm] & 0xfffffffe; cpu->Reg[15] = cpu->Reg[inst_cream->Rm] & 0xfffffffe;
// cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1; // cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1;
@ -4373,10 +4375,10 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->NumInstrsToExecute = 0; cpu->NumInstrsToExecute = 0;
return num_instrs; return num_instrs;
} }
ERROR_LOG(ARM11, "CDP insn inst=0x%x, pc=0x%x\n", inst_cream->inst, cpu->Reg[15]); LOG_ERROR(Core_ARM11, "CDP insn inst=0x%x, pc=0x%x\n", inst_cream->inst, cpu->Reg[15]);
unsigned cpab = (cpu->CDP[inst_cream->cp_num]) (cpu, ARMul_FIRST, inst_cream->inst); unsigned cpab = (cpu->CDP[inst_cream->cp_num]) (cpu, ARMul_FIRST, inst_cream->inst);
if(cpab != ARMul_DONE){ if(cpab != ARMul_DONE){
ERROR_LOG(ARM11, "CDP insn wrong, inst=0x%x, cp_num=0x%x\n", inst_cream->inst, inst_cream->cp_num); LOG_ERROR(Core_ARM11, "CDP insn wrong, inst=0x%x, cp_num=0x%x\n", inst_cream->inst, inst_cream->cp_num);
//CITRA_IGNORE_EXIT(-1); //CITRA_IGNORE_EXIT(-1);
} }
} }
@ -4803,7 +4805,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
& 0xffff; & 0xffff;
RD = RN + operand2; RD = RN + operand2;
if (inst_cream->Rn == 15 || inst_cream->Rm == 15) { if (inst_cream->Rn == 15 || inst_cream->Rm == 15) {
DEBUG_LOG(ARM11, "in line %d\n", __LINE__); LOG_ERROR(Core_ARM11, "invalid operands for UXTAH");
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
} }
} }
@ -4866,7 +4868,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
uint32_t rear_phys_addr; uint32_t rear_phys_addr;
fault = check_address_validity(cpu, addr + 4, &rear_phys_addr, 1); fault = check_address_validity(cpu, addr + 4, &rear_phys_addr, 1);
if(fault){ if(fault){
ERROR_LOG(ARM11, "mmu fault , should rollback the above get_addr\n"); LOG_ERROR(Core_ARM11, "mmu fault , should rollback the above get_addr\n");
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
goto MMU_EXCEPTION; goto MMU_EXCEPTION;
} }
@ -5089,7 +5091,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
switch(OPCODE_2){ switch(OPCODE_2){
case 0: /* invalidate all */ case 0: /* invalidate all */
//invalidate_all_tlb(state); //invalidate_all_tlb(state);
DEBUG_LOG(ARM11, "{TLB} [INSN] invalidate all\n"); LOG_DEBUG(Core_ARM11, "{TLB} [INSN] invalidate all");
//remove_tlb(INSN_TLB); //remove_tlb(INSN_TLB);
//erase_all(core, INSN_TLB); //erase_all(core, INSN_TLB);
break; break;
@ -5115,7 +5117,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
//invalidate_all_tlb(state); //invalidate_all_tlb(state);
//remove_tlb(DATA_TLB); //remove_tlb(DATA_TLB);
//erase_all(core, DATA_TLB); //erase_all(core, DATA_TLB);
DEBUG_LOG(ARM11, "{TLB} [DATA] invalidate all\n"); LOG_DEBUG(Core_ARM11, "{TLB} [DATA] invalidate all");
break; break;
case 1: /* invalidate by MVA */ case 1: /* invalidate by MVA */
//invalidate_by_mva(state, value); //invalidate_by_mva(state, value);
@ -5147,13 +5149,13 @@ unsigned InterpreterMainLoop(ARMul_State* state)
//invalidate_by_mva(state, value); //invalidate_by_mva(state, value);
//erase_by_mva(core, RD, DATA_TLB); //erase_by_mva(core, RD, DATA_TLB);
//erase_by_mva(core, RD, INSN_TLB); //erase_by_mva(core, RD, INSN_TLB);
DEBUG_LOG(ARM11, "{TLB} [UNIFILED] invalidate by mva\n"); LOG_DEBUG(Core_ARM11, "{TLB} [UNIFILED] invalidate by mva");
break; break;
case 2: /* invalidate by asid */ case 2: /* invalidate by asid */
//invalidate_by_asid(state, value); //invalidate_by_asid(state, value);
//erase_by_asid(core, RD, DATA_TLB); //erase_by_asid(core, RD, DATA_TLB);
//erase_by_asid(core, RD, INSN_TLB); //erase_by_asid(core, RD, INSN_TLB);
DEBUG_LOG(ARM11, "{TLB} [UNIFILED] invalidate by asid\n"); LOG_DEBUG(Core_ARM11, "{TLB} [UNIFILED] invalidate by asid");
break; break;
default: default:
break; break;
@ -5175,7 +5177,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
} else { } else {
DEBUG_LOG(ARM11, "mcr is not implementated. CRn is %d, CRm is %d, OPCODE_2 is %d\n", CRn, CRm, OPCODE_2); LOG_ERROR(Core_ARM11, "mcr CRn=%d, CRm=%d OP2=%d is not implemented", CRn, CRm, OPCODE_2);
} }
} }
} }
@ -5195,7 +5197,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
uint64_t rs = RS; uint64_t rs = RS;
uint64_t rn = RN; uint64_t rn = RN;
if (inst_cream->Rm == 15 || inst_cream->Rs == 15 || inst_cream->Rn == 15) { if (inst_cream->Rm == 15 || inst_cream->Rs == 15 || inst_cream->Rn == 15) {
DEBUG_LOG(ARM11, "in __line__\n", __LINE__); LOG_ERROR(Core_ARM11, "invalid operands for MLA");
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
} }
// RD = dst = RM * RS + RN; // RD = dst = RM * RS + RN;
@ -5309,7 +5311,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
} }
else { else {
DEBUG_LOG(ARM11, "mrc is not implementated. CRn is %d, CRm is %d, OPCODE_2 is %d\n", CRn, CRm, OPCODE_2); LOG_ERROR(Core_ARM11, "mrc CRn=%d, CRm=%d, OP2=%d is not implemented", CRn, CRm, OPCODE_2);
} }
} }
//DEBUG_LOG(ARM11, "mrc is not implementated. CRn is %d, CRm is %d, OPCODE_2 is %d\n", CRn, CRm, OPCODE_2); //DEBUG_LOG(ARM11, "mrc is not implementated. CRn is %d, CRm is %d, OPCODE_2 is %d\n", CRn, CRm, OPCODE_2);
@ -5500,7 +5502,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
(((RM >> 16) & 0xff) << 8) | (((RM >> 16) & 0xff) << 8) |
((RM >> 24) & 0xff); ((RM >> 24) & 0xff);
if (inst_cream->Rm == 15) { if (inst_cream->Rm == 15) {
DEBUG_LOG(ARM11, "in line %d\n", __LINE__); LOG_ERROR(Core_ARM11, "invalid operand for REV");
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
} }
} }
@ -5953,7 +5955,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
sxtb_inst *inst_cream = (sxtb_inst *)inst_base->component; sxtb_inst *inst_cream = (sxtb_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
if (inst_cream->Rm == 15) { if (inst_cream->Rm == 15) {
DEBUG_LOG(ARM11, "line is %d\n", __LINE__); LOG_ERROR(Core_ARM11, "invalid operand for SXTB");
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
} }
unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate); unsigned int operand2 = ROTATE_RIGHT_32(RM, 8 * inst_cream->rotate);
@ -6059,7 +6061,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
uint32_t rear_phys_addr; uint32_t rear_phys_addr;
fault = check_address_validity(cpu, addr + 4, &rear_phys_addr, 0); fault = check_address_validity(cpu, addr + 4, &rear_phys_addr, 0);
if (fault){ if (fault){
ERROR_LOG(ARM11, "mmu fault , should rollback the above get_addr\n"); LOG_ERROR(Core_ARM11, "mmu fault , should rollback the above get_addr\n");
CITRA_IGNORE_EXIT(-1); CITRA_IGNORE_EXIT(-1);
goto MMU_EXCEPTION; goto MMU_EXCEPTION;
} }

View File

@ -949,7 +949,7 @@ ARMul_Emulate26 (ARMul_State * state)
//printf("t decode %04lx -> %08lx\n", instr & 0xffff, armOp); //printf("t decode %04lx -> %08lx\n", instr & 0xffff, armOp);
if (armOp == 0xDEADC0DE) { if (armOp == 0xDEADC0DE) {
DEBUG("Failed to decode thumb opcode %04X at %08X\n", instr, pc); LOG_ERROR(Core_ARM11, "Failed to decode thumb opcode %04X at %08X", instr, pc);
} }
instr = armOp; instr = armOp;
@ -3437,7 +3437,7 @@ mainswitch:
case 0x7f: /* Load Byte, WriteBack, Pre Inc, Reg. */ case 0x7f: /* Load Byte, WriteBack, Pre Inc, Reg. */
if (BIT (4)) { if (BIT (4)) {
DEBUG("got unhandled special breakpoint\n"); LOG_DEBUG(Core_ARM11, "got unhandled special breakpoint");
return 1; return 1;
} }
UNDEF_LSRBaseEQOffWb; UNDEF_LSRBaseEQOffWb;

View File

@ -665,7 +665,7 @@ ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source)
//if (!CP_ACCESS_ALLOWED (state, CPNum)) { //if (!CP_ACCESS_ALLOWED (state, CPNum)) {
if (!state->MCR[CPNum]) { if (!state->MCR[CPNum]) {
//chy 2004-07-19 should fix in the future ????!!!! //chy 2004-07-19 should fix in the future ????!!!!
DEBUG("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source); LOG_ERROR(Core_ARM11, "SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x",CPNum, source);
ARMul_UndefInstr (state, instr); ARMul_UndefInstr (state, instr);
return; return;
} }
@ -690,7 +690,7 @@ ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source)
} }
if (cpab == ARMul_CANT) { if (cpab == ARMul_CANT) {
DEBUG("SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x\n", instr, CPNum, source); //ichfly todo LOG_ERROR(Core_ARM11, "SKYEYE ARMul_MCR, CANT, UndefinedInstr %x CPnum is %x, source %x", instr, CPNum, source); //ichfly todo
//ARMul_Abort (state, ARMul_UndefinedInstrV); //ARMul_Abort (state, ARMul_UndefinedInstrV);
} else { } else {
BUSUSEDINCPCN; BUSUSEDINCPCN;
@ -762,7 +762,7 @@ ARMword ARMul_MRC (ARMul_State * state, ARMword instr)
//if (!CP_ACCESS_ALLOWED (state, CPNum)) { //if (!CP_ACCESS_ALLOWED (state, CPNum)) {
if (!state->MRC[CPNum]) { if (!state->MRC[CPNum]) {
//chy 2004-07-19 should fix in the future????!!!! //chy 2004-07-19 should fix in the future????!!!!
DEBUG("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n", CPNum, instr); LOG_ERROR(Core_ARM11, "SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x", CPNum, instr);
ARMul_UndefInstr (state, instr); ARMul_UndefInstr (state, instr);
return -1; return -1;
} }
@ -865,7 +865,7 @@ void
ARMul_UndefInstr (ARMul_State * state, ARMword instr) ARMul_UndefInstr (ARMul_State * state, ARMword instr)
{ {
std::string disasm = ARM_Disasm::Disassemble(state->pc, instr); std::string disasm = ARM_Disasm::Disassemble(state->pc, instr);
ERROR_LOG(ARM11, "Undefined instruction!! Disasm: %s Opcode: 0x%x", disasm.c_str(), instr); LOG_ERROR(Core_ARM11, "Undefined instruction!! Disasm: %s Opcode: 0x%x", disasm.c_str(), instr);
ARMul_Abort (state, ARMul_UndefinedInstrV); ARMul_Abort (state, ARMul_UndefinedInstrV);
} }

View File

@ -467,7 +467,7 @@ ARMul_ThumbDecode (
(state->Reg[14] + ((tinstr & 0x07FF) << 1)) & 0xFFFFFFFC; (state->Reg[14] + ((tinstr & 0x07FF) << 1)) & 0xFFFFFFFC;
state->Reg[14] = (tmp | 1); state->Reg[14] = (tmp | 1);
CLEART; CLEART;
DEBUG_LOG(ARM11, "In %s, After BLX(1),LR=0x%x,PC=0x%x, offset=0x%x\n", __FUNCTION__, state->Reg[14], state->Reg[15], (tinstr &0x7FF) << 1); LOG_DEBUG(Core_ARM11, "After BLX(1),LR=0x%x,PC=0x%x, offset=0x%x", state->Reg[14], state->Reg[15], (tinstr &0x7FF) << 1);
valid = t_branch; valid = t_branch;
FLUSHPIPE; FLUSHPIPE;
} }

View File

@ -23,8 +23,6 @@
//extern ARMword isize; //extern ARMword isize;
#define DEBUG(...) DEBUG_LOG(ARM11, __VA_ARGS__)
/* Shift Opcodes. */ /* Shift Opcodes. */
#define LSL 0 #define LSL 0
#define LSR 1 #define LSR 1
@ -485,7 +483,7 @@ tdstate;
* out-of-updated with the newer ISA. * out-of-updated with the newer ISA.
* -- Michael.Kang * -- Michael.Kang
********************************************************************************/ ********************************************************************************/
#define UNDEF_WARNING WARN_LOG(ARM11, "undefined or unpredicted behavior for arm instruction.\n"); #define UNDEF_WARNING LOG_WARNING(Core_ARM11, "undefined or unpredicted behavior for arm instruction.");
/* Macros to scrutinize instructions. */ /* Macros to scrutinize instructions. */
#define UNDEF_Test UNDEF_WARNING #define UNDEF_Test UNDEF_WARNING

View File

@ -47,7 +47,7 @@ void Stop() {
/// Initialize the core /// Initialize the core
int Init() { int Init() {
NOTICE_LOG(MASTER_LOG, "initialized OK"); LOG_DEBUG(Core, "initialized OK");
disasm = new ARM_Disasm(); disasm = new ARM_Disasm();
g_sys_core = new ARM_Interpreter(); g_sys_core = new ARM_Interpreter();
@ -72,7 +72,7 @@ void Shutdown() {
delete g_app_core; delete g_app_core;
delete g_sys_core; delete g_sys_core;
NOTICE_LOG(MASTER_LOG, "shutdown OK"); LOG_DEBUG(Core, "shutdown OK");
} }
} // namespace } // namespace

View File

@ -124,7 +124,7 @@ int RegisterEvent(const char *name, TimedCallback callback)
void AntiCrashCallback(u64 userdata, int cyclesLate) void AntiCrashCallback(u64 userdata, int cyclesLate)
{ {
ERROR_LOG(TIME, "Savestate broken: an unregistered event was called."); LOG_CRITICAL(Core, "Savestate broken: an unregistered event was called.");
Core::Halt("invalid timing events"); Core::Halt("invalid timing events");
} }
@ -176,7 +176,7 @@ void Shutdown()
u64 GetTicks() u64 GetTicks()
{ {
ERROR_LOG(TIME, "Unimplemented function!"); LOG_ERROR(Core, "Unimplemented function!");
return 0; return 0;
//return (u64)globalTimer + slicelength - currentMIPS->downcount; //return (u64)globalTimer + slicelength - currentMIPS->downcount;
} }
@ -510,7 +510,7 @@ void MoveEvents()
void Advance() void Advance()
{ {
ERROR_LOG(TIME, "Unimplemented function!"); LOG_ERROR(Core, "Unimplemented function!");
//int cyclesExecuted = slicelength - currentMIPS->downcount; //int cyclesExecuted = slicelength - currentMIPS->downcount;
//globalTimer += cyclesExecuted; //globalTimer += cyclesExecuted;
//currentMIPS->downcount = slicelength; //currentMIPS->downcount = slicelength;
@ -547,7 +547,7 @@ void LogPendingEvents()
void Idle(int maxIdle) void Idle(int maxIdle)
{ {
ERROR_LOG(TIME, "Unimplemented function!"); LOG_ERROR(Core, "Unimplemented function!");
//int cyclesDown = currentMIPS->downcount; //int cyclesDown = currentMIPS->downcount;
//if (maxIdle != 0 && cyclesDown > maxIdle) //if (maxIdle != 0 && cyclesDown > maxIdle)
// cyclesDown = maxIdle; // cyclesDown = maxIdle;

View File

@ -100,7 +100,8 @@ public:
case Wchar: case Wchar:
return "[Wchar: " + AsString() + ']'; return "[Wchar: " + AsString() + ']';
default: default:
ERROR_LOG(KERNEL, "LowPathType cannot be converted to string!"); // TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
return {}; return {};
} }
} }
@ -114,7 +115,8 @@ public:
case Empty: case Empty:
return {}; return {};
default: default:
ERROR_LOG(KERNEL, "LowPathType cannot be converted to string!"); // TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
return {}; return {};
} }
} }
@ -128,7 +130,8 @@ public:
case Empty: case Empty:
return {}; return {};
default: default:
ERROR_LOG(KERNEL, "LowPathType cannot be converted to u16string!"); // TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
return {}; return {};
} }
} }
@ -144,7 +147,8 @@ public:
case Empty: case Empty:
return {}; return {};
default: default:
ERROR_LOG(KERNEL, "LowPathType cannot be converted to binary!"); // TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
return {}; return {};
} }
} }

View File

@ -16,7 +16,7 @@ namespace FileSys {
Archive_RomFS::Archive_RomFS(const Loader::AppLoader& app_loader) { Archive_RomFS::Archive_RomFS(const Loader::AppLoader& app_loader) {
// Load the RomFS from the app // Load the RomFS from the app
if (Loader::ResultStatus::Success != app_loader.ReadRomFS(raw_data)) { if (Loader::ResultStatus::Success != app_loader.ReadRomFS(raw_data)) {
WARN_LOG(FILESYS, "Unable to read RomFS!"); LOG_ERROR(Service_FS, "Unable to read RomFS!");
} }
} }
@ -39,12 +39,12 @@ std::unique_ptr<File> Archive_RomFS::OpenFile(const Path& path, const Mode mode)
* @return Whether the file could be deleted * @return Whether the file could be deleted
*/ */
bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const { bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const {
ERROR_LOG(FILESYS, "Attempted to delete a file from ROMFS."); LOG_WARNING(Service_FS, "Attempted to delete a file from ROMFS.");
return false; return false;
} }
bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const {
ERROR_LOG(FILESYS, "Attempted to rename a file within ROMFS."); LOG_WARNING(Service_FS, "Attempted to rename a file within ROMFS.");
return false; return false;
} }
@ -54,7 +54,7 @@ bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Pat
* @return Whether the directory could be deleted * @return Whether the directory could be deleted
*/ */
bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const { bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const {
ERROR_LOG(FILESYS, "Attempted to delete a directory from ROMFS."); LOG_WARNING(Service_FS, "Attempted to delete a directory from ROMFS.");
return false; return false;
} }
@ -64,12 +64,12 @@ bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const {
* @return Whether the directory could be created * @return Whether the directory could be created
*/ */
bool Archive_RomFS::CreateDirectory(const Path& path) const { bool Archive_RomFS::CreateDirectory(const Path& path) const {
ERROR_LOG(FILESYS, "Attempted to create a directory in ROMFS."); LOG_WARNING(Service_FS, "Attempted to create a directory in ROMFS.");
return false; return false;
} }
bool Archive_RomFS::RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { bool Archive_RomFS::RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const {
ERROR_LOG(FILESYS, "Attempted to rename a file within ROMFS."); LOG_WARNING(Service_FS, "Attempted to rename a file within ROMFS.");
return false; return false;
} }
@ -90,7 +90,7 @@ std::unique_ptr<Directory> Archive_RomFS::OpenDirectory(const Path& path) const
* @return Number of bytes read * @return Number of bytes read
*/ */
size_t Archive_RomFS::Read(const u64 offset, const u32 length, u8* buffer) const { size_t Archive_RomFS::Read(const u64 offset, const u32 length, u8* buffer) const {
DEBUG_LOG(FILESYS, "called offset=%llu, length=%d", offset, length); LOG_TRACE(Service_FS, "called offset=%llu, length=%d", offset, length);
memcpy(buffer, &raw_data[(u32)offset], length); memcpy(buffer, &raw_data[(u32)offset], length);
return length; return length;
} }
@ -104,7 +104,7 @@ size_t Archive_RomFS::Read(const u64 offset, const u32 length, u8* buffer) const
* @return Number of bytes written * @return Number of bytes written
*/ */
size_t Archive_RomFS::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) { size_t Archive_RomFS::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) {
ERROR_LOG(FILESYS, "Attempted to write to ROMFS."); LOG_WARNING(Service_FS, "Attempted to write to ROMFS.");
return 0; return 0;
} }
@ -120,7 +120,7 @@ size_t Archive_RomFS::GetSize() const {
* Set the size of the archive in bytes * Set the size of the archive in bytes
*/ */
void Archive_RomFS::SetSize(const u64 size) { void Archive_RomFS::SetSize(const u64 size) {
ERROR_LOG(FILESYS, "Attempted to set the size of ROMFS"); LOG_WARNING(Service_FS, "Attempted to set the size of ROMFS");
} }
} // namespace FileSys } // namespace FileSys

View File

@ -19,7 +19,7 @@ namespace FileSys {
Archive_SDMC::Archive_SDMC(const std::string& mount_point) { Archive_SDMC::Archive_SDMC(const std::string& mount_point) {
this->mount_point = mount_point; this->mount_point = mount_point;
DEBUG_LOG(FILESYS, "Directory %s set as SDMC.", mount_point.c_str()); LOG_INFO(Service_FS, "Directory %s set as SDMC.", mount_point.c_str());
} }
Archive_SDMC::~Archive_SDMC() { Archive_SDMC::~Archive_SDMC() {
@ -31,12 +31,12 @@ Archive_SDMC::~Archive_SDMC() {
*/ */
bool Archive_SDMC::Initialize() { bool Archive_SDMC::Initialize() {
if (!Settings::values.use_virtual_sd) { if (!Settings::values.use_virtual_sd) {
WARN_LOG(FILESYS, "SDMC disabled by config."); LOG_WARNING(Service_FS, "SDMC disabled by config.");
return false; return false;
} }
if (!FileUtil::CreateFullPath(mount_point)) { if (!FileUtil::CreateFullPath(mount_point)) {
WARN_LOG(FILESYS, "Unable to create SDMC path."); LOG_ERROR(Service_FS, "Unable to create SDMC path.");
return false; return false;
} }
@ -50,7 +50,7 @@ bool Archive_SDMC::Initialize() {
* @return Opened file, or nullptr * @return Opened file, or nullptr
*/ */
std::unique_ptr<File> Archive_SDMC::OpenFile(const Path& path, const Mode mode) const { std::unique_ptr<File> Archive_SDMC::OpenFile(const Path& path, const Mode mode) const {
DEBUG_LOG(FILESYS, "called path=%s mode=%u", path.DebugStr().c_str(), mode.hex); LOG_DEBUG(Service_FS, "called path=%s mode=%u", path.DebugStr().c_str(), mode.hex);
File_SDMC* file = new File_SDMC(this, path, mode); File_SDMC* file = new File_SDMC(this, path, mode);
if (!file->Open()) if (!file->Open())
return nullptr; return nullptr;
@ -98,7 +98,7 @@ bool Archive_SDMC::RenameDirectory(const FileSys::Path& src_path, const FileSys:
* @return Opened directory, or nullptr * @return Opened directory, or nullptr
*/ */
std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const Path& path) const { std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const Path& path) const {
DEBUG_LOG(FILESYS, "called path=%s", path.DebugStr().c_str()); LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str());
Directory_SDMC* directory = new Directory_SDMC(this, path); Directory_SDMC* directory = new Directory_SDMC(this, path);
if (!directory->Open()) if (!directory->Open())
return nullptr; return nullptr;
@ -113,7 +113,7 @@ std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const Path& path) const {
* @return Number of bytes read * @return Number of bytes read
*/ */
size_t Archive_SDMC::Read(const u64 offset, const u32 length, u8* buffer) const { size_t Archive_SDMC::Read(const u64 offset, const u32 length, u8* buffer) const {
ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); LOG_ERROR(Service_FS, "(UNIMPLEMENTED)");
return -1; return -1;
} }
@ -126,7 +126,7 @@ size_t Archive_SDMC::Read(const u64 offset, const u32 length, u8* buffer) const
* @return Number of bytes written * @return Number of bytes written
*/ */
size_t Archive_SDMC::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) { size_t Archive_SDMC::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) {
ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); LOG_ERROR(Service_FS, "(UNIMPLEMENTED)");
return -1; return -1;
} }
@ -135,7 +135,7 @@ size_t Archive_SDMC::Write(const u64 offset, const u32 length, const u32 flush,
* @return Size of the archive in bytes * @return Size of the archive in bytes
*/ */
size_t Archive_SDMC::GetSize() const { size_t Archive_SDMC::GetSize() const {
ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); LOG_ERROR(Service_FS, "(UNIMPLEMENTED)");
return 0; return 0;
} }
@ -143,7 +143,7 @@ size_t Archive_SDMC::GetSize() const {
* Set the size of the archive in bytes * Set the size of the archive in bytes
*/ */
void Archive_SDMC::SetSize(const u64 size) { void Archive_SDMC::SetSize(const u64 size) {
ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); LOG_ERROR(Service_FS, "(UNIMPLEMENTED)");
} }
/** /**

View File

@ -49,7 +49,7 @@ u32 Directory_SDMC::Read(const u32 count, Entry* entries) {
const std::string& filename = file.virtualName; const std::string& filename = file.virtualName;
Entry& entry = entries[entries_read]; Entry& entry = entries[entries_read];
WARN_LOG(FILESYS, "File %s: size=%llu dir=%d", filename.c_str(), file.size, file.isDirectory); LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size, file.isDirectory);
// TODO(Link Mauve): use a proper conversion to UTF-16. // TODO(Link Mauve): use a proper conversion to UTF-16.
for (size_t j = 0; j < FILENAME_LENGTH; ++j) { for (size_t j = 0; j < FILENAME_LENGTH; ++j) {

View File

@ -33,7 +33,7 @@ File_SDMC::~File_SDMC() {
*/ */
bool File_SDMC::Open() { bool File_SDMC::Open() {
if (!mode.create_flag && !FileUtil::Exists(path)) { if (!mode.create_flag && !FileUtil::Exists(path)) {
ERROR_LOG(FILESYS, "Non-existing file %s cant be open without mode create.", path.c_str()); LOG_ERROR(Service_FS, "Non-existing file %s cant be open without mode create.", path.c_str());
return false; return false;
} }

View File

@ -55,7 +55,7 @@ inline void Read(T &var, const u32 addr) {
break; break;
default: default:
ERROR_LOG(HLE, "unknown addr=0x%08X", addr); LOG_ERROR(Kernel, "unknown addr=0x%08X", addr);
} }
} }

View File

@ -20,7 +20,7 @@ bool g_reschedule = false; ///< If true, immediately reschedules the CPU to a n
const FunctionDef* GetSVCInfo(u32 opcode) { const FunctionDef* GetSVCInfo(u32 opcode) {
u32 func_num = opcode & 0xFFFFFF; // 8 bits u32 func_num = opcode & 0xFFFFFF; // 8 bits
if (func_num > 0xFF) { if (func_num > 0xFF) {
ERROR_LOG(HLE,"unknown svc=0x%02X", func_num); LOG_ERROR(Kernel_SVC,"unknown svc=0x%02X", func_num);
return nullptr; return nullptr;
} }
return &g_module_db[0].func_table[func_num]; return &g_module_db[0].func_table[func_num];
@ -35,14 +35,12 @@ void CallSVC(u32 opcode) {
if (info->func) { if (info->func) {
info->func(); info->func();
} else { } else {
ERROR_LOG(HLE, "unimplemented SVC function %s(..)", info->name.c_str()); LOG_ERROR(Kernel_SVC, "unimplemented SVC function %s(..)", info->name.c_str());
} }
} }
void Reschedule(const char *reason) { void Reschedule(const char *reason) {
#ifdef _DEBUG _dbg_assert_msg_(Kernel, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
_dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
#endif
Core::g_app_core->PrepareReschedule(); Core::g_app_core->PrepareReschedule();
g_reschedule = true; g_reschedule = true;
} }
@ -61,7 +59,7 @@ void Init() {
RegisterAllModules(); RegisterAllModules();
NOTICE_LOG(HLE, "initialized OK"); LOG_DEBUG(Kernel, "initialized OK");
} }
void Shutdown() { void Shutdown() {
@ -69,7 +67,7 @@ void Shutdown() {
g_module_db.clear(); g_module_db.clear();
NOTICE_LOG(HLE, "shutdown OK"); LOG_DEBUG(Kernel, "shutdown OK");
} }
} // namespace } // namespace

View File

@ -24,12 +24,6 @@ public:
Kernel::HandleType GetHandleType() const override { return HandleType::AddressArbiter; } Kernel::HandleType GetHandleType() const override { return HandleType::AddressArbiter; }
std::string name; ///< Name of address arbiter object (optional) std::string name; ///< Name of address arbiter object (optional)
ResultVal<bool> WaitSynchronization() override {
// TODO(bunnei): ImplementMe
ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
return UnimplementedFunction(ErrorModule::OS);
}
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
@ -59,7 +53,7 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3
break; break;
default: default:
ERROR_LOG(KERNEL, "unknown type=%d", type); LOG_ERROR(Kernel, "unknown type=%d", type);
return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel, ErrorSummary::WrongArgument, ErrorLevel::Usage); return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel, ErrorSummary::WrongArgument, ErrorLevel::Usage);
} }
return RESULT_SUCCESS; return RESULT_SUCCESS;

View File

@ -94,26 +94,20 @@ public:
} }
case FileCommand::Close: case FileCommand::Close:
{ {
DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
CloseArchive(backend->GetIdCode()); CloseArchive(backend->GetIdCode());
break; break;
} }
// Unknown command... // Unknown command...
default: default:
{ {
ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); LOG_ERROR(Service_FS, "Unknown command=0x%08X", cmd);
return UnimplementedFunction(ErrorModule::FS); return UnimplementedFunction(ErrorModule::FS);
} }
} }
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
return MakeResult<bool>(false); return MakeResult<bool>(false);
} }
ResultVal<bool> WaitSynchronization() override {
// TODO(bunnei): ImplementMe
ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
return UnimplementedFunction(ErrorModule::FS);
}
}; };
class File : public Object { class File : public Object {
@ -138,7 +132,7 @@ public:
u64 offset = cmd_buff[1] | ((u64) cmd_buff[2]) << 32; u64 offset = cmd_buff[1] | ((u64) cmd_buff[2]) << 32;
u32 length = cmd_buff[3]; u32 length = cmd_buff[3];
u32 address = cmd_buff[5]; u32 address = cmd_buff[5];
DEBUG_LOG(KERNEL, "Read %s %s: offset=0x%llx length=%d address=0x%x", LOG_TRACE(Service_FS, "Read %s %s: offset=0x%llx length=%d address=0x%x",
GetTypeName().c_str(), GetName().c_str(), offset, length, address); GetTypeName().c_str(), GetName().c_str(), offset, length, address);
cmd_buff[2] = backend->Read(offset, length, Memory::GetPointer(address)); cmd_buff[2] = backend->Read(offset, length, Memory::GetPointer(address));
break; break;
@ -151,7 +145,7 @@ public:
u32 length = cmd_buff[3]; u32 length = cmd_buff[3];
u32 flush = cmd_buff[4]; u32 flush = cmd_buff[4];
u32 address = cmd_buff[6]; u32 address = cmd_buff[6];
DEBUG_LOG(KERNEL, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x", LOG_TRACE(Service_FS, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x",
GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush); GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush);
cmd_buff[2] = backend->Write(offset, length, flush, Memory::GetPointer(address)); cmd_buff[2] = backend->Write(offset, length, flush, Memory::GetPointer(address));
break; break;
@ -159,7 +153,7 @@ public:
case FileCommand::GetSize: case FileCommand::GetSize:
{ {
DEBUG_LOG(KERNEL, "GetSize %s %s", GetTypeName().c_str(), GetName().c_str()); LOG_TRACE(Service_FS, "GetSize %s %s", GetTypeName().c_str(), GetName().c_str());
u64 size = backend->GetSize(); u64 size = backend->GetSize();
cmd_buff[2] = (u32)size; cmd_buff[2] = (u32)size;
cmd_buff[3] = size >> 32; cmd_buff[3] = size >> 32;
@ -169,7 +163,7 @@ public:
case FileCommand::SetSize: case FileCommand::SetSize:
{ {
u64 size = cmd_buff[1] | ((u64)cmd_buff[2] << 32); u64 size = cmd_buff[1] | ((u64)cmd_buff[2] << 32);
DEBUG_LOG(KERNEL, "SetSize %s %s size=%llu", LOG_TRACE(Service_FS, "SetSize %s %s size=%llu",
GetTypeName().c_str(), GetName().c_str(), size); GetTypeName().c_str(), GetName().c_str(), size);
backend->SetSize(size); backend->SetSize(size);
break; break;
@ -177,14 +171,14 @@ public:
case FileCommand::Close: case FileCommand::Close:
{ {
DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
Kernel::g_object_pool.Destroy<File>(GetHandle()); Kernel::g_object_pool.Destroy<File>(GetHandle());
break; break;
} }
// Unknown command... // Unknown command...
default: default:
ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
ResultCode error = UnimplementedFunction(ErrorModule::FS); ResultCode error = UnimplementedFunction(ErrorModule::FS);
cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that. cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
return error; return error;
@ -192,12 +186,6 @@ public:
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
return MakeResult<bool>(false); return MakeResult<bool>(false);
} }
ResultVal<bool> WaitSynchronization() override {
// TODO(bunnei): ImplementMe
ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
return UnimplementedFunction(ErrorModule::FS);
}
}; };
class Directory : public Object { class Directory : public Object {
@ -222,7 +210,7 @@ public:
u32 count = cmd_buff[1]; u32 count = cmd_buff[1];
u32 address = cmd_buff[3]; u32 address = cmd_buff[3];
auto entries = reinterpret_cast<FileSys::Entry*>(Memory::GetPointer(address)); auto entries = reinterpret_cast<FileSys::Entry*>(Memory::GetPointer(address));
DEBUG_LOG(KERNEL, "Read %s %s: count=%d", LOG_TRACE(Service_FS, "Read %s %s: count=%d",
GetTypeName().c_str(), GetName().c_str(), count); GetTypeName().c_str(), GetName().c_str(), count);
// Number of entries actually read // Number of entries actually read
@ -232,14 +220,14 @@ public:
case DirectoryCommand::Close: case DirectoryCommand::Close:
{ {
DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
Kernel::g_object_pool.Destroy<Directory>(GetHandle()); Kernel::g_object_pool.Destroy<Directory>(GetHandle());
break; break;
} }
// Unknown command... // Unknown command...
default: default:
ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
ResultCode error = UnimplementedFunction(ErrorModule::FS); ResultCode error = UnimplementedFunction(ErrorModule::FS);
cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that. cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
return error; return error;
@ -247,12 +235,6 @@ public:
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
return MakeResult<bool>(false); return MakeResult<bool>(false);
} }
ResultVal<bool> WaitSynchronization() override {
// TODO(bunnei): ImplementMe
ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
return UnimplementedFunction(ErrorModule::FS);
}
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
@ -272,11 +254,11 @@ ResultVal<Handle> OpenArchive(FileSys::Archive::IdCode id_code) {
ResultCode CloseArchive(FileSys::Archive::IdCode id_code) { ResultCode CloseArchive(FileSys::Archive::IdCode id_code) {
auto itr = g_archive_map.find(id_code); auto itr = g_archive_map.find(id_code);
if (itr == g_archive_map.end()) { if (itr == g_archive_map.end()) {
ERROR_LOG(KERNEL, "Cannot close archive %d, does not exist!", (int)id_code); LOG_ERROR(Service_FS, "Cannot close archive %d, does not exist!", (int)id_code);
return InvalidHandle(ErrorModule::FS); return InvalidHandle(ErrorModule::FS);
} }
INFO_LOG(KERNEL, "Closed archive %d", (int) id_code); LOG_TRACE(Service_FS, "Closed archive %d", (int) id_code);
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
@ -288,11 +270,11 @@ ResultCode MountArchive(Archive* archive) {
FileSys::Archive::IdCode id_code = archive->backend->GetIdCode(); FileSys::Archive::IdCode id_code = archive->backend->GetIdCode();
ResultVal<Handle> archive_handle = OpenArchive(id_code); ResultVal<Handle> archive_handle = OpenArchive(id_code);
if (archive_handle.Succeeded()) { if (archive_handle.Succeeded()) {
ERROR_LOG(KERNEL, "Cannot mount two archives with the same ID code! (%d)", (int) id_code); LOG_ERROR(Service_FS, "Cannot mount two archives with the same ID code! (%d)", (int) id_code);
return archive_handle.Code(); return archive_handle.Code();
} }
g_archive_map[id_code] = archive->GetHandle(); g_archive_map[id_code] = archive->GetHandle();
INFO_LOG(KERNEL, "Mounted archive %s", archive->GetName().c_str()); LOG_TRACE(Service_FS, "Mounted archive %s", archive->GetName().c_str());
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
@ -442,7 +424,7 @@ void ArchiveInit() {
if (archive->Initialize()) if (archive->Initialize())
CreateArchive(archive, "SDMC"); CreateArchive(archive, "SDMC");
else else
ERROR_LOG(KERNEL, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str());
} }
/// Shutdown archives /// Shutdown archives

View File

@ -35,7 +35,7 @@ Handle ObjectPool::Create(Object* obj, int range_bottom, int range_top) {
return i + HANDLE_OFFSET; return i + HANDLE_OFFSET;
} }
} }
ERROR_LOG(HLE, "Unable to allocate kernel object, too many objects slots in use."); LOG_ERROR(Kernel, "Unable to allocate kernel object, too many objects slots in use.");
return 0; return 0;
} }
@ -62,7 +62,7 @@ void ObjectPool::Clear() {
Object* &ObjectPool::operator [](Handle handle) Object* &ObjectPool::operator [](Handle handle)
{ {
_dbg_assert_msg_(KERNEL, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ"); _dbg_assert_msg_(Kernel, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ");
return pool[handle - HANDLE_OFFSET]; return pool[handle - HANDLE_OFFSET];
} }
@ -70,7 +70,7 @@ void ObjectPool::List() {
for (int i = 0; i < MAX_COUNT; i++) { for (int i = 0; i < MAX_COUNT; i++) {
if (occupied[i]) { if (occupied[i]) {
if (pool[i]) { if (pool[i]) {
INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(), LOG_DEBUG(Kernel, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(),
pool[i]->GetName().c_str()); pool[i]->GetName().c_str());
} }
} }
@ -82,7 +82,7 @@ int ObjectPool::GetCount() const {
} }
Object* ObjectPool::CreateByIDType(int type) { Object* ObjectPool::CreateByIDType(int type) {
ERROR_LOG(COMMON, "Unimplemented: %d.", type); LOG_ERROR(Kernel, "Unimplemented: %d.", type);
return nullptr; return nullptr;
} }

View File

@ -57,7 +57,7 @@ public:
* @return True if the current thread should wait as a result of the sync * @return True if the current thread should wait as a result of the sync
*/ */
virtual ResultVal<bool> SyncRequest() { virtual ResultVal<bool> SyncRequest() {
ERROR_LOG(KERNEL, "(UNIMPLEMENTED)"); LOG_ERROR(Kernel, "(UNIMPLEMENTED)");
return UnimplementedFunction(ErrorModule::Kernel); return UnimplementedFunction(ErrorModule::Kernel);
} }
@ -65,7 +65,10 @@ public:
* Wait for kernel object to synchronize. * Wait for kernel object to synchronize.
* @return True if the current thread should wait as a result of the wait * @return True if the current thread should wait as a result of the wait
*/ */
virtual ResultVal<bool> WaitSynchronization() = 0; virtual ResultVal<bool> WaitSynchronization() {
LOG_ERROR(Kernel, "(UNIMPLEMENTED)");
return UnimplementedFunction(ErrorModule::Kernel);
}
}; };
class ObjectPool : NonCopyable { class ObjectPool : NonCopyable {
@ -92,13 +95,13 @@ public:
T* Get(Handle handle) { T* Get(Handle handle) {
if (handle < HANDLE_OFFSET || handle >= HANDLE_OFFSET + MAX_COUNT || !occupied[handle - HANDLE_OFFSET]) { if (handle < HANDLE_OFFSET || handle >= HANDLE_OFFSET + MAX_COUNT || !occupied[handle - HANDLE_OFFSET]) {
if (handle != 0) { if (handle != 0) {
WARN_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); LOG_ERROR(Kernel, "Bad object handle %08x", handle, handle);
} }
return nullptr; return nullptr;
} else { } else {
Object* t = pool[handle - HANDLE_OFFSET]; Object* t = pool[handle - HANDLE_OFFSET];
if (t->GetHandleType() != T::GetStaticHandleType()) { if (t->GetHandleType() != T::GetStaticHandleType()) {
WARN_LOG(KERNEL, "Kernel: Wrong object type for %i (%08x)", handle, handle); LOG_ERROR(Kernel, "Wrong object type for %08x", handle, handle);
return nullptr; return nullptr;
} }
return static_cast<T*>(t); return static_cast<T*>(t);
@ -109,7 +112,7 @@ public:
template <class T> template <class T>
T *GetFast(Handle handle) { T *GetFast(Handle handle) {
const Handle realHandle = handle - HANDLE_OFFSET; const Handle realHandle = handle - HANDLE_OFFSET;
_dbg_assert_(KERNEL, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]); _dbg_assert_(Kernel, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]);
return static_cast<T*>(pool[realHandle]); return static_cast<T*>(pool[realHandle]);
} }
@ -130,8 +133,8 @@ public:
bool GetIDType(Handle handle, HandleType* type) const { bool GetIDType(Handle handle, HandleType* type) const {
if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) || if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) ||
!occupied[handle - HANDLE_OFFSET]) { !occupied[handle - HANDLE_OFFSET]) {
ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); LOG_ERROR(Kernel, "Bad object handle %08X", handle, handle);
return false; return false;
} }
Object* t = pool[handle - HANDLE_OFFSET]; Object* t = pool[handle - HANDLE_OFFSET];

View File

@ -16,12 +16,6 @@ public:
static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::SharedMemory; } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::SharedMemory; }
Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::SharedMemory; } Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::SharedMemory; }
ResultVal<bool> WaitSynchronization() override {
// TODO(bunnei): ImplementMe
ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
return UnimplementedFunction(ErrorModule::OS);
}
u32 base_address; ///< Address of shared memory block in RAM u32 base_address; ///< Address of shared memory block in RAM
MemoryPermission permissions; ///< Permissions of shared memory block (SVC field) MemoryPermission permissions; ///< Permissions of shared memory block (SVC field)
MemoryPermission other_permissions; ///< Other permissions of shared memory block (SVC field) MemoryPermission other_permissions; ///< Other permissions of shared memory block (SVC field)
@ -61,7 +55,7 @@ ResultCode MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions
MemoryPermission other_permissions) { MemoryPermission other_permissions) {
if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) { if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) {
ERROR_LOG(KERNEL, "cannot map handle=0x%08X, address=0x%08X outside of shared mem bounds!", LOG_ERROR(Kernel_SVC, "cannot map handle=0x%08X, address=0x%08X outside of shared mem bounds!",
handle, address); handle, address);
return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent); ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
@ -83,7 +77,7 @@ ResultVal<u8*> GetSharedMemoryPointer(Handle handle, u32 offset) {
if (0 != shared_memory->base_address) if (0 != shared_memory->base_address)
return MakeResult<u8*>(Memory::GetPointer(shared_memory->base_address + offset)); return MakeResult<u8*>(Memory::GetPointer(shared_memory->base_address + offset));
ERROR_LOG(KERNEL, "memory block handle=0x%08X not mapped!", handle); LOG_ERROR(Kernel_SVC, "memory block handle=0x%08X not mapped!", handle);
// TODO(yuriks): Verify error code. // TODO(yuriks): Verify error code.
return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
ErrorSummary::InvalidState, ErrorLevel::Permanent); ErrorSummary::InvalidState, ErrorLevel::Permanent);

View File

@ -150,13 +150,13 @@ void ChangeReadyState(Thread* t, bool ready) {
/// Verify that a thread has not been released from waiting /// Verify that a thread has not been released from waiting
static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle) { static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle) {
_dbg_assert_(KERNEL, thread != nullptr); _dbg_assert_(Kernel, thread != nullptr);
return (type == thread->wait_type) && (wait_handle == thread->wait_handle) && (thread->IsWaiting()); return (type == thread->wait_type) && (wait_handle == thread->wait_handle) && (thread->IsWaiting());
} }
/// Verify that a thread has not been released from waiting (with wait address) /// Verify that a thread has not been released from waiting (with wait address)
static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle, VAddr wait_address) { static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle, VAddr wait_address) {
_dbg_assert_(KERNEL, thread != nullptr); _dbg_assert_(Kernel, thread != nullptr);
return VerifyWait(thread, type, wait_handle) && (wait_address == thread->wait_address); return VerifyWait(thread, type, wait_handle) && (wait_address == thread->wait_address);
} }
@ -196,7 +196,7 @@ void ChangeThreadState(Thread* t, ThreadStatus new_status) {
if (new_status == THREADSTATUS_WAIT) { if (new_status == THREADSTATUS_WAIT) {
if (t->wait_type == WAITTYPE_NONE) { if (t->wait_type == WAITTYPE_NONE) {
ERROR_LOG(KERNEL, "Waittype none not allowed"); LOG_ERROR(Kernel, "Waittype none not allowed");
} }
} }
} }
@ -318,12 +318,12 @@ void DebugThreadQueue() {
if (!thread) { if (!thread) {
return; return;
} }
INFO_LOG(KERNEL, "0x%02X 0x%08X (current)", thread->current_priority, GetCurrentThreadHandle()); LOG_DEBUG(Kernel, "0x%02X 0x%08X (current)", thread->current_priority, GetCurrentThreadHandle());
for (u32 i = 0; i < thread_queue.size(); i++) { for (u32 i = 0; i < thread_queue.size(); i++) {
Handle handle = thread_queue[i]; Handle handle = thread_queue[i];
s32 priority = thread_ready_queue.contains(handle); s32 priority = thread_ready_queue.contains(handle);
if (priority != -1) { if (priority != -1) {
INFO_LOG(KERNEL, "0x%02X 0x%08X", priority, handle); LOG_DEBUG(Kernel, "0x%02X 0x%08X", priority, handle);
} }
} }
} }
@ -333,7 +333,7 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio
s32 processor_id, u32 stack_top, int stack_size) { s32 processor_id, u32 stack_top, int stack_size) {
_assert_msg_(KERNEL, (priority >= THREADPRIO_HIGHEST && priority <= THREADPRIO_LOWEST), _assert_msg_(KERNEL, (priority >= THREADPRIO_HIGHEST && priority <= THREADPRIO_LOWEST),
"CreateThread priority=%d, outside of allowable range!", priority) "priority=%d, outside of allowable range!", priority)
Thread* thread = new Thread; Thread* thread = new Thread;
@ -362,24 +362,24 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3
u32 stack_top, int stack_size) { u32 stack_top, int stack_size) {
if (name == nullptr) { if (name == nullptr) {
ERROR_LOG(KERNEL, "CreateThread(): nullptr name"); LOG_ERROR(Kernel_SVC, "nullptr name");
return -1; return -1;
} }
if ((u32)stack_size < 0x200) { if ((u32)stack_size < 0x200) {
ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid stack_size=0x%08X", name, LOG_ERROR(Kernel_SVC, "(name=%s): invalid stack_size=0x%08X", name,
stack_size); stack_size);
return -1; return -1;
} }
if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) {
s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST);
WARN_LOG(KERNEL, "CreateThread(name=%s): invalid priority=0x%08X, clamping to %08X", LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d",
name, priority, new_priority); name, priority, new_priority);
// TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm // TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm
// validity of this // validity of this
priority = new_priority; priority = new_priority;
} }
if (!Memory::GetPointer(entry_point)) { if (!Memory::GetPointer(entry_point)) {
ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid entry %08x", name, entry_point); LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %08x", name, entry_point);
return -1; return -1;
} }
Handle handle; Handle handle;
@ -416,7 +416,7 @@ ResultCode SetThreadPriority(Handle handle, s32 priority) {
// If priority is invalid, clamp to valid range // If priority is invalid, clamp to valid range
if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) {
s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST);
WARN_LOG(KERNEL, "invalid priority=0x%08X, clamping to %08X", priority, new_priority); LOG_WARNING(Kernel_SVC, "invalid priority=%d, clamping to %d", priority, new_priority);
// TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm // TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm
// validity of this // validity of this
priority = new_priority; priority = new_priority;
@ -470,7 +470,7 @@ void Reschedule() {
Thread* next = NextThread(); Thread* next = NextThread();
HLE::g_reschedule = false; HLE::g_reschedule = false;
if (next > 0) { if (next > 0) {
INFO_LOG(KERNEL, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle()); LOG_TRACE(Kernel, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle());
SwitchContext(next); SwitchContext(next);

View File

@ -26,7 +26,7 @@ void GetWifiStatus(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
cmd_buff[2] = 0; // Connection type set to none cmd_buff[2] = 0; // Connection type set to none
WARN_LOG(KERNEL, "(STUBBED) called"); LOG_WARNING(Service_AC, "(STUBBED) called");
} }
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {

View File

@ -53,7 +53,7 @@ void Initialize(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
DEBUG_LOG(KERNEL, "called"); LOG_DEBUG(Service_APT, "called");
} }
void GetLockHandle(Service::Interface* self) { void GetLockHandle(Service::Interface* self) {
@ -74,14 +74,14 @@ void GetLockHandle(Service::Interface* self) {
cmd_buff[4] = 0; cmd_buff[4] = 0;
cmd_buff[5] = lock_handle; cmd_buff[5] = lock_handle;
DEBUG_LOG(KERNEL, "called handle=0x%08X", cmd_buff[5]); LOG_TRACE(Service_APT, "called handle=0x%08X", cmd_buff[5]);
} }
void Enable(Service::Interface* self) { void Enable(Service::Interface* self) {
u32* cmd_buff = Service::GetCommandBuffer(); u32* cmd_buff = Service::GetCommandBuffer();
u32 unk = cmd_buff[1]; // TODO(bunnei): What is this field used for? u32 unk = cmd_buff[1]; // TODO(bunnei): What is this field used for?
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
WARN_LOG(KERNEL, "(STUBBED) called unk=0x%08X", unk); LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X", unk);
} }
void InquireNotification(Service::Interface* self) { void InquireNotification(Service::Interface* self) {
@ -89,7 +89,7 @@ void InquireNotification(Service::Interface* self) {
u32 app_id = cmd_buff[2]; u32 app_id = cmd_buff[2];
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
cmd_buff[2] = static_cast<u32>(SignalType::None); // Signal type cmd_buff[2] = static_cast<u32>(SignalType::None); // Signal type
WARN_LOG(KERNEL, "(STUBBED) called app_id=0x%08X", app_id); LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X", app_id);
} }
/** /**
@ -122,7 +122,7 @@ void ReceiveParameter(Service::Interface* self) {
cmd_buff[5] = 0; cmd_buff[5] = 0;
cmd_buff[6] = 0; cmd_buff[6] = 0;
cmd_buff[7] = 0; cmd_buff[7] = 0;
WARN_LOG(KERNEL, "(STUBBED) called app_id=0x%08X, buffer_size=0x%08X", app_id, buffer_size); LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X, buffer_size=0x%08X", app_id, buffer_size);
} }
/** /**
@ -155,7 +155,7 @@ void GlanceParameter(Service::Interface* self) {
cmd_buff[6] = 0; cmd_buff[6] = 0;
cmd_buff[7] = 0; cmd_buff[7] = 0;
WARN_LOG(KERNEL, "(STUBBED) called app_id=0x%08X, buffer_size=0x%08X", app_id, buffer_size); LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X, buffer_size=0x%08X", app_id, buffer_size);
} }
/** /**
@ -181,7 +181,7 @@ void AppletUtility(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
WARN_LOG(KERNEL, "(STUBBED) called unk=0x%08X, buffer1_size=0x%08x, buffer2_size=0x%08x, " LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X, buffer1_size=0x%08x, buffer2_size=0x%08x, "
"buffer1_addr=0x%08x, buffer2_addr=0x%08x", unk, buffer1_size, buffer2_size, "buffer1_addr=0x%08x, buffer2_addr=0x%08x", unk, buffer1_size, buffer2_size,
buffer1_addr, buffer2_addr); buffer1_addr, buffer2_addr);
} }
@ -194,7 +194,7 @@ void AppletUtility(Service::Interface* self) {
* 4 : Handle to shared font memory * 4 : Handle to shared font memory
*/ */
void GetSharedFont(Service::Interface* self) { void GetSharedFont(Service::Interface* self) {
DEBUG_LOG(KERNEL, "called"); LOG_TRACE(Kernel_SVC, "called");
u32* cmd_buff = Service::GetCommandBuffer(); u32* cmd_buff = Service::GetCommandBuffer();
@ -210,7 +210,7 @@ void GetSharedFont(Service::Interface* self) {
cmd_buff[4] = shared_font_mem; cmd_buff[4] = shared_font_mem;
} else { } else {
cmd_buff[1] = -1; // Generic error (not really possible to verify this on hardware) cmd_buff[1] = -1; // Generic error (not really possible to verify this on hardware)
ERROR_LOG(KERNEL, "called, but %s has not been loaded!", SHARED_FONT); LOG_ERROR(Kernel_SVC, "called, but %s has not been loaded!", SHARED_FONT);
} }
} }
@ -321,7 +321,7 @@ Interface::Interface() {
// Create shared font memory object // Create shared font memory object
shared_font_mem = Kernel::CreateSharedMemory("APT_U:shared_font_mem"); shared_font_mem = Kernel::CreateSharedMemory("APT_U:shared_font_mem");
} else { } else {
WARN_LOG(KERNEL, "Unable to load shared font: %s", filepath.c_str()); LOG_WARNING(Service_APT, "Unable to load shared font: %s", filepath.c_str());
shared_font_mem = 0; shared_font_mem = 0;
} }

View File

@ -56,7 +56,7 @@ static void GetCountryCodeString(Service::Interface* self) {
u32 country_code_id = cmd_buffer[1]; u32 country_code_id = cmd_buffer[1];
if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) { if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) {
ERROR_LOG(KERNEL, "requested country code id=%d is invalid", country_code_id); LOG_ERROR(Service_CFG, "requested country code id=%d is invalid", country_code_id);
cmd_buffer[1] = ResultCode(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent).raw; cmd_buffer[1] = ResultCode(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent).raw;
return; return;
} }
@ -79,7 +79,7 @@ static void GetCountryCodeID(Service::Interface* self) {
u16 country_code_id = 0; u16 country_code_id = 0;
// The following algorithm will fail if the first country code isn't 0. // The following algorithm will fail if the first country code isn't 0.
_dbg_assert_(HLE, country_codes[0] == 0); _dbg_assert_(Service_CFG, country_codes[0] == 0);
for (size_t id = 0; id < country_codes.size(); ++id) { for (size_t id = 0; id < country_codes.size(); ++id) {
if (country_codes[id] == country_code) { if (country_codes[id] == country_code) {
@ -89,7 +89,7 @@ static void GetCountryCodeID(Service::Interface* self) {
} }
if (0 == country_code_id) { if (0 == country_code_id) {
ERROR_LOG(KERNEL, "requested country code name=%c%c is invalid", country_code & 0xff, country_code >> 8); LOG_ERROR(Service_CFG, "requested country code name=%c%c is invalid", country_code & 0xff, country_code >> 8);
cmd_buffer[1] = ResultCode(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent).raw; cmd_buffer[1] = ResultCode(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent).raw;
cmd_buffer[2] = 0xFFFF; cmd_buffer[2] = 0xFFFF;
return; return;

View File

@ -32,7 +32,7 @@ void ConvertProcessAddressFromDspDram(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
cmd_buff[2] = (addr << 1) + (Memory::DSP_MEMORY_VADDR + 0x40000); cmd_buff[2] = (addr << 1) + (Memory::DSP_MEMORY_VADDR + 0x40000);
DEBUG_LOG(KERNEL, "(STUBBED) called with address %u", addr); LOG_WARNING(Service_DSP, "(STUBBED) called with address %u", addr);
} }
/** /**
@ -55,7 +55,7 @@ void LoadComponent(Service::Interface* self) {
// TODO(bunnei): Implement real DSP firmware loading // TODO(bunnei): Implement real DSP firmware loading
DEBUG_LOG(KERNEL, "(STUBBED) called"); LOG_WARNING(Service_DSP, "(STUBBED) called");
} }
/** /**
@ -70,7 +70,7 @@ void GetSemaphoreEventHandle(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
cmd_buff[3] = semaphore_event; // Event handle cmd_buff[3] = semaphore_event; // Event handle
DEBUG_LOG(KERNEL, "(STUBBED) called"); LOG_WARNING(Service_DSP, "(STUBBED) called");
} }
/** /**
@ -89,7 +89,7 @@ void RegisterInterruptEvents(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
DEBUG_LOG(KERNEL, "(STUBBED) called"); LOG_WARNING(Service_DSP, "(STUBBED) called");
} }
/** /**
@ -106,7 +106,7 @@ void WriteReg0x10(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
DEBUG_LOG(KERNEL, "(STUBBED) called"); LOG_WARNING(Service_DSP, "(STUBBED) called");
} }
/** /**
@ -140,7 +140,7 @@ void ReadPipeIfPossible(Service::Interface* self) {
Memory::Write16(addr + offset, canned_read_pipe[read_pipe_count]); Memory::Write16(addr + offset, canned_read_pipe[read_pipe_count]);
read_pipe_count++; read_pipe_count++;
} else { } else {
ERROR_LOG(KERNEL, "canned read pipe log exceeded!"); LOG_ERROR(Service_DSP, "canned read pipe log exceeded!");
break; break;
} }
} }
@ -148,7 +148,7 @@ void ReadPipeIfPossible(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
cmd_buff[2] = (read_pipe_count - initial_size) * sizeof(u16); cmd_buff[2] = (read_pipe_count - initial_size) * sizeof(u16);
DEBUG_LOG(KERNEL, "(STUBBED) called size=0x%08X, buffer=0x%08X", size, addr); LOG_WARNING(Service_DSP, "(STUBBED) called size=0x%08X, buffer=0x%08X", size, addr);
} }
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {

View File

@ -23,7 +23,7 @@ static void Initialize(Service::Interface* self) {
// http://3dbrew.org/wiki/FS:Initialize#Request // http://3dbrew.org/wiki/FS:Initialize#Request
cmd_buff[1] = RESULT_SUCCESS.raw; cmd_buff[1] = RESULT_SUCCESS.raw;
DEBUG_LOG(KERNEL, "called"); LOG_DEBUG(Service_FS, "called");
} }
/** /**
@ -55,17 +55,15 @@ static void OpenFile(Service::Interface* self) {
u32 filename_ptr = cmd_buff[9]; u32 filename_ptr = cmd_buff[9];
FileSys::Path file_path(filename_type, filename_size, filename_ptr); FileSys::Path file_path(filename_type, filename_size, filename_ptr);
DEBUG_LOG(KERNEL, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes); LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes);
ResultVal<Handle> handle = Kernel::OpenFileFromArchive(archive_handle, file_path, mode); ResultVal<Handle> handle = Kernel::OpenFileFromArchive(archive_handle, file_path, mode);
cmd_buff[1] = handle.Code().raw; cmd_buff[1] = handle.Code().raw;
if (handle.Succeeded()) { if (handle.Succeeded()) {
cmd_buff[3] = *handle; cmd_buff[3] = *handle;
} else { } else {
ERROR_LOG(KERNEL, "failed to get a handle for file %s", file_path.DebugStr().c_str()); LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str());
} }
DEBUG_LOG(KERNEL, "called");
} }
/** /**
@ -102,11 +100,11 @@ static void OpenFileDirectly(Service::Interface* self) {
FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr); FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
FileSys::Path file_path(filename_type, filename_size, filename_ptr); FileSys::Path file_path(filename_type, filename_size, filename_ptr);
DEBUG_LOG(KERNEL, "archive_path=%s file_path=%s, mode=%u attributes=%d", LOG_DEBUG(Service_FS, "archive_path=%s file_path=%s, mode=%u attributes=%d",
archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex, attributes); archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex, attributes);
if (archive_path.GetType() != FileSys::Empty) { if (archive_path.GetType() != FileSys::Empty) {
ERROR_LOG(KERNEL, "archive LowPath type other than empty is currently unsupported"); LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported");
cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw; cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw;
return; return;
} }
@ -116,7 +114,7 @@ static void OpenFileDirectly(Service::Interface* self) {
ResultVal<Handle> archive_handle = Kernel::OpenArchive(archive_id); ResultVal<Handle> archive_handle = Kernel::OpenArchive(archive_id);
cmd_buff[1] = archive_handle.Code().raw; cmd_buff[1] = archive_handle.Code().raw;
if (archive_handle.Failed()) { if (archive_handle.Failed()) {
ERROR_LOG(KERNEL, "failed to get a handle for archive"); LOG_ERROR(Service_FS, "failed to get a handle for archive");
return; return;
} }
// cmd_buff[2] isn't used according to 3dmoo's implementation. // cmd_buff[2] isn't used according to 3dmoo's implementation.
@ -127,10 +125,8 @@ static void OpenFileDirectly(Service::Interface* self) {
if (handle.Succeeded()) { if (handle.Succeeded()) {
cmd_buff[3] = *handle; cmd_buff[3] = *handle;
} else { } else {
ERROR_LOG(KERNEL, "failed to get a handle for file %s", file_path.DebugStr().c_str()); LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str());
} }
DEBUG_LOG(KERNEL, "called");
} }
/* /*
@ -156,12 +152,10 @@ void DeleteFile(Service::Interface* self) {
FileSys::Path file_path(filename_type, filename_size, filename_ptr); FileSys::Path file_path(filename_type, filename_size, filename_ptr);
DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
filename_type, filename_size, file_path.DebugStr().c_str()); filename_type, filename_size, file_path.DebugStr().c_str());
cmd_buff[1] = Kernel::DeleteFileFromArchive(archive_handle, file_path).raw; cmd_buff[1] = Kernel::DeleteFileFromArchive(archive_handle, file_path).raw;
DEBUG_LOG(KERNEL, "called");
} }
/* /*
@ -197,13 +191,11 @@ void RenameFile(Service::Interface* self) {
FileSys::Path src_file_path(src_filename_type, src_filename_size, src_filename_ptr); FileSys::Path src_file_path(src_filename_type, src_filename_size, src_filename_ptr);
FileSys::Path dest_file_path(dest_filename_type, dest_filename_size, dest_filename_ptr); FileSys::Path dest_file_path(dest_filename_type, dest_filename_size, dest_filename_ptr);
DEBUG_LOG(KERNEL, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s", LOG_DEBUG(Service_FS, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(), src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(),
dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str()); dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str());
cmd_buff[1] = Kernel::RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, dest_file_path).raw; cmd_buff[1] = Kernel::RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, dest_file_path).raw;
DEBUG_LOG(KERNEL, "called");
} }
/* /*
@ -229,12 +221,10 @@ void DeleteDirectory(Service::Interface* self) {
FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr); FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
dirname_type, dirname_size, dir_path.DebugStr().c_str()); dirname_type, dirname_size, dir_path.DebugStr().c_str());
cmd_buff[1] = Kernel::DeleteDirectoryFromArchive(archive_handle, dir_path).raw; cmd_buff[1] = Kernel::DeleteDirectoryFromArchive(archive_handle, dir_path).raw;
DEBUG_LOG(KERNEL, "called");
} }
/* /*
@ -260,11 +250,9 @@ static void CreateDirectory(Service::Interface* self) {
FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr); FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_path).raw; cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_path).raw;
DEBUG_LOG(KERNEL, "called");
} }
/* /*
@ -300,13 +288,11 @@ void RenameDirectory(Service::Interface* self) {
FileSys::Path src_dir_path(src_dirname_type, src_dirname_size, src_dirname_ptr); FileSys::Path src_dir_path(src_dirname_type, src_dirname_size, src_dirname_ptr);
FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname_size, dest_dirname_ptr); FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname_size, dest_dirname_ptr);
DEBUG_LOG(KERNEL, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s", LOG_DEBUG(Service_FS, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(), src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(),
dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str()); dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str());
cmd_buff[1] = Kernel::RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, dest_dir_path).raw; cmd_buff[1] = Kernel::RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, dest_dir_path).raw;
DEBUG_LOG(KERNEL, "called");
} }
static void OpenDirectory(Service::Interface* self) { static void OpenDirectory(Service::Interface* self) {
@ -321,17 +307,15 @@ static void OpenDirectory(Service::Interface* self) {
FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr); FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
ResultVal<Handle> handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_path); ResultVal<Handle> handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_path);
cmd_buff[1] = handle.Code().raw; cmd_buff[1] = handle.Code().raw;
if (handle.Succeeded()) { if (handle.Succeeded()) {
cmd_buff[3] = *handle; cmd_buff[3] = *handle;
} else { } else {
ERROR_LOG(KERNEL, "failed to get a handle for directory"); LOG_ERROR(Service_FS, "failed to get a handle for directory");
} }
DEBUG_LOG(KERNEL, "called");
} }
/** /**
@ -356,10 +340,10 @@ static void OpenArchive(Service::Interface* self) {
u32 archivename_ptr = cmd_buff[5]; u32 archivename_ptr = cmd_buff[5];
FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr); FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
DEBUG_LOG(KERNEL, "archive_path=%s", archive_path.DebugStr().c_str()); LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str());
if (archive_path.GetType() != FileSys::Empty) { if (archive_path.GetType() != FileSys::Empty) {
ERROR_LOG(KERNEL, "archive LowPath type other than empty is currently unsupported"); LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported");
cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw; cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw;
return; return;
} }
@ -370,10 +354,8 @@ static void OpenArchive(Service::Interface* self) {
// cmd_buff[2] isn't used according to 3dmoo's implementation. // cmd_buff[2] isn't used according to 3dmoo's implementation.
cmd_buff[3] = *handle; cmd_buff[3] = *handle;
} else { } else {
ERROR_LOG(KERNEL, "failed to get a handle for archive"); LOG_ERROR(Service_FS, "failed to get a handle for archive");
} }
DEBUG_LOG(KERNEL, "called");
} }
/* /*
@ -388,7 +370,7 @@ static void IsSdmcDetected(Service::Interface* self) {
cmd_buff[1] = 0; cmd_buff[1] = 0;
cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0;
DEBUG_LOG(KERNEL, "called"); LOG_DEBUG(Service_FS, "called");
} }
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {

View File

@ -33,7 +33,7 @@ static inline u8* GetCommandBuffer(u32 thread_id) {
} }
static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index) { static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index) {
_dbg_assert_msg_(GSP, screen_index < 2, "Invalid screen index"); _dbg_assert_msg_(Service_GSP, screen_index < 2, "Invalid screen index");
// For each thread there are two FrameBufferUpdate fields // For each thread there are two FrameBufferUpdate fields
u32 offset = 0x200 + (2 * thread_id + screen_index) * sizeof(FrameBufferUpdate); u32 offset = 0x200 + (2 * thread_id + screen_index) * sizeof(FrameBufferUpdate);
@ -50,14 +50,14 @@ static inline InterruptRelayQueue* GetInterruptRelayQueue(u32 thread_id) {
static void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) { static void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) {
// TODO: Return proper error codes // TODO: Return proper error codes
if (base_address + size_in_bytes >= 0x420000) { if (base_address + size_in_bytes >= 0x420000) {
ERROR_LOG(GPU, "Write address out of range! (address=0x%08x, size=0x%08x)", LOG_ERROR(Service_GSP, "Write address out of range! (address=0x%08x, size=0x%08x)",
base_address, size_in_bytes); base_address, size_in_bytes);
return; return;
} }
// size should be word-aligned // size should be word-aligned
if ((size_in_bytes % 4) != 0) { if ((size_in_bytes % 4) != 0) {
ERROR_LOG(GPU, "Invalid size 0x%08x", size_in_bytes); LOG_ERROR(Service_GSP, "Invalid size 0x%08x", size_in_bytes);
return; return;
} }
@ -89,13 +89,13 @@ static void ReadHWRegs(Service::Interface* self) {
// TODO: Return proper error codes // TODO: Return proper error codes
if (reg_addr + size >= 0x420000) { if (reg_addr + size >= 0x420000) {
ERROR_LOG(GPU, "Read address out of range! (address=0x%08x, size=0x%08x)", reg_addr, size); LOG_ERROR(Service_GSP, "Read address out of range! (address=0x%08x, size=0x%08x)", reg_addr, size);
return; return;
} }
// size should be word-aligned // size should be word-aligned
if ((size % 4) != 0) { if ((size % 4) != 0) {
ERROR_LOG(GPU, "Invalid size 0x%08x", size); LOG_ERROR(Service_GSP, "Invalid size 0x%08x", size);
return; return;
} }
@ -177,11 +177,11 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) {
*/ */
void SignalInterrupt(InterruptId interrupt_id) { void SignalInterrupt(InterruptId interrupt_id) {
if (0 == g_interrupt_event) { if (0 == g_interrupt_event) {
WARN_LOG(GSP, "cannot synchronize until GSP event has been created!"); LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!");
return; return;
} }
if (0 == g_shared_memory) { if (0 == g_shared_memory) {
WARN_LOG(GSP, "cannot synchronize until GSP shared memory has been created!"); LOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!");
return; return;
} }
for (int thread_id = 0; thread_id < 0x4; ++thread_id) { for (int thread_id = 0; thread_id < 0x4; ++thread_id) {
@ -298,14 +298,14 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
} }
default: default:
ERROR_LOG(GSP, "unknown command 0x%08X", (int)command.id.Value()); LOG_ERROR(Service_GSP, "unknown command 0x%08X", (int)command.id.Value());
} }
} }
/// This triggers handling of the GX command written to the command buffer in shared memory. /// This triggers handling of the GX command written to the command buffer in shared memory.
static void TriggerCmdReqQueue(Service::Interface* self) { static void TriggerCmdReqQueue(Service::Interface* self) {
DEBUG_LOG(GSP, "called"); LOG_TRACE(Service_GSP, "called");
// Iterate through each thread's command queue... // Iterate through each thread's command queue...
for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) { for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) {

View File

@ -163,7 +163,7 @@ static void GetIPCHandles(Service::Interface* self) {
cmd_buff[7] = event_gyroscope; cmd_buff[7] = event_gyroscope;
cmd_buff[8] = event_debug_pad; cmd_buff[8] = event_debug_pad;
DEBUG_LOG(KERNEL, "called"); LOG_TRACE(Service_HID, "called");
} }
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {

View File

@ -42,7 +42,7 @@ static void GetAdapterState(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
cmd_buff[2] = battery_is_charging ? 1 : 0; cmd_buff[2] = battery_is_charging ? 1 : 0;
WARN_LOG(KERNEL, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
} }
/* /*
@ -57,7 +57,7 @@ static void GetShellState(Service::Interface* self) {
cmd_buff[1] = 0; cmd_buff[1] = 0;
cmd_buff[2] = shell_open ? 1 : 0; cmd_buff[2] = shell_open ? 1 : 0;
DEBUG_LOG(KERNEL, "PTM_U::GetShellState called"); LOG_TRACE(Service_PTM, "PTM_U::GetShellState called");
} }
/** /**
@ -76,7 +76,7 @@ static void GetBatteryLevel(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
cmd_buff[2] = static_cast<u32>(ChargeLevels::CompletelyFull); // Set to a completely full battery cmd_buff[2] = static_cast<u32>(ChargeLevels::CompletelyFull); // Set to a completely full battery
WARN_LOG(KERNEL, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
} }
/** /**
@ -94,7 +94,7 @@ static void GetBatteryChargeState(Service::Interface* self) {
cmd_buff[1] = 0; // No error cmd_buff[1] = 0; // No error
cmd_buff[2] = battery_is_charging ? 1 : 0; cmd_buff[2] = battery_is_charging ? 1 : 0;
WARN_LOG(KERNEL, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
} }
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {

View File

@ -106,13 +106,13 @@ void Init() {
g_manager->AddService(new SOC_U::Interface); g_manager->AddService(new SOC_U::Interface);
g_manager->AddService(new SSL_C::Interface); g_manager->AddService(new SSL_C::Interface);
NOTICE_LOG(HLE, "initialized OK"); LOG_DEBUG(Service, "initialized OK");
} }
/// Shutdown ServiceManager /// Shutdown ServiceManager
void Shutdown() { void Shutdown() {
delete g_manager; delete g_manager;
NOTICE_LOG(HLE, "shutdown OK"); LOG_DEBUG(Service, "shutdown OK");
} }

View File

@ -91,7 +91,7 @@ public:
std::string name = (itr == m_functions.end()) ? Common::StringFromFormat("0x%08X", cmd_buff[0]) : itr->second.name; std::string name = (itr == m_functions.end()) ? Common::StringFromFormat("0x%08X", cmd_buff[0]) : itr->second.name;
ERROR_LOG(OSHLE, error.c_str(), name.c_str(), GetPortName().c_str()); LOG_ERROR(Service, error.c_str(), name.c_str(), GetPortName().c_str());
// TODO(bunnei): Hack - ignore error // TODO(bunnei): Hack - ignore error
cmd_buff[1] = 0; cmd_buff[1] = 0;
@ -103,12 +103,6 @@ public:
return MakeResult<bool>(false); // TODO: Implement return from actual function return MakeResult<bool>(false); // TODO: Implement return from actual function
} }
ResultVal<bool> WaitSynchronization() override {
// TODO(bunnei): ImplementMe
ERROR_LOG(OSHLE, "unimplemented function");
return UnimplementedFunction(ErrorModule::OS);
}
protected: protected:
/** /**

View File

@ -14,7 +14,7 @@ namespace SRV {
static Handle g_event_handle = 0; static Handle g_event_handle = 0;
static void Initialize(Service::Interface* self) { static void Initialize(Service::Interface* self) {
DEBUG_LOG(OSHLE, "called"); LOG_DEBUG(Service_SRV, "called");
u32* cmd_buff = Service::GetCommandBuffer(); u32* cmd_buff = Service::GetCommandBuffer();
@ -22,7 +22,7 @@ static void Initialize(Service::Interface* self) {
} }
static void GetProcSemaphore(Service::Interface* self) { static void GetProcSemaphore(Service::Interface* self) {
DEBUG_LOG(OSHLE, "called"); LOG_TRACE(Service_SRV, "called");
u32* cmd_buff = Service::GetCommandBuffer(); u32* cmd_buff = Service::GetCommandBuffer();
@ -43,9 +43,9 @@ static void GetServiceHandle(Service::Interface* self) {
if (nullptr != service) { if (nullptr != service) {
cmd_buff[3] = service->GetHandle(); cmd_buff[3] = service->GetHandle();
DEBUG_LOG(OSHLE, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]); LOG_TRACE(Service_SRV, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]);
} else { } else {
ERROR_LOG(OSHLE, "(UNIMPLEMENTED) called port=%s", port_name.c_str()); LOG_ERROR(Service_SRV, "(UNIMPLEMENTED) called port=%s", port_name.c_str());
res = UnimplementedFunction(ErrorModule::SRV); res = UnimplementedFunction(ErrorModule::SRV);
} }
cmd_buff[1] = res.raw; cmd_buff[1] = res.raw;

View File

@ -31,7 +31,7 @@ enum ControlMemoryOperation {
/// Map application or GSP heap memory /// Map application or GSP heap memory
static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) {
DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", LOG_TRACE(Kernel_SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X",
operation, addr0, addr1, size, permissions); operation, addr0, addr1, size, permissions);
switch (operation) { switch (operation) {
@ -48,14 +48,14 @@ static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1,
// Unknown ControlMemory operation // Unknown ControlMemory operation
default: default:
ERROR_LOG(SVC, "unknown operation=0x%08X", operation); LOG_ERROR(Kernel_SVC, "unknown operation=0x%08X", operation);
} }
return 0; return 0;
} }
/// Maps a memory block to specified address /// Maps a memory block to specified address
static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) {
DEBUG_LOG(SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d",
handle, addr, permissions, other_permissions); handle, addr, permissions, other_permissions);
Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions); Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions);
@ -68,7 +68,7 @@ static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other
static_cast<Kernel::MemoryPermission>(other_permissions)); static_cast<Kernel::MemoryPermission>(other_permissions));
break; break;
default: default:
ERROR_LOG(OSHLE, "unknown permissions=0x%08X", permissions); LOG_ERROR(Kernel_SVC, "unknown permissions=0x%08X", permissions);
} }
return 0; return 0;
} }
@ -77,7 +77,7 @@ static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other
static Result ConnectToPort(Handle* out, const char* port_name) { static Result ConnectToPort(Handle* out, const char* port_name) {
Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
DEBUG_LOG(SVC, "called port_name=%s", port_name); LOG_TRACE(Kernel_SVC, "called port_name=%s", port_name);
_assert_msg_(KERNEL, (service != nullptr), "called, but service is not implemented!"); _assert_msg_(KERNEL, (service != nullptr), "called, but service is not implemented!");
*out = service->GetHandle(); *out = service->GetHandle();
@ -95,7 +95,7 @@ static Result SendSyncRequest(Handle handle) {
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
_assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!");
DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str()); LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str());
ResultVal<bool> wait = object->SyncRequest(); ResultVal<bool> wait = object->SyncRequest();
if (wait.Succeeded() && *wait) { if (wait.Succeeded() && *wait) {
@ -108,7 +108,7 @@ static Result SendSyncRequest(Handle handle) {
/// Close a handle /// Close a handle
static Result CloseHandle(Handle handle) { static Result CloseHandle(Handle handle) {
// ImplementMe // ImplementMe
ERROR_LOG(SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle); LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle);
return 0; return 0;
} }
@ -121,9 +121,9 @@ static Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
return InvalidHandle(ErrorModule::Kernel).raw; return InvalidHandle(ErrorModule::Kernel).raw;
} }
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
_dbg_assert_(KERNEL, object != nullptr); _dbg_assert_(Kernel, object != nullptr);
DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(), LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(),
object->GetName().c_str(), nano_seconds); object->GetName().c_str(), nano_seconds);
ResultVal<bool> wait = object->WaitSynchronization(); ResultVal<bool> wait = object->WaitSynchronization();
@ -143,7 +143,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
bool unlock_all = true; bool unlock_all = true;
bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated
DEBUG_LOG(SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld", LOG_TRACE(Kernel_SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld",
handle_count, (wait_all ? "true" : "false"), nano_seconds); handle_count, (wait_all ? "true" : "false"), nano_seconds);
// Iterate through each handle, synchronize kernel object // Iterate through each handle, synchronize kernel object
@ -153,7 +153,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
} }
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]); Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]);
DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(), LOG_TRACE(Kernel_SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(),
object->GetName().c_str()); object->GetName().c_str());
// TODO(yuriks): Verify how the real function behaves when an error happens here // TODO(yuriks): Verify how the real function behaves when an error happens here
@ -181,7 +181,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
/// Create an address arbiter (to allocate access to shared resources) /// Create an address arbiter (to allocate access to shared resources)
static Result CreateAddressArbiter(u32* arbiter) { static Result CreateAddressArbiter(u32* arbiter) {
DEBUG_LOG(SVC, "called"); LOG_TRACE(Kernel_SVC, "called");
Handle handle = Kernel::CreateAddressArbiter(); Handle handle = Kernel::CreateAddressArbiter();
*arbiter = handle; *arbiter = handle;
return 0; return 0;
@ -189,7 +189,7 @@ static Result CreateAddressArbiter(u32* arbiter) {
/// Arbitrate address /// Arbitrate address
static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) { static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) {
DEBUG_LOG(SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter, LOG_TRACE(Kernel_SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter,
address, type, value); address, type, value);
return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type), return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type),
address, value).raw; address, value).raw;
@ -197,7 +197,7 @@ static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value,
/// Used to output a message on a debug hardware unit - does nothing on a retail unit /// Used to output a message on a debug hardware unit - does nothing on a retail unit
static void OutputDebugString(const char* string) { static void OutputDebugString(const char* string) {
OS_LOG(SVC, "%s", string); LOG_DEBUG(Debug_Emulated, "%s", string);
} }
/// Get resource limit /// Get resource limit
@ -206,14 +206,14 @@ static Result GetResourceLimit(Handle* resource_limit, Handle process) {
// 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for
// the current KThread. // the current KThread.
*resource_limit = 0xDEADBEEF; *resource_limit = 0xDEADBEEF;
ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process); LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called process=0x%08X", process);
return 0; return 0;
} }
/// Get resource limit current values /// Get resource limit current values
static Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* names, static Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* names,
s32 name_count) { s32 name_count) {
ERROR_LOG(SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d", LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d",
resource_limit, names, name_count); resource_limit, names, name_count);
Memory::Write32(Core::g_app_core->GetReg(0), 0); // Normmatt: Set used memory to 0 for now Memory::Write32(Core::g_app_core->GetReg(0), 0); // Normmatt: Set used memory to 0 for now
return 0; return 0;
@ -234,7 +234,7 @@ static Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top
Core::g_app_core->SetReg(1, thread); Core::g_app_core->SetReg(1, thread);
DEBUG_LOG(SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " LOG_TRACE(Kernel_SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, "
"threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point,
name.c_str(), arg, stack_top, priority, processor_id, thread); name.c_str(), arg, stack_top, priority, processor_id, thread);
@ -245,7 +245,7 @@ static Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top
static u32 ExitThread() { static u32 ExitThread() {
Handle thread = Kernel::GetCurrentThreadHandle(); Handle thread = Kernel::GetCurrentThreadHandle();
DEBUG_LOG(SVC, "called, pc=0x%08X", Core::g_app_core->GetPC()); // PC = 0x0010545C LOG_TRACE(Kernel_SVC, "called, pc=0x%08X", Core::g_app_core->GetPC()); // PC = 0x0010545C
Kernel::StopThread(thread, __func__); Kernel::StopThread(thread, __func__);
HLE::Reschedule(__func__); HLE::Reschedule(__func__);
@ -269,42 +269,42 @@ static Result SetThreadPriority(Handle handle, s32 priority) {
/// Create a mutex /// Create a mutex
static Result CreateMutex(Handle* mutex, u32 initial_locked) { static Result CreateMutex(Handle* mutex, u32 initial_locked) {
*mutex = Kernel::CreateMutex((initial_locked != 0)); *mutex = Kernel::CreateMutex((initial_locked != 0));
DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X", LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X",
initial_locked ? "true" : "false", *mutex); initial_locked ? "true" : "false", *mutex);
return 0; return 0;
} }
/// Release a mutex /// Release a mutex
static Result ReleaseMutex(Handle handle) { static Result ReleaseMutex(Handle handle) {
DEBUG_LOG(SVC, "called handle=0x%08X", handle); LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle);
ResultCode res = Kernel::ReleaseMutex(handle); ResultCode res = Kernel::ReleaseMutex(handle);
return res.raw; return res.raw;
} }
/// Get the ID for the specified thread. /// Get the ID for the specified thread.
static Result GetThreadId(u32* thread_id, Handle handle) { static Result GetThreadId(u32* thread_id, Handle handle) {
DEBUG_LOG(SVC, "called thread=0x%08X", handle); LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle);
ResultCode result = Kernel::GetThreadId(thread_id, handle); ResultCode result = Kernel::GetThreadId(thread_id, handle);
return result.raw; return result.raw;
} }
/// Query memory /// Query memory
static Result QueryMemory(void* info, void* out, u32 addr) { static Result QueryMemory(void* info, void* out, u32 addr) {
ERROR_LOG(SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr);
return 0; return 0;
} }
/// Create an event /// Create an event
static Result CreateEvent(Handle* evt, u32 reset_type) { static Result CreateEvent(Handle* evt, u32 reset_type) {
*evt = Kernel::CreateEvent((ResetType)reset_type); *evt = Kernel::CreateEvent((ResetType)reset_type);
DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X", LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X",
reset_type, *evt); reset_type, *evt);
return 0; return 0;
} }
/// Duplicates a kernel handle /// Duplicates a kernel handle
static Result DuplicateHandle(Handle* out, Handle handle) { static Result DuplicateHandle(Handle* out, Handle handle) {
DEBUG_LOG(SVC, "called handle=0x%08X", handle); LOG_WARNING(Kernel_SVC, "(STUBBED) called handle=0x%08X", handle);
// Translate kernel handles -> real handles // Translate kernel handles -> real handles
if (handle == Kernel::CurrentThread) { if (handle == Kernel::CurrentThread) {
@ -321,19 +321,19 @@ static Result DuplicateHandle(Handle* out, Handle handle) {
/// Signals an event /// Signals an event
static Result SignalEvent(Handle evt) { static Result SignalEvent(Handle evt) {
DEBUG_LOG(SVC, "called event=0x%08X", evt); LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt);
return Kernel::SignalEvent(evt).raw; return Kernel::SignalEvent(evt).raw;
} }
/// Clears an event /// Clears an event
static Result ClearEvent(Handle evt) { static Result ClearEvent(Handle evt) {
DEBUG_LOG(SVC, "called event=0x%08X", evt); LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt);
return Kernel::ClearEvent(evt).raw; return Kernel::ClearEvent(evt).raw;
} }
/// Sleep the current thread /// Sleep the current thread
static void SleepThread(s64 nanoseconds) { static void SleepThread(s64 nanoseconds) {
DEBUG_LOG(SVC, "called nanoseconds=%lld", nanoseconds); LOG_TRACE(Kernel_SVC, "called nanoseconds=%lld", nanoseconds);
// Check for next thread to schedule // Check for next thread to schedule
HLE::Reschedule(__func__); HLE::Reschedule(__func__);

View File

@ -35,7 +35,7 @@ inline void Read(T &var, const u32 raw_addr) {
// Reads other than u32 are untested, so I'd rather have them abort than silently fail // Reads other than u32 are untested, so I'd rather have them abort than silently fail
if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) { if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) {
ERROR_LOG(GPU, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr); LOG_ERROR(HW_GPU, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr);
return; return;
} }
@ -49,7 +49,7 @@ inline void Write(u32 addr, const T data) {
// Writes other than u32 are untested, so I'd rather have them abort than silently fail // Writes other than u32 are untested, so I'd rather have them abort than silently fail
if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) { if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) {
ERROR_LOG(GPU, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr); LOG_ERROR(HW_GPU, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr);
return; return;
} }
@ -73,7 +73,7 @@ inline void Write(u32 addr, const T data) {
for (u32* ptr = start; ptr < end; ++ptr) for (u32* ptr = start; ptr < end; ++ptr)
*ptr = bswap32(config.value); // TODO: This is just a workaround to missing framebuffer format emulation *ptr = bswap32(config.value); // TODO: This is just a workaround to missing framebuffer format emulation
DEBUG_LOG(GPU, "MemoryFill from 0x%08x to 0x%08x", config.GetStartAddress(), config.GetEndAddress()); LOG_TRACE(HW_GPU, "MemoryFill from 0x%08x to 0x%08x", config.GetStartAddress(), config.GetEndAddress());
} }
break; break;
} }
@ -105,7 +105,7 @@ inline void Write(u32 addr, const T data) {
} }
default: default:
ERROR_LOG(GPU, "Unknown source framebuffer format %x", config.input_format.Value()); LOG_ERROR(HW_GPU, "Unknown source framebuffer format %x", config.input_format.Value());
break; break;
} }
@ -132,13 +132,13 @@ inline void Write(u32 addr, const T data) {
} }
default: default:
ERROR_LOG(GPU, "Unknown destination framebuffer format %x", config.output_format.Value()); LOG_ERROR(HW_GPU, "Unknown destination framebuffer format %x", config.output_format.Value());
break; break;
} }
} }
} }
DEBUG_LOG(GPU, "DisplayTriggerTransfer: 0x%08x bytes from 0x%08x(%ux%u)-> 0x%08x(%ux%u), dst format %x", LOG_TRACE(HW_GPU, "DisplayTriggerTransfer: 0x%08x bytes from 0x%08x(%ux%u)-> 0x%08x(%ux%u), dst format %x",
config.output_height * config.output_width * 4, config.output_height * config.output_width * 4,
config.GetPhysicalInputAddress(), (u32)config.input_width, (u32)config.input_height, config.GetPhysicalInputAddress(), (u32)config.input_width, (u32)config.input_height,
config.GetPhysicalOutputAddress(), (u32)config.output_width, (u32)config.output_height, config.GetPhysicalOutputAddress(), (u32)config.output_width, (u32)config.output_height,
@ -251,12 +251,12 @@ void Init() {
framebuffer_sub.color_format = Regs::PixelFormat::RGB8; framebuffer_sub.color_format = Regs::PixelFormat::RGB8;
framebuffer_sub.active_fb = 0; framebuffer_sub.active_fb = 0;
NOTICE_LOG(GPU, "initialized OK"); LOG_DEBUG(HW_GPU, "initialized OK");
} }
/// Shutdown hardware /// Shutdown hardware
void Shutdown() { void Shutdown() {
NOTICE_LOG(GPU, "shutdown OK"); LOG_DEBUG(HW_GPU, "shutdown OK");
} }
} // namespace } // namespace

View File

@ -44,7 +44,7 @@ inline void Read(T &var, const u32 addr) {
break; break;
default: default:
ERROR_LOG(HW, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr); LOG_ERROR(HW_Memory, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr);
} }
} }
@ -57,7 +57,7 @@ inline void Write(u32 addr, const T data) {
break; break;
default: default:
ERROR_LOG(HW, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr); LOG_ERROR(HW_Memory, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr);
} }
} }
@ -81,12 +81,12 @@ void Update() {
/// Initialize hardware /// Initialize hardware
void Init() { void Init() {
GPU::Init(); GPU::Init();
NOTICE_LOG(HW, "initialized OK"); LOG_DEBUG(HW, "initialized OK");
} }
/// Shutdown hardware /// Shutdown hardware
void Shutdown() { void Shutdown() {
NOTICE_LOG(HW, "shutdown OK"); LOG_DEBUG(HW, "shutdown OK");
} }
} }

View File

@ -174,14 +174,14 @@ int THREEDSXReader::Load3DSXFile(const std::string& filename, u32 base_addr)
return ERROR_READ; return ERROR_READ;
for (u32 current_inprogress = 0; current_inprogress < remaining && pos < end_pos; current_inprogress++) { for (u32 current_inprogress = 0; current_inprogress < remaining && pos < end_pos; current_inprogress++) {
DEBUG_LOG(LOADER, "(t=%d,skip=%u,patch=%u)\n", LOG_TRACE(Loader, "(t=%d,skip=%u,patch=%u)\n",
current_segment_reloc_table, (u32)reloc_table[current_inprogress].skip, (u32)reloc_table[current_inprogress].patch); current_segment_reloc_table, (u32)reloc_table[current_inprogress].skip, (u32)reloc_table[current_inprogress].patch);
pos += reloc_table[current_inprogress].skip; pos += reloc_table[current_inprogress].skip;
s32 num_patches = reloc_table[current_inprogress].patch; s32 num_patches = reloc_table[current_inprogress].patch;
while (0 < num_patches && pos < end_pos) { while (0 < num_patches && pos < end_pos) {
u32 in_addr = (char*)pos - (char*)&all_mem[0]; u32 in_addr = (char*)pos - (char*)&all_mem[0];
u32 addr = TranslateAddr(*pos, &loadinfo, offsets); u32 addr = TranslateAddr(*pos, &loadinfo, offsets);
DEBUG_LOG(LOADER, "Patching %08X <-- rel(%08X,%d) (%08X)\n", LOG_TRACE(Loader, "Patching %08X <-- rel(%08X,%d) (%08X)\n",
base_addr + in_addr, addr, current_segment_reloc_table, *pos); base_addr + in_addr, addr, current_segment_reloc_table, *pos);
switch (current_segment_reloc_table) { switch (current_segment_reloc_table) {
case 0: *pos = (addr); break; case 0: *pos = (addr); break;
@ -199,10 +199,10 @@ int THREEDSXReader::Load3DSXFile(const std::string& filename, u32 base_addr)
// Write the data // Write the data
memcpy(Memory::GetPointer(base_addr), &all_mem[0], loadinfo.seg_sizes[0] + loadinfo.seg_sizes[1] + loadinfo.seg_sizes[2]); memcpy(Memory::GetPointer(base_addr), &all_mem[0], loadinfo.seg_sizes[0] + loadinfo.seg_sizes[1] + loadinfo.seg_sizes[2]);
DEBUG_LOG(LOADER, "CODE: %u pages\n", loadinfo.seg_sizes[0] / 0x1000); LOG_DEBUG(Loader, "CODE: %u pages\n", loadinfo.seg_sizes[0] / 0x1000);
DEBUG_LOG(LOADER, "RODATA: %u pages\n", loadinfo.seg_sizes[1] / 0x1000); LOG_DEBUG(Loader, "RODATA: %u pages\n", loadinfo.seg_sizes[1] / 0x1000);
DEBUG_LOG(LOADER, "DATA: %u pages\n", data_load_size / 0x1000); LOG_DEBUG(Loader, "DATA: %u pages\n", data_load_size / 0x1000);
DEBUG_LOG(LOADER, "BSS: %u pages\n", bss_load_size / 0x1000); LOG_DEBUG(Loader, "BSS: %u pages\n", bss_load_size / 0x1000);
return ERROR_NONE; return ERROR_NONE;
} }
@ -220,7 +220,7 @@ int THREEDSXReader::Load3DSXFile(const std::string& filename, u32 base_addr)
* @return Success on success, otherwise Error * @return Success on success, otherwise Error
*/ */
ResultStatus AppLoader_THREEDSX::Load() { ResultStatus AppLoader_THREEDSX::Load() {
INFO_LOG(LOADER, "Loading 3DSX file %s...", filename.c_str()); LOG_INFO(Loader, "Loading 3DSX file %s...", filename.c_str());
FileUtil::IOFile file(filename, "rb"); FileUtil::IOFile file(filename, "rb");
if (file.IsOpen()) { if (file.IsOpen()) {

View File

@ -254,18 +254,18 @@ const char *ElfReader::GetSectionName(int section) const {
} }
bool ElfReader::LoadInto(u32 vaddr) { bool ElfReader::LoadInto(u32 vaddr) {
DEBUG_LOG(MASTER_LOG, "String section: %i", header->e_shstrndx); LOG_DEBUG(Loader, "String section: %i", header->e_shstrndx);
// Should we relocate? // Should we relocate?
relocate = (header->e_type != ET_EXEC); relocate = (header->e_type != ET_EXEC);
if (relocate) { if (relocate) {
DEBUG_LOG(MASTER_LOG, "Relocatable module"); LOG_DEBUG(Loader, "Relocatable module");
entryPoint += vaddr; entryPoint += vaddr;
} else { } else {
DEBUG_LOG(MASTER_LOG, "Prerelocated executable"); LOG_DEBUG(Loader, "Prerelocated executable");
} }
INFO_LOG(MASTER_LOG, "%i segments:", header->e_phnum); LOG_DEBUG(Loader, "%i segments:", header->e_phnum);
// First pass : Get the bits into RAM // First pass : Get the bits into RAM
u32 segment_addr[32]; u32 segment_addr[32];
@ -273,17 +273,17 @@ bool ElfReader::LoadInto(u32 vaddr) {
for (int i = 0; i < header->e_phnum; i++) { for (int i = 0; i < header->e_phnum; i++) {
Elf32_Phdr *p = segments + i; Elf32_Phdr *p = segments + i;
INFO_LOG(MASTER_LOG, "Type: %i Vaddr: %08x Filesz: %i Memsz: %i ", p->p_type, p->p_vaddr, LOG_DEBUG(Loader, "Type: %i Vaddr: %08x Filesz: %i Memsz: %i ", p->p_type, p->p_vaddr,
p->p_filesz, p->p_memsz); p->p_filesz, p->p_memsz);
if (p->p_type == PT_LOAD) { if (p->p_type == PT_LOAD) {
segment_addr[i] = base_addr + p->p_vaddr; segment_addr[i] = base_addr + p->p_vaddr;
memcpy(Memory::GetPointer(segment_addr[i]), GetSegmentPtr(i), p->p_filesz); memcpy(Memory::GetPointer(segment_addr[i]), GetSegmentPtr(i), p->p_filesz);
INFO_LOG(MASTER_LOG, "Loadable Segment Copied to %08x, size %08x", segment_addr[i], LOG_DEBUG(Loader, "Loadable Segment Copied to %08x, size %08x", segment_addr[i],
p->p_memsz); p->p_memsz);
} }
} }
INFO_LOG(MASTER_LOG, "Done loading."); LOG_DEBUG(Loader, "Done loading.");
return true; return true;
} }
@ -346,7 +346,7 @@ AppLoader_ELF::~AppLoader_ELF() {
* @return True on success, otherwise false * @return True on success, otherwise false
*/ */
ResultStatus AppLoader_ELF::Load() { ResultStatus AppLoader_ELF::Load() {
INFO_LOG(LOADER, "Loading ELF file %s...", filename.c_str()); LOG_INFO(Loader, "Loading ELF file %s...", filename.c_str());
if (is_loaded) if (is_loaded)
return ResultStatus::ErrorAlreadyLoaded; return ResultStatus::ErrorAlreadyLoaded;

View File

@ -23,7 +23,7 @@ namespace Loader {
*/ */
FileType IdentifyFile(const std::string &filename) { FileType IdentifyFile(const std::string &filename) {
if (filename.size() == 0) { if (filename.size() == 0) {
ERROR_LOG(LOADER, "invalid filename %s", filename.c_str()); LOG_ERROR(Loader, "invalid filename %s", filename.c_str());
return FileType::Error; return FileType::Error;
} }
@ -55,7 +55,7 @@ FileType IdentifyFile(const std::string &filename) {
* @return ResultStatus result of function * @return ResultStatus result of function
*/ */
ResultStatus LoadFile(const std::string& filename) { ResultStatus LoadFile(const std::string& filename) {
INFO_LOG(LOADER, "Loading file %s...", filename.c_str()); LOG_INFO(Loader, "Loading file %s...", filename.c_str());
switch (IdentifyFile(filename)) { switch (IdentifyFile(filename)) {
@ -83,7 +83,7 @@ ResultStatus LoadFile(const std::string& filename) {
// Raw BIN file format... // Raw BIN file format...
case FileType::BIN: case FileType::BIN:
{ {
INFO_LOG(LOADER, "Loading BIN file %s...", filename.c_str()); LOG_INFO(Loader, "Loading BIN file %s...", filename.c_str());
FileUtil::IOFile file(filename, "rb"); FileUtil::IOFile file(filename, "rb");

View File

@ -140,13 +140,13 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>&
// Iterate through the ExeFs archive until we find the .code file... // Iterate through the ExeFs archive until we find the .code file...
FileUtil::IOFile file(filename, "rb"); FileUtil::IOFile file(filename, "rb");
if (file.IsOpen()) { if (file.IsOpen()) {
LOG_DEBUG(Loader, "%d sections:", kMaxSections);
for (int i = 0; i < kMaxSections; i++) { for (int i = 0; i < kMaxSections; i++) {
// Load the specified section... // Load the specified section...
if (strcmp((const char*)exefs_header.section[i].name, name) == 0) { if (strcmp((const char*)exefs_header.section[i].name, name) == 0) {
INFO_LOG(LOADER, "ExeFS section %d:", i); LOG_DEBUG(Loader, "%d - offset: 0x%08X, size: 0x%08X, name: %s", i,
INFO_LOG(LOADER, " name: %s", exefs_header.section[i].name); exefs_header.section[i].offset, exefs_header.section[i].size,
INFO_LOG(LOADER, " offset: 0x%08X", exefs_header.section[i].offset); exefs_header.section[i].name);
INFO_LOG(LOADER, " size: 0x%08X", exefs_header.section[i].size);
s64 section_offset = (exefs_header.section[i].offset + exefs_offset + s64 section_offset = (exefs_header.section[i].offset + exefs_offset +
sizeof(ExeFs_Header)+ncch_offset); sizeof(ExeFs_Header)+ncch_offset);
@ -181,7 +181,7 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>&
} }
} }
} else { } else {
ERROR_LOG(LOADER, "Unable to read file %s!", filename.c_str()); LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str());
return ResultStatus::Error; return ResultStatus::Error;
} }
return ResultStatus::ErrorNotUsed; return ResultStatus::ErrorNotUsed;
@ -194,7 +194,7 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>&
* @return True on success, otherwise false * @return True on success, otherwise false
*/ */
ResultStatus AppLoader_NCCH::Load() { ResultStatus AppLoader_NCCH::Load() {
INFO_LOG(LOADER, "Loading NCCH file %s...", filename.c_str()); LOG_INFO(Loader, "Loading NCCH file %s...", filename.c_str());
if (is_loaded) if (is_loaded)
return ResultStatus::ErrorAlreadyLoaded; return ResultStatus::ErrorAlreadyLoaded;
@ -205,7 +205,7 @@ ResultStatus AppLoader_NCCH::Load() {
// Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)... // Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)...
if (0 == memcmp(&ncch_header.magic, "NCSD", 4)) { if (0 == memcmp(&ncch_header.magic, "NCSD", 4)) {
WARN_LOG(LOADER, "Only loading the first (bootable) NCCH within the NCSD file!"); LOG_WARNING(Loader, "Only loading the first (bootable) NCCH within the NCSD file!");
ncch_offset = 0x4000; ncch_offset = 0x4000;
file.Seek(ncch_offset, 0); file.Seek(ncch_offset, 0);
file.ReadBytes(&ncch_header, sizeof(NCCH_Header)); file.ReadBytes(&ncch_header, sizeof(NCCH_Header));
@ -222,17 +222,17 @@ ResultStatus AppLoader_NCCH::Load() {
is_compressed = (exheader_header.codeset_info.flags.flag & 1) == 1; is_compressed = (exheader_header.codeset_info.flags.flag & 1) == 1;
entry_point = exheader_header.codeset_info.text.address; entry_point = exheader_header.codeset_info.text.address;
INFO_LOG(LOADER, "Name: %s", exheader_header.codeset_info.name); LOG_INFO(Loader, "Name: %s", exheader_header.codeset_info.name);
INFO_LOG(LOADER, "Code compressed: %s", is_compressed ? "yes" : "no"); LOG_DEBUG(Loader, "Code compressed: %s", is_compressed ? "yes" : "no");
INFO_LOG(LOADER, "Entry point: 0x%08X", entry_point); LOG_DEBUG(Loader, "Entry point: 0x%08X", entry_point);
// Read ExeFS... // Read ExeFS...
exefs_offset = ncch_header.exefs_offset * kBlockSize; exefs_offset = ncch_header.exefs_offset * kBlockSize;
u32 exefs_size = ncch_header.exefs_size * kBlockSize; u32 exefs_size = ncch_header.exefs_size * kBlockSize;
INFO_LOG(LOADER, "ExeFS offset: 0x%08X", exefs_offset); LOG_DEBUG(Loader, "ExeFS offset: 0x%08X", exefs_offset);
INFO_LOG(LOADER, "ExeFS size: 0x%08X", exefs_size); LOG_DEBUG(Loader, "ExeFS size: 0x%08X", exefs_size);
file.Seek(exefs_offset + ncch_offset, 0); file.Seek(exefs_offset + ncch_offset, 0);
file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)); file.ReadBytes(&exefs_header, sizeof(ExeFs_Header));
@ -243,7 +243,7 @@ ResultStatus AppLoader_NCCH::Load() {
return ResultStatus::Success; return ResultStatus::Success;
} else { } else {
ERROR_LOG(LOADER, "Unable to read file %s!", filename.c_str()); LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str());
} }
return ResultStatus::Error; return ResultStatus::Error;
} }
@ -297,8 +297,8 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector<u8>& buffer) const {
u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000; u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000;
u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000; u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000;
INFO_LOG(LOADER, "RomFS offset: 0x%08X", romfs_offset); LOG_DEBUG(Loader, "RomFS offset: 0x%08X", romfs_offset);
INFO_LOG(LOADER, "RomFS size: 0x%08X", romfs_size); LOG_DEBUG(Loader, "RomFS size: 0x%08X", romfs_size);
buffer.resize(romfs_size); buffer.resize(romfs_size);
@ -307,10 +307,10 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector<u8>& buffer) const {
return ResultStatus::Success; return ResultStatus::Success;
} }
NOTICE_LOG(LOADER, "RomFS unused"); LOG_DEBUG(Loader, "NCCH has no RomFS");
return ResultStatus::ErrorNotUsed; return ResultStatus::ErrorNotUsed;
} else { } else {
ERROR_LOG(LOADER, "Unable to read file %s!", filename.c_str()); LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str());
} }
return ResultStatus::Error; return ResultStatus::Error;
} }

View File

@ -71,7 +71,7 @@ void Init() {
g_base = MemoryMap_Setup(g_views, kNumMemViews, flags, &arena); g_base = MemoryMap_Setup(g_views, kNumMemViews, flags, &arena);
NOTICE_LOG(MEMMAP, "initialized OK, RAM at %p (mirror at 0 @ %p)", g_heap, LOG_DEBUG(HW_Memory, "initialized OK, RAM at %p (mirror at 0 @ %p)", g_heap,
physical_fcram); physical_fcram);
} }
@ -82,7 +82,7 @@ void Shutdown() {
arena.ReleaseSpace(); arena.ReleaseSpace();
g_base = nullptr; g_base = nullptr;
NOTICE_LOG(MEMMAP, "shutdown OK"); LOG_DEBUG(HW_Memory, "shutdown OK");
} }
} // namespace } // namespace

View File

@ -28,7 +28,7 @@ VAddr PhysicalToVirtualAddress(const PAddr addr) {
return addr - FCRAM_PADDR + FCRAM_VADDR; return addr - FCRAM_PADDR + FCRAM_VADDR;
} }
ERROR_LOG(MEMMAP, "Unknown physical address @ 0x%08x", addr); LOG_ERROR(HW_Memory, "Unknown physical address @ 0x%08x", addr);
return addr; return addr;
} }
@ -44,7 +44,7 @@ PAddr VirtualToPhysicalAddress(const VAddr addr) {
return addr - FCRAM_VADDR + FCRAM_PADDR; return addr - FCRAM_VADDR + FCRAM_PADDR;
} }
ERROR_LOG(MEMMAP, "Unknown virtual address @ 0x%08x", addr); LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08x", addr);
return addr; return addr;
} }
@ -92,7 +92,7 @@ inline void Read(T &var, const VAddr vaddr) {
var = *((const T*)&g_vram[vaddr - VRAM_VADDR]); var = *((const T*)&g_vram[vaddr - VRAM_VADDR]);
} else { } else {
ERROR_LOG(MEMMAP, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, vaddr); LOG_ERROR(HW_Memory, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, vaddr);
} }
} }
@ -141,7 +141,7 @@ inline void Write(const VAddr vaddr, const T data) {
// Error out... // Error out...
} else { } else {
ERROR_LOG(MEMMAP, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, vaddr); LOG_ERROR(HW_Memory, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, vaddr);
} }
} }
@ -175,7 +175,7 @@ u8 *GetPointer(const VAddr vaddr) {
return g_vram + (vaddr - VRAM_VADDR); return g_vram + (vaddr - VRAM_VADDR);
} else { } else {
ERROR_LOG(MEMMAP, "unknown GetPointer @ 0x%08x", vaddr); LOG_ERROR(HW_Memory, "unknown GetPointer @ 0x%08x", vaddr);
return 0; return 0;
} }
} }
@ -239,7 +239,7 @@ u16 Read16(const VAddr addr) {
// Check for 16-bit unaligned memory reads... // Check for 16-bit unaligned memory reads...
if (addr & 1) { if (addr & 1) {
// TODO(bunnei): Implement 16-bit unaligned memory reads // TODO(bunnei): Implement 16-bit unaligned memory reads
ERROR_LOG(MEMMAP, "16-bit unaligned memory reads are not implemented!"); LOG_ERROR(HW_Memory, "16-bit unaligned memory reads are not implemented!");
} }
return (u16)data; return (u16)data;

View File

@ -157,7 +157,7 @@ void ProcessTriangle(OutputVertex &v0, OutputVertex &v1, OutputVertex &v2) {
InitScreenCoordinates(vtx2); InitScreenCoordinates(vtx2);
DEBUG_LOG(GPU, LOG_TRACE(Render_Software,
"Triangle %lu/%lu (%lu buffer vertices) at position (%.3f, %.3f, %.3f, %.3f), " "Triangle %lu/%lu (%lu buffer vertices) at position (%.3f, %.3f, %.3f, %.3f), "
"(%.3f, %.3f, %.3f, %.3f), (%.3f, %.3f, %.3f, %.3f) and " "(%.3f, %.3f, %.3f, %.3f), (%.3f, %.3f, %.3f, %.3f) and "
"screen position (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)", "screen position (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)",

View File

@ -114,7 +114,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
(vertex_attribute_formats[i] == 2) ? *(s16*)srcdata : (vertex_attribute_formats[i] == 2) ? *(s16*)srcdata :
*(float*)srcdata; *(float*)srcdata;
input.attr[i][comp] = float24::FromFloat32(srcval); input.attr[i][comp] = float24::FromFloat32(srcval);
DEBUG_LOG(GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08lx + 0x%04lx: %f", LOG_TRACE(HW_GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08lx + 0x%04lx: %f",
comp, i, vertex, index, comp, i, vertex, index,
attribute_config.GetBaseAddress(), attribute_config.GetBaseAddress(),
vertex_attribute_sources[i] - base_address, vertex_attribute_sources[i] - base_address,
@ -176,7 +176,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
auto& uniform = VertexShader::GetFloatUniform(uniform_setup.index); auto& uniform = VertexShader::GetFloatUniform(uniform_setup.index);
if (uniform_setup.index > 95) { if (uniform_setup.index > 95) {
ERROR_LOG(GPU, "Invalid VS uniform index %d", (int)uniform_setup.index); LOG_ERROR(HW_GPU, "Invalid VS uniform index %d", (int)uniform_setup.index);
break; break;
} }
@ -192,7 +192,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
uniform.x = float24::FromRawFloat24(uniform_write_buffer[2] & 0xFFFFFF); uniform.x = float24::FromRawFloat24(uniform_write_buffer[2] & 0xFFFFFF);
} }
DEBUG_LOG(GPU, "Set uniform %x to (%f %f %f %f)", (int)uniform_setup.index, LOG_TRACE(HW_GPU, "Set uniform %x to (%f %f %f %f)", (int)uniform_setup.index,
uniform.x.ToFloat32(), uniform.y.ToFloat32(), uniform.z.ToFloat32(), uniform.x.ToFloat32(), uniform.y.ToFloat32(), uniform.z.ToFloat32(),
uniform.w.ToFloat32()); uniform.w.ToFloat32());

View File

@ -248,8 +248,8 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data
it->component_mask = it->component_mask | component_mask; it->component_mask = it->component_mask | component_mask;
} }
} catch (const std::out_of_range& ) { } catch (const std::out_of_range& ) {
_dbg_assert_msg_(GPU, 0, "Unknown output attribute mapping"); _dbg_assert_msg_(HW_GPU, 0, "Unknown output attribute mapping");
ERROR_LOG(GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x", LOG_ERROR(HW_GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x",
(int)output_attributes[i].map_x.Value(), (int)output_attributes[i].map_x.Value(),
(int)output_attributes[i].map_y.Value(), (int)output_attributes[i].map_y.Value(),
(int)output_attributes[i].map_z.Value(), (int)output_attributes[i].map_z.Value(),
@ -309,7 +309,7 @@ static int is_pica_tracing = false;
void StartPicaTracing() void StartPicaTracing()
{ {
if (is_pica_tracing) { if (is_pica_tracing) {
ERROR_LOG(GPU, "StartPicaTracing called even though tracing already running!"); LOG_WARNING(HW_GPU, "StartPicaTracing called even though tracing already running!");
return; return;
} }
@ -342,7 +342,7 @@ void OnPicaRegWrite(u32 id, u32 value)
std::unique_ptr<PicaTrace> FinishPicaTracing() std::unique_ptr<PicaTrace> FinishPicaTracing()
{ {
if (!is_pica_tracing) { if (!is_pica_tracing) {
ERROR_LOG(GPU, "FinishPicaTracing called even though tracing already running!"); LOG_WARNING(HW_GPU, "FinishPicaTracing called even though tracing isn't running!");
return {}; return {};
} }
@ -357,7 +357,7 @@ std::unique_ptr<PicaTrace> FinishPicaTracing()
} }
const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info) { const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info) {
_dbg_assert_(GPU, info.format == Pica::Regs::TextureFormat::RGB8); _dbg_assert_(Debug_GPU, info.format == Pica::Regs::TextureFormat::RGB8);
// Cf. rasterizer code for an explanation of this algorithm. // Cf. rasterizer code for an explanation of this algorithm.
int texel_index_within_tile = 0; int texel_index_within_tile = 0;
@ -421,7 +421,7 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {
// Initialize write structure // Initialize write structure
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (png_ptr == nullptr) { if (png_ptr == nullptr) {
ERROR_LOG(GPU, "Could not allocate write struct\n"); LOG_ERROR(Debug_GPU, "Could not allocate write struct\n");
goto finalise; goto finalise;
} }
@ -429,13 +429,13 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {
// Initialize info structure // Initialize info structure
info_ptr = png_create_info_struct(png_ptr); info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == nullptr) { if (info_ptr == nullptr) {
ERROR_LOG(GPU, "Could not allocate info struct\n"); LOG_ERROR(Debug_GPU, "Could not allocate info struct\n");
goto finalise; goto finalise;
} }
// Setup Exception handling // Setup Exception handling
if (setjmp(png_jmpbuf(png_ptr))) { if (setjmp(png_jmpbuf(png_ptr))) {
ERROR_LOG(GPU, "Error during png creation\n"); LOG_ERROR(Debug_GPU, "Error during png creation\n");
goto finalise; goto finalise;
} }
@ -582,7 +582,7 @@ void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages)
stage_info += "Stage " + std::to_string(index) + ": " + GetColorCombinerStr(tev_stage) + " " + GetAlphaCombinerStr(tev_stage) + "\n"; stage_info += "Stage " + std::to_string(index) + ": " + GetColorCombinerStr(tev_stage) + " " + GetAlphaCombinerStr(tev_stage) + "\n";
} }
DEBUG_LOG(GPU, "%s", stage_info.c_str()); LOG_TRACE(HW_GPU, "%s", stage_info.c_str());
} }
} // namespace } // namespace

View File

@ -39,7 +39,7 @@ public:
virtual void GXCommandProcessed(int total_command_count) virtual void GXCommandProcessed(int total_command_count)
{ {
const GSP_GPU::Command& cmd = observed->ReadGXCommandHistory(total_command_count-1); const GSP_GPU::Command& cmd = observed->ReadGXCommandHistory(total_command_count-1);
ERROR_LOG(GSP, "Received command: id=%x", (int)cmd.id.Value()); LOG_TRACE(Debug_GPU, "Received command: id=%x", (int)cmd.id.Value());
} }
protected: protected:

View File

@ -43,7 +43,7 @@ void PrimitiveAssembler<VertexType>::SubmitVertex(VertexType& vtx, TriangleHandl
break; break;
default: default:
ERROR_LOG(GPU, "Unknown triangle topology %x:", (int)topology); LOG_ERROR(Render_Software, "Unknown triangle topology %x:", (int)topology);
break; break;
} }
} }

View File

@ -252,7 +252,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
return combiner_output.rgb(); return combiner_output.rgb();
default: default:
ERROR_LOG(GPU, "Unknown color combiner source %d\n", (int)source); LOG_ERROR(HW_GPU, "Unknown color combiner source %d\n", (int)source);
return {}; return {};
} }
}; };
@ -272,7 +272,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
return combiner_output.a(); return combiner_output.a();
default: default:
ERROR_LOG(GPU, "Unknown alpha combiner source %d\n", (int)source); LOG_ERROR(HW_GPU, "Unknown alpha combiner source %d\n", (int)source);
return 0; return 0;
} }
}; };
@ -283,7 +283,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
case ColorModifier::SourceColor: case ColorModifier::SourceColor:
return values; return values;
default: default:
ERROR_LOG(GPU, "Unknown color factor %d\n", (int)factor); LOG_ERROR(HW_GPU, "Unknown color factor %d\n", (int)factor);
return {}; return {};
} }
}; };
@ -293,7 +293,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
case AlphaModifier::SourceAlpha: case AlphaModifier::SourceAlpha:
return value; return value;
default: default:
ERROR_LOG(GPU, "Unknown color factor %d\n", (int)factor); LOG_ERROR(HW_GPU, "Unknown color factor %d\n", (int)factor);
return 0; return 0;
} }
}; };
@ -307,7 +307,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
return ((input[0] * input[1]) / 255).Cast<u8>(); return ((input[0] * input[1]) / 255).Cast<u8>();
default: default:
ERROR_LOG(GPU, "Unknown color combiner operation %d\n", (int)op); LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op);
return {}; return {};
} }
}; };
@ -321,7 +321,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
return input[0] * input[1] / 255; return input[0] * input[1] / 255;
default: default:
ERROR_LOG(GPU, "Unknown alpha combiner operation %d\n", (int)op); LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op);
return 0; return 0;
} }
}; };

View File

@ -20,7 +20,7 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
int info_log_length; int info_log_length;
// Compile Vertex Shader // Compile Vertex Shader
DEBUG_LOG(GPU, "Compiling vertex shader."); LOG_DEBUG(Render_OpenGL, "Compiling vertex shader...");
glShaderSource(vertex_shader_id, 1, &vertex_shader, nullptr); glShaderSource(vertex_shader_id, 1, &vertex_shader, nullptr);
glCompileShader(vertex_shader_id); glCompileShader(vertex_shader_id);
@ -32,11 +32,15 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) { if (info_log_length > 1) {
std::vector<char> vertex_shader_error(info_log_length); std::vector<char> vertex_shader_error(info_log_length);
glGetShaderInfoLog(vertex_shader_id, info_log_length, nullptr, &vertex_shader_error[0]); glGetShaderInfoLog(vertex_shader_id, info_log_length, nullptr, &vertex_shader_error[0]);
DEBUG_LOG(GPU, "%s", &vertex_shader_error[0]); if (result) {
LOG_DEBUG(Render_OpenGL, "%s", &vertex_shader_error[0]);
} else {
LOG_ERROR(Render_OpenGL, "Error compiling vertex shader:\n%s", &vertex_shader_error[0]);
}
} }
// Compile Fragment Shader // Compile Fragment Shader
DEBUG_LOG(GPU, "Compiling fragment shader."); LOG_DEBUG(Render_OpenGL, "Compiling fragment shader...");
glShaderSource(fragment_shader_id, 1, &fragment_shader, nullptr); glShaderSource(fragment_shader_id, 1, &fragment_shader, nullptr);
glCompileShader(fragment_shader_id); glCompileShader(fragment_shader_id);
@ -48,11 +52,15 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) { if (info_log_length > 1) {
std::vector<char> fragment_shader_error(info_log_length); std::vector<char> fragment_shader_error(info_log_length);
glGetShaderInfoLog(fragment_shader_id, info_log_length, nullptr, &fragment_shader_error[0]); glGetShaderInfoLog(fragment_shader_id, info_log_length, nullptr, &fragment_shader_error[0]);
DEBUG_LOG(GPU, "%s", &fragment_shader_error[0]); if (result) {
LOG_DEBUG(Render_OpenGL, "%s", &fragment_shader_error[0]);
} else {
LOG_ERROR(Render_OpenGL, "Error compiling fragment shader:\n%s", &fragment_shader_error[0]);
}
} }
// Link the program // Link the program
DEBUG_LOG(GPU, "Linking program."); LOG_DEBUG(Render_OpenGL, "Linking program...");
GLuint program_id = glCreateProgram(); GLuint program_id = glCreateProgram();
glAttachShader(program_id, vertex_shader_id); glAttachShader(program_id, vertex_shader_id);
@ -66,7 +74,11 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) { if (info_log_length > 1) {
std::vector<char> program_error(info_log_length); std::vector<char> program_error(info_log_length);
glGetProgramInfoLog(program_id, info_log_length, nullptr, &program_error[0]); glGetProgramInfoLog(program_id, info_log_length, nullptr, &program_error[0]);
DEBUG_LOG(GPU, "%s", &program_error[0]); if (result) {
LOG_DEBUG(Render_OpenGL, "%s", &program_error[0]);
} else {
LOG_ERROR(Render_OpenGL, "Error linking shader:\n%s", &program_error[0]);
}
} }
glDeleteShader(vertex_shader_id); glDeleteShader(vertex_shader_id);

View File

@ -90,7 +90,7 @@ void RendererOpenGL::LoadFBToActiveGLTexture(const GPU::Regs::FramebufferConfig&
const VAddr framebuffer_vaddr = Memory::PhysicalToVirtualAddress( const VAddr framebuffer_vaddr = Memory::PhysicalToVirtualAddress(
framebuffer.active_fb == 1 ? framebuffer.address_left2 : framebuffer.address_left1); framebuffer.active_fb == 1 ? framebuffer.address_left2 : framebuffer.address_left1);
DEBUG_LOG(GPU, "0x%08x bytes from 0x%08x(%dx%d), fmt %x", LOG_TRACE(Render_OpenGL, "0x%08x bytes from 0x%08x(%dx%d), fmt %x",
framebuffer.stride * framebuffer.height, framebuffer.stride * framebuffer.height,
framebuffer_vaddr, (int)framebuffer.width, framebuffer_vaddr, (int)framebuffer.width,
(int)framebuffer.height, (int)framebuffer.format); (int)framebuffer.height, (int)framebuffer.format);
@ -98,15 +98,15 @@ void RendererOpenGL::LoadFBToActiveGLTexture(const GPU::Regs::FramebufferConfig&
const u8* framebuffer_data = Memory::GetPointer(framebuffer_vaddr); const u8* framebuffer_data = Memory::GetPointer(framebuffer_vaddr);
// TODO: Handle other pixel formats // TODO: Handle other pixel formats
_dbg_assert_msg_(RENDER, framebuffer.color_format == GPU::Regs::PixelFormat::RGB8, _dbg_assert_msg_(Render_OpenGL, framebuffer.color_format == GPU::Regs::PixelFormat::RGB8,
"Unsupported 3DS pixel format."); "Unsupported 3DS pixel format.");
size_t pixel_stride = framebuffer.stride / 3; size_t pixel_stride = framebuffer.stride / 3;
// OpenGL only supports specifying a stride in units of pixels, not bytes, unfortunately // OpenGL only supports specifying a stride in units of pixels, not bytes, unfortunately
_dbg_assert_(RENDER, pixel_stride * 3 == framebuffer.stride); _dbg_assert_(Render_OpenGL, pixel_stride * 3 == framebuffer.stride);
// Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default
// only allows rows to have a memory alignement of 4. // only allows rows to have a memory alignement of 4.
_dbg_assert_(RENDER, pixel_stride % 4 == 0); _dbg_assert_(Render_OpenGL, pixel_stride % 4 == 0);
glBindTexture(GL_TEXTURE_2D, texture.handle); glBindTexture(GL_TEXTURE_2D, texture.handle);
glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint)pixel_stride); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint)pixel_stride);
@ -263,11 +263,11 @@ void RendererOpenGL::Init() {
int err = ogl_LoadFunctions(); int err = ogl_LoadFunctions();
if (ogl_LOAD_SUCCEEDED != err) { if (ogl_LOAD_SUCCEEDED != err) {
ERROR_LOG(RENDER, "Failed to initialize GL functions! Exiting..."); LOG_CRITICAL(Render_OpenGL, "Failed to initialize GL functions! Exiting...");
exit(-1); exit(-1);
} }
NOTICE_LOG(RENDER, "GL_VERSION: %s\n", glGetString(GL_VERSION)); LOG_INFO(Render_OpenGL, "GL_VERSION: %s", glGetString(GL_VERSION));
InitOpenGLObjects(); InitOpenGLObjects();
} }

View File

@ -206,7 +206,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
case Instruction::OpCode::CALL: case Instruction::OpCode::CALL:
increment_pc = false; increment_pc = false;
_dbg_assert_(GPU, state.call_stack_pointer - state.call_stack < sizeof(state.call_stack)); _dbg_assert_(HW_GPU, state.call_stack_pointer - state.call_stack < sizeof(state.call_stack));
*++state.call_stack_pointer = state.program_counter - shader_memory; *++state.call_stack_pointer = state.program_counter - shader_memory;
// TODO: Does this offset refer to the beginning of shader memory? // TODO: Does this offset refer to the beginning of shader memory?
@ -218,7 +218,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
break; break;
default: default:
ERROR_LOG(GPU, "Unhandled instruction: 0x%02x (%s): 0x%08x", LOG_ERROR(HW_GPU, "Unhandled instruction: 0x%02x (%s): 0x%08x",
(int)instr.opcode.Value(), instr.GetOpCodeName().c_str(), instr.hex); (int)instr.opcode.Value(), instr.GetOpCodeName().c_str(), instr.hex);
break; break;
} }
@ -285,7 +285,7 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes)
state.debug.max_opdesc_id, registers.vs_main_offset, state.debug.max_opdesc_id, registers.vs_main_offset,
registers.vs_output_attributes); registers.vs_output_attributes);
DEBUG_LOG(GPU, "Output vertex: pos (%.2f, %.2f, %.2f, %.2f), col(%.2f, %.2f, %.2f, %.2f), tc0(%.2f, %.2f)", LOG_TRACE(Render_Software, "Output vertex: pos (%.2f, %.2f, %.2f, %.2f), col(%.2f, %.2f, %.2f, %.2f), tc0(%.2f, %.2f)",
ret.pos.x.ToFloat32(), ret.pos.y.ToFloat32(), ret.pos.z.ToFloat32(), ret.pos.w.ToFloat32(), ret.pos.x.ToFloat32(), ret.pos.y.ToFloat32(), ret.pos.z.ToFloat32(), ret.pos.w.ToFloat32(),
ret.color.x.ToFloat32(), ret.color.y.ToFloat32(), ret.color.z.ToFloat32(), ret.color.w.ToFloat32(), ret.color.x.ToFloat32(), ret.color.y.ToFloat32(), ret.color.z.ToFloat32(), ret.color.w.ToFloat32(),
ret.tc0.u().ToFloat32(), ret.tc0.v().ToFloat32()); ret.tc0.u().ToFloat32(), ret.tc0.v().ToFloat32());

View File

@ -30,13 +30,13 @@ void Init(EmuWindow* emu_window) {
g_current_frame = 0; g_current_frame = 0;
NOTICE_LOG(VIDEO, "initialized OK"); LOG_DEBUG(Render, "initialized OK");
} }
/// Shutdown the video core /// Shutdown the video core
void Shutdown() { void Shutdown() {
delete g_renderer; delete g_renderer;
NOTICE_LOG(VIDEO, "shutdown OK"); LOG_DEBUG(Render, "shutdown OK");
} }
} // namespace } // namespace