arm64: Fix physical page memcpy operations.

Change-Id: Ie1a0fafad2b71f964292c14b1934d9406b3c015c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8101
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
This commit is contained in:
Owen Anderson
2024-08-24 18:24:47 +00:00
committed by waddlesplash
parent 9d4d102df2
commit 81af091961
2 changed files with 14 additions and 10 deletions
@@ -9,6 +9,7 @@
#define CPU_MAX_CACHE_LEVEL 8
#define CACHE_LINE_SIZE 64
// TODO: These will require a real implementation when PAN is enabled
#define set_ac()
#define clear_ac()
@@ -34,28 +34,31 @@ PMAPPhysicalPageMapper::MemsetPhysical(phys_addr_t address, int value, phys_size
return B_OK;
}
status_t
PMAPPhysicalPageMapper::MemcpyFromPhysical(void* to, phys_addr_t from, size_t length, bool user)
{
if (user)
panic("MemcpyFromPhysical user not impl");
ASSERT(from < KERNEL_PMAP_SIZE);
memcpy(to, reinterpret_cast<void*>(KERNEL_PMAP_BASE + from), length);
return B_OK;
if (!user) {
memcpy(to, reinterpret_cast<void*>(KERNEL_PMAP_BASE + from), length);
return B_OK;
} else {
return user_memcpy(to, reinterpret_cast<void*>(KERNEL_PMAP_BASE + from), length);
}
}
status_t
PMAPPhysicalPageMapper::MemcpyToPhysical(phys_addr_t to, const void* from, size_t length, bool user)
{
if (user)
panic("MemcpyToPhysical user not impl");
ASSERT(to < KERNEL_PMAP_SIZE);
memcpy(reinterpret_cast<void*>(KERNEL_PMAP_BASE + to), from, length);
if (!user) {
memcpy(reinterpret_cast<void*>(KERNEL_PMAP_BASE + to), from, length);
return B_OK;
} else {
return user_memcpy(reinterpret_cast<void*>(KERNEL_PMAP_BASE + to), from, length);
}
return B_OK;
}