mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-19 17:35:06 -04:00
kern: avoid constexpr init for many objects (avoids unnecessary memory clear) (#1668)
This commit is contained in:
parent
20716cb3de
commit
36e4914be8
77 changed files with 489 additions and 339 deletions
|
@ -195,9 +195,11 @@ namespace ams::kern::KDumpObject {
|
|||
char name[9] = {};
|
||||
{
|
||||
/* Find the client port process. */
|
||||
KScopedAutoObject<KProcess> client_port_process;
|
||||
KProcess *client_port_process = nullptr;
|
||||
ON_SCOPE_EXIT { if (client_port_process != nullptr) { client_port_process->Close(); } };
|
||||
|
||||
{
|
||||
for (auto it = accessor.begin(); it != end && client_port_process.IsNull(); ++it) {
|
||||
for (auto it = accessor.begin(); it != end && client_port_process == nullptr; ++it) {
|
||||
KProcess *cur = static_cast<KProcess *>(std::addressof(*it));
|
||||
for (size_t j = 0; j < cur->GetHandleTable().GetTableSize(); ++j) {
|
||||
ams::svc::Handle cur_h = ams::svc::InvalidHandle;
|
||||
|
@ -205,6 +207,7 @@ namespace ams::kern::KDumpObject {
|
|||
if (cur_o.IsNotNull()) {
|
||||
if (cur_o.GetPointerUnsafe() == client) {
|
||||
client_port_process = cur;
|
||||
client_port_process->Open();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +216,7 @@ namespace ams::kern::KDumpObject {
|
|||
}
|
||||
|
||||
/* Read the port name. */
|
||||
if (client_port_process.IsNotNull()) {
|
||||
if (client_port_process != nullptr) {
|
||||
if (R_FAILED(client_port_process->GetPageTable().CopyMemoryFromLinearToKernel(KProcessAddress(name), 8, port_name, KMemoryState_None, KMemoryState_None, KMemoryPermission_UserRead, KMemoryAttribute_None, KMemoryAttribute_None))) {
|
||||
std::memset(name, 0, sizeof(name));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue