pub const fn pack_desc(base: usize, limit: usize, perm: u8, s_type: u8, privilege: Privilege, present: bool, attrs: u8, granularity: u8) -> Descriptor {
    let mut res: Descriptor = 0x0;
    res = mask_assign(res, limit as u64, 0, 0, 16);
    res = mask_assign(res, base as u64, 16, 0, 24);
    res = mask_assign(res, perm as u64, 40, 0, 4);
    res = mask_assign(res, s_type as u64, 44, 0, 1);
    res = mask_assign(res, privilege as u64, 45, 0, 2);
    res = mask_assign(res, present as u64, 47, 0, 1);
    res = mask_assign(res, limit as u64, 48, 16, 4);
    res = mask_assign(res, attrs as u64, 52, 0, 3);
    res = mask_assign(res, granularity as u64, 55, 0, 1);
    res = mask_assign(res, base as u64, 56, 24, 8);
    res
}
/// Pack data in parameter to a valid GDT entry.
/// A GDT entry can be represented as a 64 bit value, whose fields are defined as follows:
///
/// ```text
/// | 0:16  | limit[0:16]     | segment size limit          |
/// | 16:32 | base[0:16]      | segment base address        |
/// | 32:40 | base[16:24]     |                             |
/// | 40:44 | type[0:4]       | segment type and attributes |
/// | 44:45 | s[0:1]          | system or data/code segment |
/// | 45:47 | privilege[0:2]  | DPL, 0 = Kernel, 3 = User   |
/// | 47:48 | present[0:1]    | 1 = enable segment          |
/// | 48:52 | limit[16:20]    |                             |
/// | 52:55 | attributes[0:3] | segment attributes          |
/// | 55:56 | granularity     | alignment                   |
/// | 56:64 | base[24:32]     |                             |
/// ```
///
/// For the type field, see *Intel Developer Manual 3-12 Vol.3A Table 3-1*:
/// | 11 | 10 |  9 |  8 |
/// |  D |  E |  W |  A |
/// |  C |  C |  R |  A |
///
/// For the s field: clear if this is a system segment, set if this is a code/data segment 
/// 
/// For the DPL field: Descriptor privilege level. Determines the 
/// privilege level of this resource.
///  
/// - For a data segment / TSS / Call Gate, only task with 
/// CPL <= DPL (higher privilege) can be allowed to access this resource.
/// - For a nonconforming code segment (without using a call gate), only
/// task with CPL == DPL can access this segment (with selector RPL <= DPL).
/// - For a conforming code segment (or nonconforming code segment accessed 
/// with call gate), only task with CPL >= DPL (lower privilege) can access
/// this segment (selector RPL is not checked).
/// 
/// For the attributes field: 
///
/// - 0: Available to System Programmers flag, reserved
/// - 1: 64-bit code segment
/// - 2: size bit, set if our code is 32-bit, 16-bit vice versa
///
/// For granularity, CPU will multiply our limit by 4KB if this bit is set.
Pack data in parameter to a valid GDT entry.
A GDT entry can be represented as a 64 bit value, whose fields are defined as follows.





For the s field: clear if this is a system segment, set if this is a code/data segment

For the DPL field: Descriptor privilege level. Determines the
privilege level of this resource.

For a data segment / TSS / Call Gate, only task with
CPL <= DPL (higher privilege) can be allowed to access this resource.
For a nonconforming code segment (without using a call gate), only
task with CPL == DPL can access this segment (with selector RPL <= DPL).
For a conforming code segment (or nonconforming code segment accessed
with call gate), only task with CPL >= DPL (lower privilege) can access
this segment (selector RPL is not checked).

For the attributes field.

Available to System Programmers flag, reserved
1: 64-bit code segment
2: size bit, set if our code is 32-bit, 16-bit vice versa

For granularity, CPU will multiply our limit by 4KB if this bit is set.
Pack data in parameter to a valid GDT entry . A GDT entry can be represented as a 64 bit value whose fields are defined as follows . For the s field : clear if this is a system segment set if this is a code / data segment For the DPL field : Descriptor privilege level . Determines the privilege level of this resource . For a data segment / TSS / Call Gate only task with CPL < = DPL ( higher privilege ) can be allowed to access this resource . For a nonconforming code segment ( without using a call gate ) only task with CPL == DPL can access this segment ( with selector RPL < = DPL ) . For a conforming code segment ( or nonconforming code segment accessed with call gate ) only task with CPL > = DPL ( lower privilege ) can access this segment ( selector RPL is not checked ) . For the attributes field . Available to System Programmers flag reserved 1 : 64 - bit code segment 2 : size bit set if our code is 32 - bit 16 - bit vice versa For granularity CPU will multiply our limit by 4KB if this bit is set .
pub const fn pack_desc(base: usize, limit: usize, perm: u8, s_type: u8, privilege: Privilege, present: bool, attrs: u8, granularity: u8) -> Descriptor {
    let mut res: Descriptor = 0x0;
    res = mask_assign(res, limit as u64, 0, 0, 16);
    res = mask_assign(res, base as u64, 16, 0, 24);
    res = mask_assign(res, perm as u64, 40, 0, 4);
    res = mask_assign(res, s_type as u64, 44, 0, 1);
    res = mask_assign(res, privilege as u64, 45, 0, 2);
    res = mask_assign(res, present as u64, 47, 0, 1);
    res = mask_assign(res, limit as u64, 48, 16, 4);
    res = mask_assign(res, attrs as u64, 52, 0, 3);
    res = mask_assign(res, granularity as u64, 55, 0, 1);
    res = mask_assign(res, base as u64, 56, 24, 8);
    res
}
pub const fn pack_desc ( base : usize , limit : usize , perm : u8 , s_type : u8 , privilege : Privilege , present : bool , attrs : u8 , granularity : u8 ) -> Descriptor { let mut res : Descriptor = 0x0 ; res = mask_assign ( res , limit as u64 , 0 , 0 , 16 ) ; res = mask_assign ( res , base as u64 , 16 , 0 , 24 ) ; res = mask_assign ( res , perm as u64 , 40 , 0 , 4 ) ; res = mask_assign ( res , s_type as u64 , 44 , 0 , 1 ) ; res = mask_assign ( res , privilege as u64 , 45 , 0 , 2 ) ; res = mask_assign ( res , present as u64 , 47 , 0 , 1 ) ; res = mask_assign ( res , limit as u64 , 48 , 16 , 4 ) ; res = mask_assign ( res , attrs as u64 , 52 , 0 , 3 ) ; res = mask_assign ( res , granularity as u64 , 55 , 0 , 1 ) ; res = mask_assign ( res , base as u64 , 56 , 24 , 8 ) ; res }
Pack data in parameter to a valid GDT entry.
Pack data in parameter to a valid GDT entry .
base
usize
limit
usize
perm
u8
s_type
u8
privilege
Privilege
present
bool
attrs
u8
granularity
u8