idea to use MPU belongs to Cail

>> 2: How to re-gain control when the live OS is running.
>i think CHDK can't start thread in startup code. why would CHDK need taskcreatehookadd then instead of simply >launching its own thread?
>why to substitute some thread using hooks instead of killing some thread latter and launching new one own?
I'm not sure whether CHDK can start thread in startup mode or not. However, using taskCreateHookAdd is the most natrual way in my eyes, because you don't want to start both yours and original. Killing a running task may cause unexpected behaviour of the OS, for example, resource leakage. Also, some of the tasks like "captive" task, may start by the OS for multiple times. Hooking is the way to change the behaviour.
>it seems it needs some investigation but I think your way to launch code is far more complicated than using MPU.
I agree, my way is by far complicated, the good point is that it is more reliable.
> use cpu's memory protection unit, I think this is like gamble
>yes . it is.
>first we need to guess right memory location which is not critical for running OS
>there is a big buffer which is used for shoots. it can be used for first stage startup procedure.
>after OS starts we can use memAlloc to relocate our code to safe place
>anyway we do not need to know exact address of this buffer. we can make one base binary file and patch it so it would >use any address we chose. one of them will work.
I still don't quite understand how can you gain control after the OS is running. can you explain a little? I understand you can use MPU to protect the dumper not to be overwritten by the OS. but that doesn't mean OS will give you execution time.
>I don't know English enough to express my ideas quickly. it takes alot of my time to to make translation.
>i think I will make little posts periodicaly instead of one huge
It doesn't matter, I'm not a English speaking person, either.

>Best regards,
>max