forked from ShuriZma/suyu
hle: kernel: k_page_table: Rename *ProcessCodeMemory -> *CodeMemory.
This commit is contained in:
parent
599c0763e5
commit
081669c334
|
@ -298,7 +298,7 @@ ResultCode KPageTable::MapProcessCode(VAddr addr, std::size_t num_pages, KMemory
|
|||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode KPageTable::MapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) {
|
||||
ResultCode KPageTable::MapCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) {
|
||||
std::lock_guard lock{page_table_lock};
|
||||
|
||||
const std::size_t num_pages{size / PageSize};
|
||||
|
@ -335,7 +335,7 @@ ResultCode KPageTable::MapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std:
|
|||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode KPageTable::UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) {
|
||||
ResultCode KPageTable::UnmapCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) {
|
||||
std::lock_guard lock{page_table_lock};
|
||||
|
||||
if (!size) {
|
||||
|
|
|
@ -31,8 +31,8 @@ public:
|
|||
KMemoryManager::Pool pool);
|
||||
ResultCode MapProcessCode(VAddr addr, std::size_t pages_count, KMemoryState state,
|
||||
KMemoryPermission perm);
|
||||
ResultCode MapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size);
|
||||
ResultCode UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size);
|
||||
ResultCode MapCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size);
|
||||
ResultCode UnmapCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size);
|
||||
ResultCode UnmapProcessMemory(VAddr dst_addr, std::size_t size, KPageTable& src_page_table,
|
||||
VAddr src_addr);
|
||||
ResultCode MapPhysicalMemory(VAddr addr, std::size_t size);
|
||||
|
|
|
@ -1626,7 +1626,7 @@ static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_hand
|
|||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
return page_table.MapProcessCodeMemory(dst_address, src_address, size);
|
||||
return page_table.MapCodeMemory(dst_address, src_address, size);
|
||||
}
|
||||
|
||||
static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_handle,
|
||||
|
@ -1694,7 +1694,7 @@ static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_ha
|
|||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
return page_table.UnmapProcessCodeMemory(dst_address, src_address, size);
|
||||
return page_table.UnmapCodeMemory(dst_address, src_address, size);
|
||||
}
|
||||
|
||||
/// Exits the current process
|
||||
|
|
|
@ -325,7 +325,7 @@ public:
|
|||
for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) {
|
||||
auto& page_table{process->PageTable()};
|
||||
const VAddr addr{GetRandomMapRegion(page_table, size)};
|
||||
const ResultCode result{page_table.MapProcessCodeMemory(addr, baseAddress, size)};
|
||||
const ResultCode result{page_table.MapCodeMemory(addr, baseAddress, size)};
|
||||
|
||||
if (result == Kernel::ResultInvalidCurrentMemory) {
|
||||
continue;
|
||||
|
@ -351,12 +351,12 @@ public:
|
|||
|
||||
if (bss_size) {
|
||||
auto block_guard = detail::ScopeExit([&] {
|
||||
page_table.UnmapProcessCodeMemory(addr + nro_size, bss_addr, bss_size);
|
||||
page_table.UnmapProcessCodeMemory(addr, nro_addr, nro_size);
|
||||
page_table.UnmapCodeMemory(addr + nro_size, bss_addr, bss_size);
|
||||
page_table.UnmapCodeMemory(addr, nro_addr, nro_size);
|
||||
});
|
||||
|
||||
const ResultCode result{
|
||||
page_table.MapProcessCodeMemory(addr + nro_size, bss_addr, bss_size)};
|
||||
page_table.MapCodeMemory(addr + nro_size, bss_addr, bss_size)};
|
||||
|
||||
if (result == Kernel::ResultInvalidCurrentMemory) {
|
||||
continue;
|
||||
|
@ -530,16 +530,15 @@ public:
|
|||
ResultCode UnmapNro(const NROInfo& info) {
|
||||
// Each region must be unmapped separately to validate memory state
|
||||
auto& page_table{system.CurrentProcess()->PageTable()};
|
||||
CASCADE_CODE(page_table.UnmapProcessCodeMemory(info.nro_address + info.text_size +
|
||||
info.ro_size + info.data_size,
|
||||
info.bss_address, info.bss_size));
|
||||
CASCADE_CODE(page_table.UnmapProcessCodeMemory(
|
||||
info.nro_address + info.text_size + info.ro_size,
|
||||
info.src_addr + info.text_size + info.ro_size, info.data_size));
|
||||
CASCADE_CODE(page_table.UnmapProcessCodeMemory(
|
||||
info.nro_address + info.text_size, info.src_addr + info.text_size, info.ro_size));
|
||||
CASCADE_CODE(
|
||||
page_table.UnmapProcessCodeMemory(info.nro_address, info.src_addr, info.text_size));
|
||||
CASCADE_CODE(page_table.UnmapCodeMemory(info.nro_address + info.text_size + info.ro_size +
|
||||
info.data_size,
|
||||
info.bss_address, info.bss_size));
|
||||
CASCADE_CODE(page_table.UnmapCodeMemory(info.nro_address + info.text_size + info.ro_size,
|
||||
info.src_addr + info.text_size + info.ro_size,
|
||||
info.data_size));
|
||||
CASCADE_CODE(page_table.UnmapCodeMemory(info.nro_address + info.text_size,
|
||||
info.src_addr + info.text_size, info.ro_size));
|
||||
CASCADE_CODE(page_table.UnmapCodeMemory(info.nro_address, info.src_addr, info.text_size));
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue