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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: [email protected], [email protected]

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux