2020-02-25 23:26:38

by Thomas Gleixner

[permalink] [raw]
Subject: [patch 07/24] x86/traps: Prepare for using DEFINE_IDTENTRY

Prepare for using IDTENTRY to define the C exception/trap entry points. It
would be possible to glue this into the existing macro maze, but it's
simpler and better to read at the end to just make them distinct. Provide
a trivial inline helper to read the trap address.

Signed-off-by: Thomas Gleixner <[email protected]>
---
arch/x86/kernel/traps.c | 5 +++++
1 file changed, 5 insertions(+)

--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -274,6 +274,11 @@ static void do_error_trap(struct pt_regs
}
}

+static inline void __user *error_get_trap_addr(struct pt_regs *regs)
+{
+ return (void __user *)uprobe_get_trap_addr(regs);
+}
+
#define IP ((void __user *)uprobe_get_trap_addr(regs))
#define DO_ERROR(trapnr, signr, sicode, addr, str, name) \
dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \


2020-02-28 14:15:15

by Alexandre Chartre

[permalink] [raw]
Subject: Re: [patch 07/24] x86/traps: Prepare for using DEFINE_IDTENTRY


On 2/25/20 11:16 PM, Thomas Gleixner wrote:
> Prepare for using IDTENTRY to define the C exception/trap entry points. It
> would be possible to glue this into the existing macro maze, but it's
> simpler and better to read at the end to just make them distinct. Provide
> a trivial inline helper to read the trap address.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> ---
> arch/x86/kernel/traps.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -274,6 +274,11 @@ static void do_error_trap(struct pt_regs
> }
> }
>
> +static inline void __user *error_get_trap_addr(struct pt_regs *regs)
> +{
> + return (void __user *)uprobe_get_trap_addr(regs);
> +}
> +
> #define IP ((void __user *)uprobe_get_trap_addr(regs))

And you will eventually get rid of this IP macro, right?

Reviewed-by: Alexandre Chartre <[email protected]>

alex.

> #define DO_ERROR(trapnr, signr, sicode, addr, str, name) \
> dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \
>
>

2020-02-28 14:18:56

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [patch 07/24] x86/traps: Prepare for using DEFINE_IDTENTRY

Alexandre Chartre <[email protected]> writes:
> On 2/25/20 11:16 PM, Thomas Gleixner wrote:
>> Prepare for using IDTENTRY to define the C exception/trap entry points. It
>> would be possible to glue this into the existing macro maze, but it's
>> simpler and better to read at the end to just make them distinct. Provide
>> a trivial inline helper to read the trap address.
>>
>> Signed-off-by: Thomas Gleixner <[email protected]>
>> ---
>> arch/x86/kernel/traps.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> --- a/arch/x86/kernel/traps.c
>> +++ b/arch/x86/kernel/traps.c
>> @@ -274,6 +274,11 @@ static void do_error_trap(struct pt_regs
>> }
>> }
>>
>> +static inline void __user *error_get_trap_addr(struct pt_regs *regs)
>> +{
>> + return (void __user *)uprobe_get_trap_addr(regs);
>> +}
>> +
>> #define IP ((void __user *)uprobe_get_trap_addr(regs))
>
> And you will eventually get rid of this IP macro, right?

The whole macro maze will be gone at the end.