mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-11-17 01:21:18 +01:00
kern: pass u32 directly to CopyMemoryToUserSize32Bit
This commit is contained in:
parent
3bc1951820
commit
2a44550dbe
@ -35,7 +35,7 @@ namespace ams::kern::arch::arm64 {
|
|||||||
static bool CopyMemoryToUser(void *dst, const void *src, size_t size);
|
static bool CopyMemoryToUser(void *dst, const void *src, size_t size);
|
||||||
static bool CopyMemoryToUserAligned32Bit(void *dst, const void *src, size_t size);
|
static bool CopyMemoryToUserAligned32Bit(void *dst, const void *src, size_t size);
|
||||||
static bool CopyMemoryToUserAligned64Bit(void *dst, const void *src, size_t size);
|
static bool CopyMemoryToUserAligned64Bit(void *dst, const void *src, size_t size);
|
||||||
static bool CopyMemoryToUserSize32Bit(void *dst, const void *src);
|
static bool CopyMemoryToUserSize32Bit(void *dst, u32 value);
|
||||||
static s32 CopyStringToUser(void *dst, const void *src, size_t size);
|
static s32 CopyStringToUser(void *dst, const void *src, size_t size);
|
||||||
|
|
||||||
static bool UpdateLockAtomic(u32 *out, u32 *address, u32 if_zero, u32 new_orr_mask);
|
static bool UpdateLockAtomic(u32 *out, u32 *address, u32 if_zero, u32 new_orr_mask);
|
||||||
@ -100,8 +100,8 @@ namespace ams::kern::arch::arm64 {
|
|||||||
return Impl::CopyMemoryToUserAligned64Bit(dst, src, size);
|
return Impl::CopyMemoryToUserAligned64Bit(dst, src, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CopyMemoryToUserSize32Bit(void *dst, const void *src) {
|
static bool CopyMemoryToUserSize32Bit(void *dst, u32 value) {
|
||||||
return Impl::CopyMemoryToUserSize32Bit(dst, src);
|
return Impl::CopyMemoryToUserSize32Bit(dst, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 CopyStringToUser(void *dst, const void *src, size_t size) {
|
static s32 CopyStringToUser(void *dst, const void *src, size_t size) {
|
||||||
|
|||||||
@ -306,15 +306,14 @@ _ZN3ams4kern4arch5arm6415UserspaceAccess4Impl28CopyMemoryToUserAligned64BitEPvPK
|
|||||||
mov x0, #1
|
mov x0, #1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
/* ams::kern::arch::arm64::UserspaceAccess::Impl::CopyMemoryToUserSize32Bit(void *dst, const void *src) */
|
/* ams::kern::arch::arm64::UserspaceAccess::Impl::CopyMemoryToUserSize32Bit(void *dst, u32 value) */
|
||||||
.section .text._ZN3ams4kern4arch5arm6415UserspaceAccess4Impl25CopyMemoryToUserSize32BitEPvPKv, "ax", %progbits
|
.section .text._ZN3ams4kern4arch5arm6415UserspaceAccess4Impl25CopyMemoryToUserSize32BitEPvj, "ax", %progbits
|
||||||
.global _ZN3ams4kern4arch5arm6415UserspaceAccess4Impl25CopyMemoryToUserSize32BitEPvPKv
|
.global _ZN3ams4kern4arch5arm6415UserspaceAccess4Impl25CopyMemoryToUserSize32BitEPvj
|
||||||
.type _ZN3ams4kern4arch5arm6415UserspaceAccess4Impl25CopyMemoryToUserSize32BitEPvPKv, %function
|
.type _ZN3ams4kern4arch5arm6415UserspaceAccess4Impl25CopyMemoryToUserSize32BitEPvj, %function
|
||||||
.balign 0x10
|
.balign 0x10
|
||||||
_ZN3ams4kern4arch5arm6415UserspaceAccess4Impl25CopyMemoryToUserSize32BitEPvPKv:
|
_ZN3ams4kern4arch5arm6415UserspaceAccess4Impl25CopyMemoryToUserSize32BitEPvj:
|
||||||
/* Just load and store a u32. */
|
/* Just store a u32. */
|
||||||
ldr w2, [x1]
|
sttr w1, [x0]
|
||||||
sttr w2, [x0]
|
|
||||||
|
|
||||||
/* We're done. */
|
/* We're done. */
|
||||||
mov x0, #1
|
mov x0, #1
|
||||||
|
|||||||
@ -23,8 +23,8 @@ namespace ams::kern {
|
|||||||
return UserspaceAccess::CopyMemoryFromUserSize32Bit(out, GetVoidPointer(address));
|
return UserspaceAccess::CopyMemoryFromUserSize32Bit(out, GetVoidPointer(address));
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE bool WriteToUser(KProcessAddress address, const u32 *p) {
|
ALWAYS_INLINE bool WriteToUser(KProcessAddress address, u32 val) {
|
||||||
return UserspaceAccess::CopyMemoryToUserSize32Bit(GetVoidPointer(address), p);
|
return UserspaceAccess::CopyMemoryToUserSize32Bit(GetVoidPointer(address), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE bool UpdateLockAtomic(u32 *out, KProcessAddress address, u32 if_zero, u32 new_orr_mask) {
|
ALWAYS_INLINE bool UpdateLockAtomic(u32 *out, KProcessAddress address, u32 if_zero, u32 new_orr_mask) {
|
||||||
@ -94,7 +94,7 @@ namespace ams::kern {
|
|||||||
|
|
||||||
/* Write the value to userspace. */
|
/* Write the value to userspace. */
|
||||||
Result result;
|
Result result;
|
||||||
if (AMS_LIKELY(WriteToUser(addr, std::addressof(next_value)))) {
|
if (AMS_LIKELY(WriteToUser(addr, next_value))) {
|
||||||
result = ResultSuccess();
|
result = ResultSuccess();
|
||||||
} else {
|
} else {
|
||||||
result = svc::ResultInvalidCurrentMemory();
|
result = svc::ResultInvalidCurrentMemory();
|
||||||
@ -210,8 +210,8 @@ namespace ams::kern {
|
|||||||
|
|
||||||
/* If we have no waiters, clear the has waiter flag. */
|
/* If we have no waiters, clear the has waiter flag. */
|
||||||
if (it == m_tree.end() || it->GetConditionVariableKey() != cv_key) {
|
if (it == m_tree.end() || it->GetConditionVariableKey() != cv_key) {
|
||||||
const u32 has_waiter_flag = 0;
|
constexpr u32 HasNoWaiterFlag = 0;
|
||||||
WriteToUser(cv_key, std::addressof(has_waiter_flag));
|
WriteToUser(cv_key, HasNoWaiterFlag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,13 +252,13 @@ namespace ams::kern {
|
|||||||
|
|
||||||
/* Write to the cv key. */
|
/* Write to the cv key. */
|
||||||
{
|
{
|
||||||
const u32 has_waiter_flag = 1;
|
constexpr u32 HasWaiterFlag = 1;
|
||||||
WriteToUser(key, std::addressof(has_waiter_flag));
|
WriteToUser(key, HasWaiterFlag);
|
||||||
cpu::DataMemoryBarrierInnerShareable();
|
cpu::DataMemoryBarrierInnerShareable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the value to userspace. */
|
/* Write the value to userspace. */
|
||||||
if (!WriteToUser(addr, std::addressof(next_value))) {
|
if (!WriteToUser(addr, next_value)) {
|
||||||
slp.CancelSleep();
|
slp.CancelSleep();
|
||||||
R_THROW(svc::ResultInvalidCurrentMemory());
|
R_THROW(svc::ResultInvalidCurrentMemory());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user