[PATCH 06/12] x86: Refactor pack_descriptor

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

 



Refactor pack_descriptor to use fields in the struct instead of bitmasks

Signed-off-by: Joe Damato <ice799@xxxxxxxxx>
---
 include/asm-x86/desc.h |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/include/asm-x86/desc.h b/include/asm-x86/desc.h
index 6b4f3e6..ac9aad5 100644
--- a/include/asm-x86/desc.h
+++ b/include/asm-x86/desc.h
@@ -151,11 +151,19 @@ static inline void pack_descriptor(struct desc_struct *desc, unsigned long base,
 				   unsigned long limit, unsigned char type,
 				   unsigned char flags)
 {
-	desc->a = ((base & 0xffff) << 16) | (limit & 0xffff);
-	desc->b = (base & 0xff000000) | ((base & 0xff0000) >> 16) |
-		(limit & 0x000f0000) | ((type & 0xff) << 8) |
-		((flags & 0xf) << 20);
-	desc->p = 1;
+	desc->limit0 = limit & 0xffff;
+	desc->base0  = base  & 0xffff;
+	desc->base1  = (base  >> 16) & 0xff;
+	desc->base2  = (base  >> 24) & 0xff;
+	desc->type   = type;
+	desc->s      = 0;
+	desc->dpl    = 0;
+	desc->p      = 1;
+	desc->limit  = (limit >> 16) & 0xf;
+	desc->avl    = flags & 0x1;
+	desc->l      = (flags & 0x2) >> 1;
+	desc->d      = (flags & 0x4) >> 2;
+	desc->g      = (flags & 0x8) >> 3;
 }
 
 
-- 
1.5.4.3

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

[Index of Archives]     [Linux ia64]     [Linux Kernel]     [DCCP]     [Linux ARM]     [Yosemite News]     [Linux SCSI]     [Linux Hams]
  Powered by Linux