[PATCH 04/12] x86: Add macros for gate_desc

From: Joe Damato
Date: Fri Oct 24 2008 - 23:34:34 EST


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@xxxxxxxxx>
---
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

--
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/