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