mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-21 18:02:15 +02:00
Added osDCacheFlush() for use by usbds.
This commit is contained in:
parent
6cea85f338
commit
d1ba4d4e2b
@ -12,6 +12,7 @@ extern "C" {
|
||||
#include <switch/result.h>
|
||||
#include <switch/svc.h>
|
||||
#include <switch/ipc.h>
|
||||
#include <switch/os.h>
|
||||
|
||||
#include <switch/kernel/tmem.h>
|
||||
#include <switch/kernel/mutex.h>
|
||||
|
1
nx/include/switch/os.h
Normal file
1
nx/include/switch/os.h
Normal file
@ -0,0 +1 @@
|
||||
void osDCacheFlush(void* addr, size_t size);
|
34
nx/source/kernel/cache.s
Normal file
34
nx/source/kernel/cache.s
Normal file
@ -0,0 +1,34 @@
|
||||
.macro CODE_BEGIN name
|
||||
.section .text.\name, "ax", %progbits
|
||||
.global \name
|
||||
.type \name, %function
|
||||
.align 2
|
||||
.cfi_startproc
|
||||
\name:
|
||||
.endm
|
||||
|
||||
.macro CODE_END
|
||||
.cfi_endproc
|
||||
.endm
|
||||
|
||||
CODE_BEGIN osDCacheFlush
|
||||
add x1, x1, x0
|
||||
mrs x8, CTR_EL0
|
||||
lsr x8, x8, #16
|
||||
and x8, x8, #0xf
|
||||
mov x9, #4
|
||||
lsl x9, x9, x8
|
||||
sub x10, x9, #1
|
||||
bic x8, x0, x10
|
||||
mov x10, x1
|
||||
|
||||
osDCacheFlush_L0:
|
||||
dc civac, x8
|
||||
add x8, x8, x9
|
||||
cmp x8, x10
|
||||
bcc osDCacheFlush_L0
|
||||
|
||||
dsb sy
|
||||
ret
|
||||
CODE_END
|
||||
|
@ -382,7 +382,7 @@ static Result _usbDsCmdNoParams(Handle sessionhandle, u64 cmd_id) {
|
||||
static Result _usbDsPostBuffer(Handle sessionhandle, u64 cmd_id, void* buffer, size_t size, u32 *out) {
|
||||
if(sessionhandle==0)return MAKERESULT(MODULE_LIBNX, LIBNX_NOTINITIALIZED);
|
||||
|
||||
//TODO: Add dache-flush code here, breaks otherwise.
|
||||
osDCacheFlush(buffer, size);
|
||||
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
Loading…
Reference in New Issue
Block a user