Messages in this thread Patch in this message | | | From | Joe Damato <> | Subject | [PATCH 04/12] x86: Add macros for gate_desc | Date | Fri, 24 Oct 2008 20:15:24 -0700 |
| |
Add useful macros which can be used to access the lo and hi 32bit words, get the offset of the handler, and get the segment for gate_descs.
Signed-off-by: Joe Damato <ice799@gmail.com> --- include/asm-x86/desc_defs.h | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/asm-x86/desc_defs.h b/include/asm-x86/desc_defs.h index 012df1f..d6a5310 100644 --- a/include/asm-x86/desc_defs.h +++ b/include/asm-x86/desc_defs.h @@ -75,8 +75,13 @@ typedef struct ldttss_desc64 tss_desc; typedef struct gate_struct gate_desc; typedef struct desc_struct ldt_desc; typedef struct desc_struct tss_desc; -#define gate_offset(g) (((g).b & 0xffff0000) | ((g).a & 0x0000ffff)) -#define gate_segment(g) ((g).a >> 16) +#define desc_lo(d) (((u32 *)&d)[0]) +#define desc_hi(d) (((u32 *)&d)[1]) +#define gate_offset(g) (((g).base1 << 16) | ((g).base0 & 0x0000ffff)) +#define gate_segment(g) ((g).seg_sel >> 16) +#define ldttss_offset(d) (((d).base2 << 24 ) | ((d).base1 << 16) |\ + ((d).base0 & 0x0000ffff)) +#define ldttss_limit(d) ((d).limit0) #endif struct desc_ptr { -- 1.5.4.3
| |