lkml.org 
[lkml]   [2022]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/4] LoongArch: Add prologue unwinder support
Hi, Youling,

On Tue, Aug 2, 2022 at 9:30 AM Youling Tang <tangyouling@loongson.cn> wrote:
>
>
>
> On 08/01/2022 11:26 PM, Huacai Chen wrote:
> >> diff --git a/arch/loongarch/include/asm/unwind.h b/arch/loongarch/include/asm/unwind.h
> >> index 243330b39d0d..f9f73a26504e 100644
> >> --- a/arch/loongarch/include/asm/unwind.h
> >> +++ b/arch/loongarch/include/asm/unwind.h
> >> @@ -14,6 +14,14 @@
> >> struct unwind_state {
> >> struct stack_info stack_info;
> >> struct task_struct *task;
> >> +#if defined(CONFIG_UNWINDER_PROLOGUE)
> >> + unsigned long ra;
> >> + bool enable;
> >> + /*
> >> + * Enable is the prologue analysis method
> >> + * otherwise is the way to guess.
> >> + */
> >> +#endif
> >> unsigned long sp, pc;
> >> bool first;
> >> bool error;
> > This data struct makes me very uncomfortable, especially "enable" and
> > the #ifdef, maybe we can rework it like this?
> >
> > #define UNWINDER_GUESS 0
> > #define UNWINDER_PROLOGURE 1
>
> Maybe it's better to define with enum type?
> enum unwind_type {
> UNWINDER_GUESS,
> UNWINDER_PROLOGURE,
> };
Both macro and enum are acceptable, but enum is essentially "int",
while the "type" member is "char" here.

Huacai
>
> Youling
>
> > struct unwind_state {
> > char type; /* UNWINDER_xxx */
> > bool first, error;
> > unsigned long sp, pc, ra;
> > struct task_struct *task;
> > struct stack_info stack_info;
> > };
> >
> > Huacai
>
>

\
 
 \ /
  Last update: 2022-08-02 03:35    [W:0.081 / U:0.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site