Re: [PATCH] x86: Introduce REX prefix helper for kprobes

From: Masami Hiramatsu
Date: Sun Dec 30 2007 - 03:09:23 EST


Hi,

H. Peter Anvin wrote:
>> Could you use a macro same as the stack_addr() macro, like as below?
>>
>> #defile is_REX_prefix(insn) ((insn & 0xf0) == 0x40))
>>
>> This is just a bit checker, so I think a macro is better to do that.
>>
>
> Why is a macro better than an inline, and why the odd mIXed case?

I thought we can use macro because it just check a bit mask.
And if we use this as a macro, it will be defined in #ifdef block at
the top of kprobes.c. It is simple in this case.
I know the inline is better than the macro, it can check the type of
arguments.
If you would like to use inline, how about this?

---
(in case of CONFIG_X86_64)
static inline int is_rex_prefix(int op)
{
return ((op & 0xf0) == 0x40);
}

(in case of CONFIG_X86_32)
#define is_rex_prefix(op) (0)
---

About the name, I just used the previous inline function name.

Thank you,

>
> -hpa

--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@xxxxxxxxxx, masami.hiramatsu.pt@xxxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/