shinyquagsire23 / bootstrap

ARM11 Kernel from ninjhax
25 stars 27 forks source link

Loading invalid address to PC at arm11_kernel_stub #8

Open 173210 opened 9 years ago

173210 commented 9 years ago

https://github.com/shinyquagsire23/bootstrap/blob/1c55c0b333659f6b5cc60556c4121eb6d0e88447/bootstrap.c#L248 To fix this, we should remove arm11_kernel_stub and call arm11_kernel_exec directly.

44670 commented 9 years ago

I assume it is essential since it should be recoverd from the corrupted svc8 call.

173210 commented 9 years ago

I got it. But, the inline assembly has different problem.

movs r0, #0

But arm11_kernel_exec has its own return value. So They should be modified as this:

__asm__ ("movs r0, %0\t\n"
    "ldr pc, [sp], #4\t\n",
    : "r"(arm11_kernel_exec()));
shinyquagsire23 commented 9 years ago

A large portion of the code originates from yifanlu's Spider3DSTools ARM11-kernel branch, so to be honest I'm not sure what's good in there and what's bad. I might take a look at it and try to get it safer/polished up a bit more though, but the entire repo is a mess in general and could probably do with a good amount of adjustment.