mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-26 11:20:05 +00:00
core: fix memory.cpp size_t to u32 or VAddrs warnings
This commit is contained in:
parent
327692ed9d
commit
8610dafaa7
@ -392,7 +392,7 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
|
|||||||
|
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
||||||
const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset;
|
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
|
||||||
|
|
||||||
switch (current_page_table->attributes[page_index]) {
|
switch (current_page_table->attributes[page_index]) {
|
||||||
case PageType::Unmapped: {
|
case PageType::Unmapped: {
|
||||||
@ -415,7 +415,8 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedMemory: {
|
case PageType::RasterizerCachedMemory: {
|
||||||
RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount);
|
RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr),
|
||||||
|
static_cast<u32>(copy_amount));
|
||||||
|
|
||||||
std::memcpy(dest_buffer, GetPointerFromVMA(current_vaddr), copy_amount);
|
std::memcpy(dest_buffer, GetPointerFromVMA(current_vaddr), copy_amount);
|
||||||
break;
|
break;
|
||||||
@ -423,7 +424,8 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
|
|||||||
case PageType::RasterizerCachedSpecial: {
|
case PageType::RasterizerCachedSpecial: {
|
||||||
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
||||||
|
|
||||||
RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount);
|
RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr),
|
||||||
|
static_cast<u32>(copy_amount));
|
||||||
|
|
||||||
GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, dest_buffer, copy_amount);
|
GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, dest_buffer, copy_amount);
|
||||||
break;
|
break;
|
||||||
@ -462,7 +464,7 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size
|
|||||||
|
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
||||||
const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset;
|
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
|
||||||
|
|
||||||
switch (current_page_table->attributes[page_index]) {
|
switch (current_page_table->attributes[page_index]) {
|
||||||
case PageType::Unmapped: {
|
case PageType::Unmapped: {
|
||||||
@ -486,7 +488,7 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size
|
|||||||
}
|
}
|
||||||
case PageType::RasterizerCachedMemory: {
|
case PageType::RasterizerCachedMemory: {
|
||||||
RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr),
|
RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr),
|
||||||
copy_amount);
|
static_cast<u32>(copy_amount));
|
||||||
|
|
||||||
std::memcpy(GetPointerFromVMA(current_vaddr), src_buffer, copy_amount);
|
std::memcpy(GetPointerFromVMA(current_vaddr), src_buffer, copy_amount);
|
||||||
break;
|
break;
|
||||||
@ -495,7 +497,7 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size
|
|||||||
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
||||||
|
|
||||||
RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr),
|
RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr),
|
||||||
copy_amount);
|
static_cast<u32>(copy_amount));
|
||||||
|
|
||||||
GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, src_buffer, copy_amount);
|
GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, src_buffer, copy_amount);
|
||||||
break;
|
break;
|
||||||
@ -520,7 +522,7 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) {
|
|||||||
|
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
||||||
const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset;
|
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
|
||||||
|
|
||||||
switch (current_page_table->attributes[page_index]) {
|
switch (current_page_table->attributes[page_index]) {
|
||||||
case PageType::Unmapped: {
|
case PageType::Unmapped: {
|
||||||
@ -543,7 +545,7 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) {
|
|||||||
}
|
}
|
||||||
case PageType::RasterizerCachedMemory: {
|
case PageType::RasterizerCachedMemory: {
|
||||||
RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr),
|
RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr),
|
||||||
copy_amount);
|
static_cast<u32>(copy_amount));
|
||||||
|
|
||||||
std::memset(GetPointerFromVMA(current_vaddr), 0, copy_amount);
|
std::memset(GetPointerFromVMA(current_vaddr), 0, copy_amount);
|
||||||
break;
|
break;
|
||||||
@ -552,7 +554,7 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) {
|
|||||||
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
||||||
|
|
||||||
RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr),
|
RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr),
|
||||||
copy_amount);
|
static_cast<u32>(copy_amount));
|
||||||
|
|
||||||
GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, zeros.data(), copy_amount);
|
GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, zeros.data(), copy_amount);
|
||||||
break;
|
break;
|
||||||
@ -574,7 +576,7 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
|
|||||||
|
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
|
||||||
const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset;
|
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
|
||||||
|
|
||||||
switch (current_page_table->attributes[page_index]) {
|
switch (current_page_table->attributes[page_index]) {
|
||||||
case PageType::Unmapped: {
|
case PageType::Unmapped: {
|
||||||
@ -598,7 +600,8 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageType::RasterizerCachedMemory: {
|
case PageType::RasterizerCachedMemory: {
|
||||||
RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount);
|
RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr),
|
||||||
|
static_cast<u32>(copy_amount));
|
||||||
|
|
||||||
WriteBlock(dest_addr, GetPointerFromVMA(current_vaddr), copy_amount);
|
WriteBlock(dest_addr, GetPointerFromVMA(current_vaddr), copy_amount);
|
||||||
break;
|
break;
|
||||||
@ -606,7 +609,8 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
|
|||||||
case PageType::RasterizerCachedSpecial: {
|
case PageType::RasterizerCachedSpecial: {
|
||||||
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
DEBUG_ASSERT(GetMMIOHandler(current_vaddr));
|
||||||
|
|
||||||
RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount);
|
RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr),
|
||||||
|
static_cast<u32>(copy_amount));
|
||||||
|
|
||||||
std::vector<u8> buffer(copy_amount);
|
std::vector<u8> buffer(copy_amount);
|
||||||
GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, buffer.data(), buffer.size());
|
GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, buffer.data(), buffer.size());
|
||||||
@ -619,8 +623,8 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
|
|||||||
|
|
||||||
page_index++;
|
page_index++;
|
||||||
page_offset = 0;
|
page_offset = 0;
|
||||||
dest_addr += copy_amount;
|
dest_addr += static_cast<VAddr>(copy_amount);
|
||||||
src_addr += copy_amount;
|
src_addr += static_cast<VAddr>(copy_amount);
|
||||||
remaining_size -= copy_amount;
|
remaining_size -= copy_amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user