Finish Linux x86_64 build

This commit is contained in:
2025-02-10 00:00:38 +08:00
parent bc3c5a8f9d
commit 6c60067ba7
301 changed files with 30720 additions and 1048 deletions

View File

@@ -141,10 +141,10 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
u32 size = static_cast<u32>(descInfo.size);
IPC::MappedBufferPermissions permissions = descInfo.perms;
VAddr page_start = Common::AlignDown(source_address, Memory::CITRA_PAGE_SIZE);
VAddr page_start = Common::AlignDown(source_address, Memory::LUCINA3DS_PAGE_SIZE);
u32 page_offset = source_address - page_start;
u32 num_pages = Common::AlignUp(page_offset + size, Memory::CITRA_PAGE_SIZE) >>
Memory::CITRA_PAGE_BITS;
u32 num_pages = Common::AlignUp(page_offset + size, Memory::LUCINA3DS_PAGE_SIZE) >>
Memory::LUCINA3DS_PAGE_BITS;
// Skip when the size is zero and num_pages == 0
if (size == 0) {
@@ -174,8 +174,8 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
found->target_address, size);
}
VAddr prev_reserve = page_start - Memory::CITRA_PAGE_SIZE;
VAddr next_reserve = page_start + num_pages * Memory::CITRA_PAGE_SIZE;
VAddr prev_reserve = page_start - Memory::LUCINA3DS_PAGE_SIZE;
VAddr next_reserve = page_start + num_pages * Memory::LUCINA3DS_PAGE_SIZE;
auto& prev_vma = src_process->vm_manager.FindVMA(prev_reserve)->second;
auto& next_vma = src_process->vm_manager.FindVMA(next_reserve)->second;
@@ -184,8 +184,8 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
// Unmap the buffer and guard pages from the source process
Result result =
src_process->vm_manager.UnmapRange(page_start - Memory::CITRA_PAGE_SIZE,
(num_pages + 2) * Memory::CITRA_PAGE_SIZE);
src_process->vm_manager.UnmapRange(page_start - Memory::LUCINA3DS_PAGE_SIZE,
(num_pages + 2) * Memory::LUCINA3DS_PAGE_SIZE);
ASSERT(result == ResultSuccess);
mapped_buffer_context.erase(found);
@@ -200,9 +200,9 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
// Create a buffer which contains the mapped buffer and two additional guard pages.
std::shared_ptr<BackingMem> buffer =
std::make_shared<BufferMem>((num_pages + 2) * Memory::CITRA_PAGE_SIZE);
std::make_shared<BufferMem>((num_pages + 2) * Memory::LUCINA3DS_PAGE_SIZE);
memory.ReadBlock(*src_process, source_address,
buffer->GetPtr() + Memory::CITRA_PAGE_SIZE + page_offset, size);
buffer->GetPtr() + Memory::LUCINA3DS_PAGE_SIZE + page_offset, size);
// Map the guard pages and mapped pages at once.
target_address =
@@ -215,18 +215,18 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
// Change the permissions and state of the guard pages.
const VAddr low_guard_address = target_address;
const VAddr high_guard_address =
low_guard_address + static_cast<VAddr>(buffer->GetSize()) - Memory::CITRA_PAGE_SIZE;
low_guard_address + static_cast<VAddr>(buffer->GetSize()) - Memory::LUCINA3DS_PAGE_SIZE;
ASSERT(dst_process->vm_manager.ChangeMemoryState(
low_guard_address, Memory::CITRA_PAGE_SIZE, Kernel::MemoryState::Shared,
low_guard_address, Memory::LUCINA3DS_PAGE_SIZE, Kernel::MemoryState::Shared,
Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Reserved,
Kernel::VMAPermission::None) == ResultSuccess);
ASSERT(dst_process->vm_manager.ChangeMemoryState(
high_guard_address, Memory::CITRA_PAGE_SIZE, Kernel::MemoryState::Shared,
high_guard_address, Memory::LUCINA3DS_PAGE_SIZE, Kernel::MemoryState::Shared,
Kernel::VMAPermission::ReadWrite, Kernel::MemoryState::Reserved,
Kernel::VMAPermission::None) == ResultSuccess);
// Get proper mapped buffer address and store it in the cmd buffer.
target_address += Memory::CITRA_PAGE_SIZE;
target_address += Memory::LUCINA3DS_PAGE_SIZE;
cmd_buf[i++] = target_address + page_offset;
mapped_buffer_context.push_back({permissions, size, source_address,

View File

@@ -182,7 +182,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, std::size_t len) {
// Mapped memory page
AddressMapping mapping;
mapping.address = descriptor << 12;
mapping.size = Memory::CITRA_PAGE_SIZE;
mapping.size = Memory::LUCINA3DS_PAGE_SIZE;
mapping.read_only = false;
mapping.unk_flag = false;
@@ -459,7 +459,7 @@ ResultVal<VAddr> Process::AllocateThreadLocalStorage() {
auto base_memory_region = kernel.GetMemoryRegion(MemoryRegion::BASE);
// Allocate some memory from the end of the linear heap for this region.
auto offset = base_memory_region->LinearAllocate(Memory::CITRA_PAGE_SIZE);
auto offset = base_memory_region->LinearAllocate(Memory::LUCINA3DS_PAGE_SIZE);
if (!offset) {
LOG_ERROR(Kernel_SVC,
"Not enough space in BASE linear region to allocate a new TLS page");
@@ -467,17 +467,17 @@ ResultVal<VAddr> Process::AllocateThreadLocalStorage() {
}
holding_tls_memory +=
MemoryRegionInfo::Interval(*offset, *offset + Memory::CITRA_PAGE_SIZE);
memory_used += Memory::CITRA_PAGE_SIZE;
MemoryRegionInfo::Interval(*offset, *offset + Memory::LUCINA3DS_PAGE_SIZE);
memory_used += Memory::LUCINA3DS_PAGE_SIZE;
// The page is completely available at the start.
tls_slots.emplace_back(0);
// Map the page to the current process' address space.
auto tls_page_addr =
Memory::TLS_AREA_VADDR + static_cast<VAddr>(tls_page) * Memory::CITRA_PAGE_SIZE;
Memory::TLS_AREA_VADDR + static_cast<VAddr>(tls_page) * Memory::LUCINA3DS_PAGE_SIZE;
vm_manager.MapBackingMemory(tls_page_addr, kernel.memory.GetFCRAMRef(*offset),
Memory::CITRA_PAGE_SIZE, MemoryState::Locked);
Memory::LUCINA3DS_PAGE_SIZE, MemoryState::Locked);
LOG_DEBUG(Kernel, "Allocated TLS page at addr={:08X}", tls_page_addr);
} else {
@@ -488,7 +488,7 @@ ResultVal<VAddr> Process::AllocateThreadLocalStorage() {
tls_slots[tls_page].set(tls_slot);
auto tls_address = Memory::TLS_AREA_VADDR +
static_cast<VAddr>(tls_page) * Memory::CITRA_PAGE_SIZE +
static_cast<VAddr>(tls_page) * Memory::LUCINA3DS_PAGE_SIZE +
static_cast<VAddr>(tls_slot) * Memory::TLS_ENTRY_SIZE;
kernel.memory.ZeroBlock(*this, tls_address, Memory::TLS_ENTRY_SIZE);

View File

@@ -76,11 +76,11 @@ enum class KernelState {
*/
KERNEL_STATE_REBOOT = 7,
// Special Citra only states.
// Special Lucina3DS only states.
/**
* Sets the emulation speed percentage. A value of 0 means unthrottled.
*/
KERNEL_STATE_CITRA_EMULATION_SPEED = 0x20000 ///
KERNEL_STATE_LUCINA3DS_EMULATION_SPEED = 0x20000 ///
};
struct PageInfo {
@@ -125,10 +125,10 @@ enum class SystemInfoType {
*/
NEW_3DS_INFO = 0x10001,
/**
* Gets citra related information. This parameter is not available on real systems,
* Gets lucina3ds related information. This parameter is not available on real systems,
* but can be used by homebrew applications to get some emulator info.
*/
CITRA_INFORMATION = 0x20000,
LUCINA3DS_INFORMATION = 0x20000,
};
enum class ProcessInfoType {
@@ -272,15 +272,15 @@ enum class SystemInfoMemUsageRegion {
/**
* Accepted by svcGetSystemInfo param with CITRA_INFORMATION type. Selects which information
* to fetch from Citra. Some string params don't fit in 7 bytes, so they are split.
* to fetch from Lucina3DS. Some string params don't fit in 7 bytes, so they are split.
*/
enum class SystemInfoCitraInformation {
IS_CITRA = 0, // Always set the output to 1, signaling the app is running on Citra.
enum class SystemInfoLucina3DSInformation {
IS_LUCINA3DS = 0, // Always set the output to 1, signaling the app is running on Lucina3DS.
HOST_TICK = 1, // Tick reference from the host in ns, unaffected by lag or cpu speed.
EMULATION_SPEED = 2, // Gets the emulation speed set by the user or by KernelSetState.
BUILD_NAME = 10, // (ie: Nightly, Canary).
BUILD_VERSION = 11, // Build version.
BUILD_PLATFORM = 12, // Build platform, see SystemInfoCitraPlatform.
BUILD_PLATFORM = 12, // Build platform, see SystemInfoLucina3DSPlatform.
BUILD_DATE_PART1 = 20, // Build date first 7 characters.
BUILD_DATE_PART2 = 21, // Build date next 7 characters.
BUILD_DATE_PART3 = 22, // Build date next 7 characters.
@@ -294,12 +294,12 @@ enum class SystemInfoCitraInformation {
/**
* Current officially supported platforms.
*/
enum class SystemInfoCitraPlatform {
enum class SystemInfoLucina3DSPlatform {
PLATFORM_UNKNOWN = 0,
PLATFORM_WINDOWS = 1,
PLATFORM_LINUX = 2,
PLATFORM_APPLE = 3,
PLATFORM_ANDROID = 4,
PLATFORM_ANDROID = 3,
PLATFORM_APPLE = 4,
};
/**
@@ -495,9 +495,9 @@ Result SVC::ControlMemory(u32* out_addr, u32 addr0, u32 addr1, u32 size, u32 ope
"size=0x{:X}, permissions=0x{:08X}",
operation, addr0, addr1, size, permissions);
R_UNLESS((addr0 & Memory::CITRA_PAGE_MASK) == 0, ResultMisalignedAddress);
R_UNLESS((addr1 & Memory::CITRA_PAGE_MASK) == 0, ResultMisalignedAddress);
R_UNLESS((size & Memory::CITRA_PAGE_MASK) == 0, ResultMisalignedSize);
R_UNLESS((addr0 & Memory::LUCINA3DS_PAGE_MASK) == 0, ResultMisalignedAddress);
R_UNLESS((addr1 & Memory::LUCINA3DS_PAGE_MASK) == 0, ResultMisalignedAddress);
R_UNLESS((size & Memory::LUCINA3DS_PAGE_MASK) == 0, ResultMisalignedSize);
const u32 region = operation & MEMOP_REGION_MASK;
operation &= ~MEMOP_REGION_MASK;
@@ -1440,8 +1440,8 @@ Result SVC::KernelSetState(u32 kernel_state, u32 varg1, u32 varg2) {
system.RequestShutdown();
break;
// Citra specific states.
case KernelState::KERNEL_STATE_CITRA_EMULATION_SPEED: {
// Lucina3DS specific states.
case KernelState::KERNEL_STATE_LUCINA3DS_EMULATION_SPEED: {
u16 new_value = static_cast<u16>(varg1);
Settings::values.frame_limit.SetValue(new_value);
} break;
@@ -1657,7 +1657,7 @@ Result SVC::GetHandleInfo(s64* out, Handle handle, u32 type) {
/// Creates a memory block at the specified address with the specified permissions and size
Result SVC::CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 my_permission,
u32 other_permission) {
R_UNLESS(size % Memory::CITRA_PAGE_SIZE == 0, ResultMisalignedSize);
R_UNLESS(size % Memory::LUCINA3DS_PAGE_SIZE == 0, ResultMisalignedSize);
std::shared_ptr<SharedMemory> shared_memory = nullptr;
@@ -1810,73 +1810,73 @@ Result SVC::GetSystemInfo(s64* out, u32 type, s32 param) {
LOG_ERROR(Kernel_SVC, "unimplemented GetSystemInfo type=65537 param={}", param);
*out = 0;
return (system.GetNumCores() == 4) ? ResultSuccess : ResultInvalidEnumValue;
case SystemInfoType::CITRA_INFORMATION:
switch ((SystemInfoCitraInformation)param) {
case SystemInfoCitraInformation::IS_CITRA:
case SystemInfoType::LUCINA3DS_INFORMATION:
switch ((SystemInfoLucina3DSInformation)param) {
case SystemInfoLucina3DSInformation::IS_LUCINA3DS:
*out = 1;
break;
case SystemInfoCitraInformation::HOST_TICK:
case SystemInfoLucina3DSInformation::HOST_TICK:
*out = static_cast<s64>(std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now().time_since_epoch())
.count());
break;
case SystemInfoCitraInformation::EMULATION_SPEED:
case SystemInfoLucina3DSInformation::EMULATION_SPEED:
*out = static_cast<s64>(Settings::values.frame_limit.GetValue());
break;
case SystemInfoCitraInformation::BUILD_NAME:
case SystemInfoLucina3DSInformation::BUILD_NAME:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_build_name, 0, sizeof(s64));
break;
case SystemInfoCitraInformation::BUILD_VERSION:
case SystemInfoLucina3DSInformation::BUILD_VERSION:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_build_version, 0, sizeof(s64));
break;
case SystemInfoCitraInformation::BUILD_PLATFORM: {
case SystemInfoLucina3DSInformation::BUILD_PLATFORM: {
#if defined(_WIN32)
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_WINDOWS);
*out = static_cast<s64>(SystemInfoLucina3DSPlatform::PLATFORM_WINDOWS);
#elif defined(ANDROID)
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_ANDROID);
*out = static_cast<s64>(SystemInfoLucina3DSPlatform::PLATFORM_ANDROID);
#elif defined(__linux__)
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_LINUX);
*out = static_cast<s64>(SystemInfoLucina3DSPlatform::PLATFORM_LINUX);
#elif defined(__APPLE__)
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_APPLE);
*out = static_cast<s64>(SystemInfoLucina3DSPlatform::PLATFORM_APPLE);
#else
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_UNKNOWN);
*out = static_cast<s64>(SystemInfoLucina3DSPlatform::PLATFORM_UNKNOWN);
#endif
break;
}
case SystemInfoCitraInformation::BUILD_DATE_PART1:
case SystemInfoLucina3DSInformation::BUILD_DATE_PART1:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_build_date,
(sizeof(s64) - 1) * 0, sizeof(s64));
break;
case SystemInfoCitraInformation::BUILD_DATE_PART2:
case SystemInfoLucina3DSInformation::BUILD_DATE_PART2:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_build_date,
(sizeof(s64) - 1) * 1, sizeof(s64));
break;
case SystemInfoCitraInformation::BUILD_DATE_PART3:
case SystemInfoLucina3DSInformation::BUILD_DATE_PART3:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_build_date,
(sizeof(s64) - 1) * 2, sizeof(s64));
break;
case SystemInfoCitraInformation::BUILD_DATE_PART4:
case SystemInfoLucina3DSInformation::BUILD_DATE_PART4:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_build_date,
(sizeof(s64) - 1) * 3, sizeof(s64));
break;
case SystemInfoCitraInformation::BUILD_GIT_BRANCH_PART1:
case SystemInfoLucina3DSInformation::BUILD_GIT_BRANCH_PART1:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_scm_branch,
(sizeof(s64) - 1) * 0, sizeof(s64));
break;
case SystemInfoCitraInformation::BUILD_GIT_BRANCH_PART2:
case SystemInfoLucina3DSInformation::BUILD_GIT_BRANCH_PART2:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_scm_branch,
(sizeof(s64) - 1) * 1, sizeof(s64));
break;
case SystemInfoCitraInformation::BUILD_GIT_DESCRIPTION_PART1:
case SystemInfoLucina3DSInformation::BUILD_GIT_DESCRIPTION_PART1:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_scm_desc, (sizeof(s64) - 1) * 0,
sizeof(s64));
break;
case SystemInfoCitraInformation::BUILD_GIT_DESCRIPTION_PART2:
case SystemInfoLucina3DSInformation::BUILD_GIT_DESCRIPTION_PART2:
CopyStringPart(reinterpret_cast<char*>(out), Common::g_scm_desc, (sizeof(s64) - 1) * 1,
sizeof(s64));
break;
default:
LOG_ERROR(Kernel_SVC, "unknown GetSystemInfo citra info param={}", param);
LOG_ERROR(Kernel_SVC, "unknown GetSystemInfo lucina3ds info param={}", param);
*out = 0;
break;
}
@@ -1904,7 +1904,7 @@ Result SVC::GetProcessInfo(s64* out, Handle process_handle, u32 type) {
// TODO(yuriks): Type 0 returns a slightly higher number than type 2, but I'm not sure
// what's the difference between them.
*out = process->memory_used;
if (*out % Memory::CITRA_PAGE_SIZE != 0) {
if (*out % Memory::LUCINA3DS_PAGE_SIZE != 0) {
LOG_ERROR(Kernel_SVC, "called, memory size not page-aligned");
return ResultMisalignedSize;
}
@@ -2047,7 +2047,7 @@ Result SVC::MapProcessMemoryEx(Handle dst_process_handle, u32 dst_address,
R_UNLESS(dst_process && src_process, ResultInvalidHandle);
if (size & 0xFFF) {
size = (size & ~0xFFF) + Memory::CITRA_PAGE_SIZE;
size = (size & ~0xFFF) + Memory::LUCINA3DS_PAGE_SIZE;
}
// TODO(PabloMK7) Fix-up this svc.
@@ -2081,7 +2081,7 @@ Result SVC::UnmapProcessMemoryEx(Handle process, u32 dst_address, u32 size) {
R_UNLESS(dst_process, ResultInvalidHandle);
if (size & 0xFFF) {
size = (size & ~0xFFF) + Memory::CITRA_PAGE_SIZE;
size = (size & ~0xFFF) + Memory::LUCINA3DS_PAGE_SIZE;
}
// Only linear memory supported

View File

@@ -109,9 +109,9 @@ void Thread::Stop() {
ReleaseThreadMutexes(this);
// Mark the TLS slot in the thread's page as free.
u32 tls_page = (tls_address - Memory::TLS_AREA_VADDR) / Memory::CITRA_PAGE_SIZE;
u32 tls_page = (tls_address - Memory::TLS_AREA_VADDR) / Memory::LUCINA3DS_PAGE_SIZE;
u32 tls_slot =
((tls_address - Memory::TLS_AREA_VADDR) % Memory::CITRA_PAGE_SIZE) / Memory::TLS_ENTRY_SIZE;
((tls_address - Memory::TLS_AREA_VADDR) % Memory::LUCINA3DS_PAGE_SIZE) / Memory::TLS_ENTRY_SIZE;
if (auto process = owner_process.lock()) {
process->tls_slots[tls_page].reset(tls_slot);
process->resource_limit->Release(ResourceLimitType::Thread, 1);

View File

@@ -253,8 +253,8 @@ VMManager::VMAIter VMManager::StripIterConstness(const VMAHandle& iter) {
}
ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u32 size) {
ASSERT_MSG((size & Memory::CITRA_PAGE_MASK) == 0, "non-page aligned size: {:#10X}", size);
ASSERT_MSG((base & Memory::CITRA_PAGE_MASK) == 0, "non-page aligned base: {:#010X}", base);
ASSERT_MSG((size & Memory::LUCINA3DS_PAGE_MASK) == 0, "non-page aligned size: {:#10X}", size);
ASSERT_MSG((base & Memory::LUCINA3DS_PAGE_MASK) == 0, "non-page aligned base: {:#010X}", base);
VMAIter vma_handle = StripIterConstness(FindVMA(base));
if (vma_handle == vma_map.end()) {
@@ -289,8 +289,8 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u32 size) {
}
ResultVal<VMManager::VMAIter> VMManager::CarveVMARange(VAddr target, u32 size) {
ASSERT_MSG((size & Memory::CITRA_PAGE_MASK) == 0, "non-page aligned size: {:#10X}", size);
ASSERT_MSG((target & Memory::CITRA_PAGE_MASK) == 0, "non-page aligned base: {:#010X}", target);
ASSERT_MSG((size & Memory::LUCINA3DS_PAGE_MASK) == 0, "non-page aligned size: {:#10X}", size);
ASSERT_MSG((target & Memory::LUCINA3DS_PAGE_MASK) == 0, "non-page aligned base: {:#010X}", target);
const VAddr target_end = target + size;
ASSERT(target_end >= target);

View File

@@ -38,7 +38,7 @@ constexpr u8 DEFAULT_SOUND_OUTPUT_MODE = SOUND_STEREO;
// constants.
constexpr u64_le DEFAULT_CONSOLE_ID = 0;
constexpr u32_le DEFAULT_CONSOLE_RANDOM_NUMBER = 0;
constexpr UsernameBlock DEFAULT_USERNAME{{u"CITRA"}, 0, 0};
constexpr UsernameBlock DEFAULT_USERNAME{{u"LUCINA3DS"}, 0, 0};
constexpr BirthdayBlock DEFAULT_BIRTHDAY{3, 25}; // March 25th, 2014
constexpr u8 DEFAULT_LANGUAGE = LANGUAGE_EN;
constexpr ConsoleCountryInfo DEFAULT_COUNTRY_INFO{

View File

@@ -193,7 +193,7 @@ static_assert(sizeof(CaptureState) == 0x8, "CaptureState structure size is wrong
void CSND_SND::Initialize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx);
const u32 size = Common::AlignUp(rp.Pop<u32>(), Memory::CITRA_PAGE_SIZE);
const u32 size = Common::AlignUp(rp.Pop<u32>(), Memory::LUCINA3DS_PAGE_SIZE);
master_state_offset = rp.Pop<u32>();
channel_state_offset = rp.Pop<u32>();
capture_state_offset = rp.Pop<u32>();

View File

@@ -1500,7 +1500,7 @@ u32 CROHelper::Fix(u32 fix_level) {
}
}
fix_end = Common::AlignUp(fix_end, Memory::CITRA_PAGE_SIZE);
fix_end = Common::AlignUp(fix_end, Memory::LUCINA3DS_PAGE_SIZE);
u32 fixed_size = fix_end - module_address;
SetField(FixedSize, fixed_size);
@@ -1523,8 +1523,8 @@ std::tuple<VAddr, u32> CROHelper::GetExecutablePages() const {
SegmentEntry entry;
GetEntry(system.Memory(), i, entry);
if (entry.type == SegmentType::Code && entry.size != 0) {
VAddr begin = Common::AlignDown(entry.offset, Memory::CITRA_PAGE_SIZE);
VAddr end = Common::AlignUp(entry.offset + entry.size, Memory::CITRA_PAGE_SIZE);
VAddr begin = Common::AlignDown(entry.offset, Memory::LUCINA3DS_PAGE_SIZE);
VAddr end = Common::AlignUp(entry.offset + entry.size, Memory::LUCINA3DS_PAGE_SIZE);
return std::make_tuple(begin, end - begin);
}
}

View File

@@ -87,19 +87,19 @@ void RO::Initialize(Kernel::HLERequestContext& ctx) {
return;
}
if (crs_buffer_ptr & Memory::CITRA_PAGE_MASK) {
if (crs_buffer_ptr & Memory::LUCINA3DS_PAGE_MASK) {
LOG_ERROR(Service_LDR, "CRS original address is not aligned");
rb.Push(ERROR_MISALIGNED_ADDRESS);
return;
}
if (crs_address & Memory::CITRA_PAGE_MASK) {
if (crs_address & Memory::LUCINA3DS_PAGE_MASK) {
LOG_ERROR(Service_LDR, "CRS mapping address is not aligned");
rb.Push(ERROR_MISALIGNED_ADDRESS);
return;
}
if (crs_size & Memory::CITRA_PAGE_MASK) {
if (crs_size & Memory::LUCINA3DS_PAGE_MASK) {
LOG_ERROR(Service_LDR, "CRS size is not aligned");
rb.Push(ERROR_MISALIGNED_SIZE);
return;
@@ -207,21 +207,21 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) {
return;
}
if (cro_buffer_ptr & Memory::CITRA_PAGE_MASK) {
if (cro_buffer_ptr & Memory::LUCINA3DS_PAGE_MASK) {
LOG_ERROR(Service_LDR, "CRO original address is not aligned");
rb.Push(ERROR_MISALIGNED_ADDRESS);
rb.Push<u32>(0);
return;
}
if (cro_address & Memory::CITRA_PAGE_MASK) {
if (cro_address & Memory::LUCINA3DS_PAGE_MASK) {
LOG_ERROR(Service_LDR, "CRO mapping address is not aligned");
rb.Push(ERROR_MISALIGNED_ADDRESS);
rb.Push<u32>(0);
return;
}
if (cro_size & Memory::CITRA_PAGE_MASK) {
if (cro_size & Memory::LUCINA3DS_PAGE_MASK) {
LOG_ERROR(Service_LDR, "CRO size is not aligned");
rb.Push(ERROR_MISALIGNED_SIZE);
rb.Push<u32>(0);
@@ -354,7 +354,7 @@ void RO::UnloadCRO(Kernel::HLERequestContext& ctx) {
return;
}
if (cro_address & Memory::CITRA_PAGE_MASK) {
if (cro_address & Memory::LUCINA3DS_PAGE_MASK) {
LOG_ERROR(Service_LDR, "CRO address is not aligned");
rb.Push(ERROR_MISALIGNED_ADDRESS);
return;
@@ -421,7 +421,7 @@ void RO::LinkCRO(Kernel::HLERequestContext& ctx) {
return;
}
if (cro_address & Memory::CITRA_PAGE_MASK) {
if (cro_address & Memory::LUCINA3DS_PAGE_MASK) {
LOG_ERROR(Service_LDR, "CRO address is not aligned");
rb.Push(ERROR_MISALIGNED_ADDRESS);
return;
@@ -461,7 +461,7 @@ void RO::UnlinkCRO(Kernel::HLERequestContext& ctx) {
return;
}
if (cro_address & Memory::CITRA_PAGE_MASK) {
if (cro_address & Memory::LUCINA3DS_PAGE_MASK) {
LOG_ERROR(Service_LDR, "CRO address is not aligned");
rb.Push(ERROR_MISALIGNED_ADDRESS);
return;