Closed jvulcan closed 2 years ago
You need to generate stubs for your module (basically a static lib) and link with them. There's no dlsym-like functionality. There's also no automatic loading.
If you want dlopen/dlsym functionality, you can use https://github.com/isage/vita-rss-libdl as reference (it'll need adjustments to work in kernel-space)
How do I generate those stubs for a vita kernel module? Would that mean that I don't need to provide the skprx module anymore and it will be embedded to the vpk? Thanks.
https://github.com/vitasdk/vita-toolchain/blob/master/cmake_toolchain/vita.cmake#L162 No, you still need to provide and load skprx. VPK is just a zip file. You can add your module there for your app to load (from app0:/...)
https://github.com/TheOfficialFloW/kubridge is a nice exaple of kernel module with exports and stubs (and handling userspace <-> kernelspace memory conversion)
Thank you, I'll check them out.
QUESTION. Can I just use the kernel functions in the VPK project? that way I could just put everything in the VPK instead of coding a library. or making a kernel module has something special? I'm looking to:
No. Apps run in userspace
It is possible to make a simple hook to svc. It may or may not be possible to allocate memory for any virtual space.
About any virtual space mapping, You need to learn ARM TTBR.
Edit All your questions must be run in kernel space.
These are the virtual spaces I wanna use: 0x100000 The following spaces may or may not be used: 0xbf3000 0xd32000 0xd71000 0xded000 0xec0000 0x1082000 0xb00000 0xb84000 0xcba000
For the hook I will need to know what Thread called SVC along with the code (e.g. SVC 0x36 , I need to catch the 0x36) and state of registers.
I have a module, which I'm loading it with "ksceKernelLoadStartModule" and unloading with "ksceKernelStopUnloadModule", which are (kind of) equivalent to dlopen and dlclose linux functions. (yes, it's a kernel module)
How do I call a certain function from that module? e.g.
int sum(int a, int b)
According to arm-vita-eabi-readelf my module exports the function in the symtable. Is there some equivalent to dlsym?Unless there's a way to add the kernel lib (skprx) in cmake so I don't have to Load/Unload modules manually? Thanks