Changeset 99d6fd0 in mainline for kernel/arch/amd64/include/pm.h
- Timestamp:
- 2009-03-13T12:57:15Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 421c833
- Parents:
- 0160b1c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/pm.h
r0160b1c8 r99d6fd0 27 27 */ 28 28 29 /** @addtogroup amd64 29 /** @addtogroup amd64 30 30 * @{ 31 31 */ … … 37 37 38 38 #ifndef __ASM__ 39 #include <arch/types.h>40 #include <arch/context.h>39 #include <arch/types.h> 40 #include <arch/context.h> 41 41 #endif 42 42 43 #define IDT_ITEMS 6444 #define GDT_ITEMS 843 #define IDT_ITEMS 64 44 #define GDT_ITEMS 8 45 45 46 46 47 #define NULL_DES 0 48 /* Warning: Do not reorder next items, unless you look into syscall.c!!! */ 49 #define KTEXT_DES 1 50 #define KDATA_DES 2 51 #define UDATA_DES 3 52 #define UTEXT_DES 4 53 #define KTEXT32_DES 5 54 /* EndOfWarning */ 55 #define TSS_DES 6 56 57 47 #define NULL_DES 0 48 /* Warning: Do not reorder the following items, unless you look into syscall.c! */ 49 #define KTEXT_DES 1 50 #define KDATA_DES 2 51 #define UDATA_DES 3 52 #define UTEXT_DES 4 53 #define KTEXT32_DES 5 54 /* End of warning */ 55 #define TSS_DES 6 58 56 59 57 #ifdef CONFIG_FB 60 58 61 #define VESA_INIT_DES 8 62 #define VESA_INIT_SEGMENT 0x8000 63 #undef GDT_ITEMS 64 #define GDT_ITEMS 9 59 #define VESA_INIT_DES 8 60 #define VESA_INIT_SEGMENT 0x8000 65 61 66 #endif /*CONFIG_FB*/ 62 #undef GDT_ITEMS 63 #define GDT_ITEMS 9 67 64 65 #endif /* CONFIG_FB */ 68 66 67 #define gdtselector(des) ((des) << 3) 68 #define idtselector(des) ((des) << 4) 69 69 70 #define gdtselector(des) ((des) << 3)71 #define idtselector(des) ((des) << 4)70 #define PL_KERNEL 0 71 #define PL_USER 3 72 72 73 #define PL_KERNEL 0 74 #define PL_USER 3 73 #define AR_PRESENT ( 1 << 7) 74 #define AR_DATA (2 << 3) 75 #define AR_CODE (3 << 3) 76 #define AR_WRITABLE (1 << 1) 77 #define AR_READABLE (1 << 1) 78 #define AR_TSS (0x09) 79 #define AR_INTERRUPT (0x0e) 80 #define AR_TRAP (0x0f) 75 81 76 #define AR_PRESENT (1<<7) 77 #define AR_DATA (2<<3) 78 #define AR_CODE (3<<3) 79 #define AR_WRITABLE (1<<1) 80 #define AR_READABLE (1<<1) 81 #define AR_TSS (0x9) 82 #define AR_INTERRUPT (0xe) 83 #define AR_TRAP (0xf) 82 #define DPL_KERNEL (PL_KERNEL << 5) 83 #define DPL_USER (PL_USER << 5) 84 84 85 #define DPL_KERNEL (PL_KERNEL<<5)86 #define DPL_USER (PL_USER<<5)85 #define TSS_BASIC_SIZE 104 86 #define TSS_IOMAP_SIZE (16 * 1024 + 1) /* 16K for bitmap + 1 terminating byte for convenience */ 87 87 88 #define TSS_BASIC_SIZE 104 89 #define TSS_IOMAP_SIZE (16*1024+1) /* 16K for bitmap + 1 terminating byte for convenience */ 90 91 #define IO_PORTS (64*1024) 88 #define IO_PORTS (64 * 1024) 92 89 93 90 #ifndef __ASM__ 94 91 95 struct descriptor{92 typedef struct { 96 93 unsigned limit_0_15: 16; 97 94 unsigned base_0_15: 16; … … 104 101 unsigned granularity : 1; 105 102 unsigned base_24_31: 8; 106 } __attribute__ ((packed)); 107 typedef struct descriptor descriptor_t; 103 } __attribute__ ((packed)) descriptor_t; 108 104 109 struct tss_descriptor{105 typedef struct { 110 106 unsigned limit_0_15: 16; 111 107 unsigned base_0_15: 16; … … 122 118 unsigned base_32_63 : 32; 123 119 unsigned : 32; 124 } __attribute__ ((packed)); 125 typedef struct tss_descriptor tss_descriptor_t; 120 } __attribute__ ((packed)) tss_descriptor_t; 126 121 127 struct idescriptor{122 typedef struct { 128 123 unsigned offset_0_15: 16; 129 124 unsigned selector: 16; … … 136 131 unsigned offset_32_63: 32; 137 132 unsigned : 32; 138 } __attribute__ ((packed)); 139 typedef struct idescriptor idescriptor_t; 133 } __attribute__ ((packed)) idescriptor_t; 140 134 141 struct ptr_16_64{135 typedef struct { 142 136 uint16_t limit; 143 137 uint64_t base; 144 } __attribute__ ((packed)); 145 typedef struct ptr_16_64 ptr_16_64_t; 138 } __attribute__ ((packed)) ptr_16_64_t; 146 139 147 struct ptr_16_32{140 typedef struct { 148 141 uint16_t limit; 149 142 uint32_t base; 150 } __attribute__ ((packed)); 151 typedef struct ptr_16_32 ptr_16_32_t; 143 } __attribute__ ((packed)) ptr_16_32_t; 152 144 153 struct tss{145 typedef struct { 154 146 uint32_t reserve1; 155 147 uint64_t rsp0; … … 168 160 uint16_t iomap_base; 169 161 uint8_t iomap[TSS_IOMAP_SIZE]; 170 } __attribute__ ((packed)); 171 typedef struct tss tss_t; 162 } __attribute__ ((packed)) tss_t; 172 163 173 164 extern tss_t *tss_p;
Note:
See TracChangeset
for help on using the changeset viewer.