Skip to content

Commit 210a0f0

Browse files
committed
Remove unused flags (thanks Wolfgang Keller)
1 parent b2ca8e3 commit 210a0f0

File tree

2 files changed

+4
-50
lines changed

2 files changed

+4
-50
lines changed

asm.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@
1414
(0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff)
1515

1616
#define STA_X 0x8 // Executable segment
17-
#define STA_E 0x4 // Expand down (non-executable segments)
18-
#define STA_C 0x4 // Conforming code segment (executable only)
1917
#define STA_W 0x2 // Writeable (non-executable segments)
2018
#define STA_R 0x2 // Readable (executable segments)
21-
#define STA_A 0x1 // Accessed

mmu.h

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,11 @@
22
// x86 memory management unit (MMU).
33

44
// Eflags register
5-
#define FL_CF 0x00000001 // Carry Flag
6-
#define FL_PF 0x00000004 // Parity Flag
7-
#define FL_AF 0x00000010 // Auxiliary carry Flag
8-
#define FL_ZF 0x00000040 // Zero Flag
9-
#define FL_SF 0x00000080 // Sign Flag
10-
#define FL_TF 0x00000100 // Trap Flag
115
#define FL_IF 0x00000200 // Interrupt Enable
12-
#define FL_DF 0x00000400 // Direction Flag
13-
#define FL_OF 0x00000800 // Overflow Flag
14-
#define FL_IOPL_MASK 0x00003000 // I/O Privilege Level bitmask
15-
#define FL_IOPL_0 0x00000000 // IOPL == 0
16-
#define FL_IOPL_1 0x00001000 // IOPL == 1
17-
#define FL_IOPL_2 0x00002000 // IOPL == 2
18-
#define FL_IOPL_3 0x00003000 // IOPL == 3
19-
#define FL_NT 0x00004000 // Nested Task
20-
#define FL_RF 0x00010000 // Resume Flag
21-
#define FL_VM 0x00020000 // Virtual 8086 mode
22-
#define FL_AC 0x00040000 // Alignment Check
23-
#define FL_VIF 0x00080000 // Virtual Interrupt Flag
24-
#define FL_VIP 0x00100000 // Virtual Interrupt Pending
25-
#define FL_ID 0x00200000 // ID flag
266

277
// Control Register flags
288
#define CR0_PE 0x00000001 // Protection Enable
29-
#define CR0_MP 0x00000002 // Monitor coProcessor
30-
#define CR0_EM 0x00000004 // Emulation
31-
#define CR0_TS 0x00000008 // Task Switched
32-
#define CR0_ET 0x00000010 // Extension Type
33-
#define CR0_NE 0x00000020 // Numeric Errror
349
#define CR0_WP 0x00010000 // Write Protect
35-
#define CR0_AM 0x00040000 // Alignment Mask
36-
#define CR0_NW 0x20000000 // Not Writethrough
37-
#define CR0_CD 0x40000000 // Cache Disable
3810
#define CR0_PG 0x80000000 // Paging
3911

4012
#define CR4_PSE 0x00000010 // Page size extension
@@ -82,23 +54,11 @@ struct segdesc {
8254

8355
// Application segment type bits
8456
#define STA_X 0x8 // Executable segment
85-
#define STA_E 0x4 // Expand down (non-executable segments)
86-
#define STA_C 0x4 // Conforming code segment (executable only)
8757
#define STA_W 0x2 // Writeable (non-executable segments)
8858
#define STA_R 0x2 // Readable (executable segments)
89-
#define STA_A 0x1 // Accessed
9059

9160
// System segment type bits
92-
#define STS_T16A 0x1 // Available 16-bit TSS
93-
#define STS_LDT 0x2 // Local Descriptor Table
94-
#define STS_T16B 0x3 // Busy 16-bit TSS
95-
#define STS_CG16 0x4 // 16-bit Call Gate
96-
#define STS_TG 0x5 // Task Gate / Coum Transmitions
97-
#define STS_IG16 0x6 // 16-bit Interrupt Gate
98-
#define STS_TG16 0x7 // 16-bit Trap Gate
9961
#define STS_T32A 0x9 // Available 32-bit TSS
100-
#define STS_T32B 0xB // Busy 32-bit TSS
101-
#define STS_CG32 0xC // 32-bit Call Gate
10262
#define STS_IG32 0xE // 32-bit Interrupt Gate
10363
#define STS_TG32 0xF // 32-bit Trap Gate
10464

@@ -124,7 +84,6 @@ struct segdesc {
12484
#define NPTENTRIES 1024 // # PTEs per page table
12585
#define PGSIZE 4096 // bytes mapped by a page
12686

127-
#define PGSHIFT 12 // log2(PGSIZE)
12887
#define PTXSHIFT 12 // offset of PTX in a linear address
12988
#define PDXSHIFT 22 // offset of PDX in a linear address
13089

@@ -135,12 +94,7 @@ struct segdesc {
13594
#define PTE_P 0x001 // Present
13695
#define PTE_W 0x002 // Writeable
13796
#define PTE_U 0x004 // User
138-
#define PTE_PWT 0x008 // Write-Through
139-
#define PTE_PCD 0x010 // Cache-Disable
140-
#define PTE_A 0x020 // Accessed
141-
#define PTE_D 0x040 // Dirty
14297
#define PTE_PS 0x080 // Page Size
143-
#define PTE_MBZ 0x180 // Bits must be zero
14498

14599
// Address in page table or page directory entry
146100
#define PTE_ADDR(pte) ((uint)(pte) & ~0xFFF)
@@ -197,7 +151,7 @@ struct gatedesc {
197151
uint cs : 16; // code segment selector
198152
uint args : 5; // # args, 0 for interrupt/trap gates
199153
uint rsv1 : 3; // reserved(should be zero I guess)
200-
uint type : 4; // type(STS_{TG,IG32,TG32})
154+
uint type : 4; // type(STS_{IG32,TG32})
201155
uint s : 1; // must be 0 (system)
202156
uint dpl : 2; // descriptor(meaning new) privilege level
203157
uint p : 1; // Present
@@ -226,3 +180,6 @@ struct gatedesc {
226180
}
227181

228182
#endif
183+
184+
//PAGEBREAK!
185+
// Blank page.

0 commit comments

Comments
 (0)