[seL4] fault processing

2024-01-26 Thread Leonid Meyerovich
I am working on fault processing.
When I am a fault I am calling
void sel4utils_print_fault_message(seL4_MessageInfo_t tag, const char
*thread_name) from sel4libsutils library
I have tested it for "page fault" condition and it works fine - I am
getting seL4_Fault_VMFault fault type

But in certain case I have got seL4_Fault_VCPUFault type, which is not
implemented sel4libsutils library

I try to process this fault similar to seL4_Fault_VMFault to get all
neccessary registers, but
the kernel does not have functions like seL4_Fault_VCPUFault_get_IP.

What is the message format for VCPU fault?
Thanks
___
Devel mailing list -- devel@sel4.systems
To unsubscribe send an email to devel-leave@sel4.systems


[seL4] Fwd: fault processing

2024-01-26 Thread Leonid Meyerovich
Just some addition: I have found function
seL4_Fault_VCPUFault_get_HSR(seL4_Fault_t seL4_Fault)
It gives me the value of HSR register, but how can I get fault address and
some other (if exist) information?

Thanks,

-- Forwarded message -
From: Leonid Meyerovich 
Date: Fri, Jan 26, 2024 at 11:35 AM
Subject: fault processing
To: 


I am working on fault processing.
When I am a fault I am calling
void sel4utils_print_fault_message(seL4_MessageInfo_t tag, const char
*thread_name) from sel4libsutils library
I have tested it for "page fault" condition and it works fine - I am
getting seL4_Fault_VMFault fault type

But in certain case I have got seL4_Fault_VCPUFault type, which is not
implemented sel4libsutils library

I try to process this fault similar to seL4_Fault_VMFault to get all
neccessary registers, but
the kernel does not have functions like seL4_Fault_VCPUFault_get_IP.

What is the message format for VCPU fault?
Thanks
___
Devel mailing list -- devel@sel4.systems
To unsubscribe send an email to devel-leave@sel4.systems


[seL4] Fwd: fault processing

2024-01-26 Thread Leonid Meyerovich
Even some more information:

These is a function
word_t Arch_setMRs_fault(tcb_t *sender, tcb_t *receiver, word_t
*receiveIPCBuffer, word_t faultType)
which populate a message and send it to fault handler.
In this function
   case seL4_Fault_VCPUFault:
return setMR(receiver, receiveIPCBuffer, seL4_VCPUFault_HSR,
seL4_Fault_VCPUFault_get_hsr(sender->tcbFault));
This is only information that sent to fault handler, but
for seL4_Fault_VMFault it provides nuch more

  case seL4_Fault_VMFault: {
if (config_set(CONFIG_ARM_HYPERVISOR_SUPPORT)) {
word_t ipa, va;
va = getRestartPC(sender);
ipa = (addressTranslateS1CPR(va) & ~MASK(PAGE_BITS)) | (va &
MASK(PAGE_BITS));
setMR(receiver, receiveIPCBuffer, seL4_VMFault_IP, ipa);



Just some addition: I have found function
seL4_Fault_VCPUFault_get_HSR(seL4_Fault_t seL4_Fault)
It gives me the value of HSR register, but how can I get fault address and
some other (if exist) information?

Thanks,

-- Forwarded message -
From: Leonid Meyerovich 
Date: Fri, Jan 26, 2024 at 11:35 AM
Subject: fault processing
To: 


I am working on fault processing.
When I am a fault I am calling
void sel4utils_print_fault_message(seL4_MessageInfo_t tag, const char
*thread_name) from sel4libsutils library
I have tested it for "page fault" condition and it works fine - I am
getting seL4_Fault_VMFault fault type

But in certain case I have got seL4_Fault_VCPUFault type, which is not
implemented sel4libsutils library

I try to process this fault similar to seL4_Fault_VMFault to get all
neccessary registers, but
the kernel does not have functions like seL4_Fault_VCPUFault_get_IP.

What is the message format for VCPU fault?
Thanks
___
Devel mailing list -- devel@sel4.systems
To unsubscribe send an email to devel-leave@sel4.systems


[seL4] Re: fault processing

2024-01-26 Thread Indan Zupancic

Hello Leonid,

On 2024-01-26 16:35, Leonid Meyerovich wrote:

But in certain case I have got seL4_Fault_VCPUFault type,
which is not implemented sel4libsutils library

I try to process this fault similar to seL4_Fault_VMFault to get all
neccessary registers, but
the kernel does not have functions like seL4_Fault_VCPUFault_get_IP.


For virtualisation some things are implemented as VCPU faults even
when it are not real faults, the VMM (virtual machine monitor) is
expected to know how to handle them. For a vmm implementation, have
a look at:

https://github.com/seL4/seL4_projects_libs/tree/master/libsel4vm

The VCPU code is very platform specific.

To read the VCPU's registers you can always use seL4_ARM_VCPU_ReadRegs()
or seL4_TCB_ReadRegisters().

For some more information, see this old thread:

https://lists.sel4.systems/hyperkitty/list/devel@sel4.systems/thread/WFDO4Y7UZ3EOYRZMKQ7S35Y44LBHPVFG/

Good luck,

Indan
___
Devel mailing list -- devel@sel4.systems
To unsubscribe send an email to devel-leave@sel4.systems