]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added svcQueryMemory
authorplutoo <plutoo@univor.se>
Sun, 26 Oct 2014 23:07:07 +0000 (00:07 +0100)
committerplutoo <plutoo@univor.se>
Sun, 26 Oct 2014 23:07:07 +0000 (00:07 +0100)
libctru/include/3ds/svc.h
libctru/source/svc.s

index 402194d218be2d7a8d4a1260ef3ae8174c9a1361..ab1d1c3de8e0e51246a0a81a4925938f090c5845 100644 (file)
@@ -23,9 +23,22 @@ typedef enum {
        MEMPERM_MAX    =0xFFFFFFFF //force 4-byte
 } MemPerm;
 
+typedef struct {
+    u32 base_addr;
+    u32 size;
+    u32 perm;
+    u32 state;
+} MemInfo;
+
+typedef struct {
+    u32 flags;
+} PageInfo;
+
+
 u32* getThreadCommandBuffer(void);
 
 s32  svcControlMemory(u32* addr_out, u32 addr0, u32 addr1, u32 size, MemOp op, MemPerm perm);
+s32  svcQueryMemory(MemInfo* info, PageInfo* out, u32 addr);
 void __attribute__((noreturn)) svcExitProcess();
 s32  svcCreateThread(Handle* thread, ThreadFunc entrypoint, u32 arg, u32* stack_top, s32 thread_priority, s32 processor_id);
 void __attribute__((noreturn)) svcExitThread();
index 1969ddc97524050284f13bdde1cc5d7db8f88ffc..2d777ad09329dadf8fac7577c064c24edf8484d5 100644 (file)
@@ -22,6 +22,22 @@ svcControlMemory:
        ldr r4, [sp], #4
        bx lr
 
+.global svcQueryMemory
+.type svcQueryMemory, %function
+svcQueryMemory:
+       stmfd           sp!, {r0,r1,r4-r6}
+       svc             2
+       ldr             r6, [sp]
+       str             r1, [r6]
+       str             r2, [r6,#4]
+       str             r3, [r6,#8]
+       str             r4, [r6,#0xc]
+       ldr             r6, [sp,#4]
+       str             r5, [r6]
+       add             sp, sp, #8
+       ldmfd           sp!, {r4-r6}
+       bx              lr
+
 .global svcExitProcess
 .type svcExitProcess, %function
 svcExitProcess: