Open armvm opened 5 years ago
Maybe pitch it on the citra discord and we could see what they think about it, I'm not entirely sure about the requirements for the HLE<->CPU bridge.
For that matter, @sachinvin, how hard would it be to implement kvm support... obviosly it would be usable on a very limited number of devices, but i might just give it a shot
It has two thread:sandbox thread and main thread. sandbox thread run 3ds code, WHEN RAISE SVC CALL(HLE), it will switch to main thread and save registers. then call hle. sandbox would wait for main thread. YOU CAN IMPLEMENT CLASS VmCallback, Method void HandleSystemCall(uint32_t swi) , the bridge of HLE<->CPU i want to know how to compile citra on android
@armvm How would you handle MMIO?
git clone https://github.com/SachinVin/citra_android.git
git clone --recursive https://github.com/SachinVin/citra.git
Then you build it with android studio
@SachinVin for example
class TestCallback : public ARMVM::VmCallback { TestCallback(Core::System& system) :svc(system) {
}
virtual void HandleException(uint32_t sig) override
{
}
virtual void HandleIllegalInstruction(uint32_t instruction) override
{
}
virtual void HandleSystemCall(uint32_t svc) override
{
svc.CallSVC(svc); //include MMIO and other system call;
}
virtual void HandleSegmentFault(uint32_t instruction) override
{
}
virtual ~TestCallback() override
{
}
Kernel::SVC svc;
std::unique_ptr<ARMVM::VmLauncher> launcher;
};
...
std::unique_ptr
Because MMIO is system call, for example "WriteProcessMemory" is svc 0x6B, so when call "WriteProcessMemory", armvm will will save register and swich main thread and call vmcallback->HandleSystemCall(0x6B), then emulator can handle it and modify register and memory. after return HandleSystemCall, it will switch to sandbox and load register.
I'm fans of citra_android project, and I want to contribute to the project!
MMIO is not a system call, a program could write to an address that isnt a memory location but a device, If you dont handle these non existent memory location you're going to segfault. Also there needs to be a cycle counter for timings.
@SachinVin ARMVM can catch segfault exception and not crash, so you can handle the exception at main thread(emulator)
VmCallback::HandleException(uint32_t sig); when sig = 11, it is segfault. you can get instruction by PC register and handle it
Well, i guess you can go ahead and give it a shot.
Nice emulator for android i have playing runefactory 4 on android playble fps 30-60 on snapdragon 710(game fav. On 3ds)
Thanks for SachinVin
Wait new build for mapping gamepad controler thanks....^_^
Dont wait, I dont plan on updating anytime soon.
Okay ^_^
https://github.com/armvm/ARMVM ARMVM, Running ARM Code directly On Android, Can Catch and callback System call and other Exception. It may help you The bridge of HLE<->CPU is class VmCallback, please see main.cpp It Has two thread: main thread and sandbox thread. 3ds code run on sandbox thread, and sandbox thread can CATCH HLE call and callback to main thread. but i want to know how to compile citra on android, it faild. please give me "simple project" for citra android