Message ID | 1502222922-25821-3-git-send-email-volodymyr_babchuk@epam.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Volodymyr, On 08/08/17 21:08, Volodymyr Babchuk wrote: > From: Volodymyr Babchuk <vlad.babchuk@gmail.com> > > The following list of functions: > > - advance_pc() > - check_conditional_instr() > - inject_undef_exception() > - inject_iabt_exception() > - inject_dabt_exception() > - inject_vabt_exception() > > are now globaly visible. This change is needed becase we plan to handle SMCs > in different file and handler code needs to alter state of a guest. > > Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> > --- > xen/arch/arm/traps.c | 16 ++++++---------- > xen/include/asm-arm/processor.h | 11 +++++++++++ I would much prefer if you introduce a new header traps.h rather than piggy-back on the now growing processor.h. I have actually a series that will do that, but I am happy if you introduce it before me. Cheers,
Hi Julien, On 09.08.17 12:53, Julien Grall wrote: > Hi Volodymyr, > > On 08/08/17 21:08, Volodymyr Babchuk wrote: >> From: Volodymyr Babchuk <vlad.babchuk@gmail.com> >> >> The following list of functions: >> >> - advance_pc() >> - check_conditional_instr() >> - inject_undef_exception() >> - inject_iabt_exception() >> - inject_dabt_exception() >> - inject_vabt_exception() >> >> are now globaly visible. This change is needed becase we plan to >> handle SMCs >> in different file and handler code needs to alter state of a guest. >> >> Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> >> --- >> xen/arch/arm/traps.c | 16 ++++++---------- >> xen/include/asm-arm/processor.h | 11 +++++++++++ > > I would much prefer if you introduce a new header traps.h rather than > piggy-back on the now growing processor.h. Probably, better idea is to move this functions to processor.c or to newlycreated file like processor_state.c, because actually this functions can have broader use, than traps handling. What do you think? > I have actually a series that will do that, but I am happy if you > introduce it before me. > > Cheers, >
On 09/08/2017 20:26, Volodymyr Babchuk wrote: > Hi Julien, Hi Volodymyr, > > On 09.08.17 12:53, Julien Grall wrote: >> Hi Volodymyr, >> >> On 08/08/17 21:08, Volodymyr Babchuk wrote: >>> From: Volodymyr Babchuk <vlad.babchuk@gmail.com> >>> >>> The following list of functions: >>> >>> - advance_pc() >>> - check_conditional_instr() >>> - inject_undef_exception() >>> - inject_iabt_exception() >>> - inject_dabt_exception() >>> - inject_vabt_exception() >>> >>> are now globaly visible. This change is needed becase we plan to >>> handle SMCs >>> in different file and handler code needs to alter state of a guest. >>> >>> Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> >>> --- >>> xen/arch/arm/traps.c | 16 ++++++---------- >>> xen/include/asm-arm/processor.h | 11 +++++++++++ >> >> I would much prefer if you introduce a new header traps.h rather than >> piggy-back on the now growing processor.h. > Probably, better idea is to move this functions to processor.c or to > newlycreated file like processor_state.c, because actually this > functions can > have broader use, than traps handling. What do you think? processor.c deals with the physical processor whilst those are for the guest. The same for processor_state.c. IHMO, they are fine to stay in traps.c for now as it is dealing with traps. If you really want to move it in the separate file, then please introduce vtraps.c. Cheers,
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index ed78b36..0171c1c 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -616,8 +616,7 @@ static void inject_iabt64_exception(struct cpu_user_regs *regs, #endif -static void inject_undef_exception(struct cpu_user_regs *regs, - const union hsr hsr) +void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr) { if ( is_32bit_domain(current->domain) ) inject_undef32_exception(regs); @@ -627,8 +626,7 @@ static void inject_undef_exception(struct cpu_user_regs *regs, #endif } -static void inject_iabt_exception(struct cpu_user_regs *regs, - register_t addr, +void inject_iabt_exception(struct cpu_user_regs *regs, register_t addr, int instr_len) { if ( is_32bit_domain(current->domain) ) @@ -639,8 +637,7 @@ static void inject_iabt_exception(struct cpu_user_regs *regs, #endif } -static void inject_dabt_exception(struct cpu_user_regs *regs, - register_t addr, +void inject_dabt_exception(struct cpu_user_regs *regs, register_t addr, int instr_len) { if ( is_32bit_domain(current->domain) ) @@ -652,7 +649,7 @@ static void inject_dabt_exception(struct cpu_user_regs *regs, } /* Inject a virtual Abort/SError into the guest. */ -static void inject_vabt_exception(struct cpu_user_regs *regs) +void inject_vabt_exception(struct cpu_user_regs *regs) { const union hsr hsr = { .bits = regs->hsr }; @@ -1706,8 +1703,7 @@ static const unsigned short cc_map[16] = { 0 /* NV */ }; -static int check_conditional_instr(struct cpu_user_regs *regs, - const union hsr hsr) +int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr) { unsigned long cpsr, cpsr_cond; int cond; @@ -1752,7 +1748,7 @@ static int check_conditional_instr(struct cpu_user_regs *regs, return 1; } -static void advance_pc(struct cpu_user_regs *regs, const union hsr hsr) +void advance_pc(struct cpu_user_regs *regs, const union hsr hsr) { unsigned long itbits, cond, cpsr = regs->cpsr; diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index 855ded1..6347048 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -686,6 +686,17 @@ void init_traps(void); void panic_PAR(uint64_t par); +void advance_pc(struct cpu_user_regs *regs, const union hsr hsr); + +int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr); + +void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr); +void inject_iabt_exception(struct cpu_user_regs *regs, register_t addr, + int instr_len); +void inject_dabt_exception(struct cpu_user_regs *regs, register_t addr, + int instr_len); +void inject_vabt_exception(struct cpu_user_regs *regs); + void show_execution_state(struct cpu_user_regs *regs); void show_registers(struct cpu_user_regs *regs); //#define dump_execution_state() run_in_exception_handler(show_execution_state)