Adding a Kernel Module in base-hw

Martin Stein martin.stein at ...1...
Tue Apr 21 09:45:04 CEST 2015

Hi Franc,

On 16.04.2015 14:11, Franc sylvester wrote:
> Currently, I am working on i.MX6 board. I just want to create a function
> like dump() in tz_vmm as in another application which will print the
> state of the system without using  vmm. 
> I tried to use cpu_sate.h in my application but when i tried to read the
> register r0 like vm_base.h it gives me the page fault error.

Just to avoid misconceptions: The 'Vm_base' you mention above is a
kernel object that stores the state of a VM subject. That said, this
state information can be read-out only in the kernel and shows the state
of a VM at the point in time it trapped into the kernel. It can't be
read from any user application and shouldn't be read from core without
special care.

Back to dump(). First of all, we need to know where exactly you are. Do
you want to dump inside the kernel, core, or a user application? To
determine that, it would be best if you send the source file and
function you're in when calling dump().

Second, I'm not sure whose state do you want to print. If you like to,
e.g., print R0 of the active CPU state, you don't have to read any state
object. You can use inline assembly in this case (take care that the R0
state that you want to read isn't polluted by the compiler meanwhile).
If you like to print the R0 state of any user thread from the point in
time it entered the kernel lastly, you would have to be inside the
kernel, lookup the appropriate 'Kernel::Thread' object, and print its
member variable 'r0'.


More information about the users mailing list