mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-09 21:51:45 +00:00
fusee: fix missing volatiles in memory utils
This commit is contained in:
parent
d104ff61ca
commit
b5d3ce04e8
1 changed files with 10 additions and 8 deletions
|
@ -29,9 +29,8 @@ static inline uintptr_t get_physical_address(const void *addr) {
|
||||||
|
|
||||||
static inline uint32_t read32le(const volatile void *dword, size_t offset) {
|
static inline uint32_t read32le(const volatile void *dword, size_t offset) {
|
||||||
uintptr_t addr = (uintptr_t)dword + offset;
|
uintptr_t addr = (uintptr_t)dword + offset;
|
||||||
uint32_t dst;
|
volatile uint32_t *target = (uint32_t *)addr;
|
||||||
memcpy(&dst, (void *)addr, 4);
|
return *target;
|
||||||
return dst;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t read32be(const volatile void *dword, size_t offset) {
|
static inline uint32_t read32be(const volatile void *dword, size_t offset) {
|
||||||
|
@ -40,9 +39,8 @@ static inline uint32_t read32be(const volatile void *dword, size_t offset) {
|
||||||
|
|
||||||
static inline uint64_t read64le(const volatile void *qword, size_t offset) {
|
static inline uint64_t read64le(const volatile void *qword, size_t offset) {
|
||||||
uintptr_t addr = (uintptr_t)qword + offset;
|
uintptr_t addr = (uintptr_t)qword + offset;
|
||||||
uint64_t dst;
|
volatile uint64_t *target = (uint64_t *)addr;
|
||||||
memcpy(&dst, (void *)addr, 8);
|
return *target;
|
||||||
return dst;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t read64be(const volatile void *qword, size_t offset) {
|
static inline uint64_t read64be(const volatile void *qword, size_t offset) {
|
||||||
|
@ -50,7 +48,9 @@ static inline uint64_t read64be(const volatile void *qword, size_t offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void write32le(volatile void *dword, size_t offset, uint32_t value) {
|
static inline void write32le(volatile void *dword, size_t offset, uint32_t value) {
|
||||||
memcpy((void *)((uintptr_t)dword + offset), &value, 4);
|
uintptr_t addr = (uintptr_t)dword + offset;
|
||||||
|
volatile uint32_t *target = (uint32_t *)addr;
|
||||||
|
*target = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void write32be(volatile void *dword, size_t offset, uint32_t value) {
|
static inline void write32be(volatile void *dword, size_t offset, uint32_t value) {
|
||||||
|
@ -58,7 +58,9 @@ static inline void write32be(volatile void *dword, size_t offset, uint32_t value
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void write64le(volatile void *qword, size_t offset, uint64_t value) {
|
static inline void write64le(volatile void *qword, size_t offset, uint64_t value) {
|
||||||
memcpy((void *)((uintptr_t)qword + offset), &value, 8);
|
uintptr_t addr = (uintptr_t)qword + offset;
|
||||||
|
volatile uint64_t *target = (uint64_t *)addr;
|
||||||
|
*target = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void write64be(volatile void *qword, size_t offset, uint64_t value) {
|
static inline void write64be(volatile void *qword, size_t offset, uint64_t value) {
|
||||||
|
|
Loading…
Reference in a new issue