Преглед изворни кода

9.399u-arch: fix bug about paging on x86

rain пре 5 година
родитељ
комит
eb40e1c792
5 измењених фајлова са 23 додато и 11 уклоњено
  1. 1 0
      LINES
  2. 6 1
      README.md
  3. 3 3
      boot/loader.asm
  4. 6 4
      include/arch/x86/paging.h
  5. 7 3
      include/boot/paging.asm

+ 1 - 0
LINES

@@ -47,4 +47,5 @@
 2021-8-24 9.707: 9707 lines, 65 files, rain
 2021-8-24 9.765: 9765 lines, 65 files, rain
 2021-8-26 9.393: 9393 lines, 64 files, rain
+2021-9-18 9.399: 9399 lines, 64 files, rain
 

+ 6 - 1
README.md

@@ -6,7 +6,7 @@ XNIX is a UNIX-like operating system uses the GPLv3 license. It is a free and op
 source software, you can get its source code from <https://gitee.com/pengruiyang-cpu/xnix>. 
 
 
-### Changes
+### Change Log 
 
 0.066u-boot:  
 &nbsp;&nbsp;&nbsp;&nbsp;upload `boot.asm` -- it puts 'Loading System' on screen, and die. <br/>
@@ -187,3 +187,8 @@ source software, you can get its source code from <https://gitee.com/pengruiyang
 9.590u-init:  
 &nbsp;&nbsp;&nbsp;&nbsp;we now removed all schk. 
 
+9.399u-arch:  
+&nbsp;&nbsp;&nbsp;&nbsp;there's a big problem: it exists when this project creates :-). the 
+&nbsp;&nbsp;&nbsp;&nbsp;the macros in /include/arch/x86/paging.h and /include/boot/paging.asm 
+&nbsp;&nbsp;&nbsp;&nbsp;are WRONG. :-(
+ 

+ 3 - 3
boot/loader.asm

@@ -484,15 +484,15 @@ init_prot:
 .init_paging:
 	; we set page map at 0x00000000 (a good address)
 
-	mov dword [0x00000000], 0x00001000 | PAGE_USER
+	mov dword [0x00000000], 0x00001000 | PAGE_DIR
 ;	mov dword [0x00000004], 0x00000000
 
-	mov dword [0x00000800], 0x00001000 | PAGE_USER
+	mov dword [0x00000800], 0x00001000 | PAGE_DIR
 ;	mov dword [0x00000804], 0x00000000
 
 	; and page directory pointer table
 
-	mov dword [0x00001000], 0x00002000 | PAGE_USER
+	mov dword [0x00001000], 0x00002000 | PAGE_DIR
 ;	mov dword [0x00001004], 0x00000000
 
 	; page directory entry (2 MB)

+ 6 - 4
include/arch/x86/paging.h

@@ -41,18 +41,20 @@
 
 #define PAGE_DIRTY    	0x0040
 
-#define PAGE_PAT      	0x0080
+#define PAGE_BIGPAGE  	0x0080
 
 #define PAGE_GLOBAL   	0x0100
 
+#define PAGE_PAT 	0x1000
+
 
 /* 0x83 */
-#define PATT_KERNEL 	(PAGE_PRESENT | PAGE_RDWR | PAGE_PAT)
+#define PATT_KERNEL 	(PAGE_PRESENT | PAGE_RDWR | PAGE_BIGPAGE)
 
 /* 0x07 */
-#define PATT_USER 	(PAGE_PRESENT | PAGE_RDWR | PAGE_USER | PAGE_PAT)
+#define PATT_USER 	(PAGE_PRESENT | PAGE_RDWR | PAGE_USER | PAGE_BIGPAGE)
 
-#define PATT_DEVMM 	(PAGE_PRESENT | PAGE_RDWR | PAGE_WTHROUGH | PAGE_CACHEDIS | PAGE_PAT)
+#define PATT_DEVMM 	(PAGE_PRESENT | PAGE_RDWR | PAGE_WTHROUGH | PAGE_CACHEDIS | PAGE_BIGPAGE)
 
 #define PAGE_TABLE_BASE 0
 

+ 7 - 3
include/boot/paging.asm

@@ -24,12 +24,16 @@ PATT_CACHEMEM	equ 0x0008
 PATT_NOCACHE	equ 0x0010
 PATT_ACCESSED	equ 0x0020
 PATT_DIRTY	equ 0x0040
-PATT_PAT	equ 0x0080
+PATT_BIGPAGE	equ 0x0080
 PATT_GLOBAL	equ 0x0100
+PATT_PAT 	equ 0x1000
 
 ; 0x83 it is. 
-PAGE_KERNEL	equ PATT_PRESENT + PATT_RDWR + PATT_PAT
+PAGE_KERNEL	equ PATT_PRESENT + PATT_RDWR + PATT_BIGPAGE
 
 ; this is linux's 007. (8-based 007)
-PAGE_USER	equ PATT_PRESENT + PATT_RDWR + PATT_USER
+PAGE_USER	equ PATT_PRESENT + PATT_RDWR + PATT_USER + PATT_BIGPAGE
+
+; yeah, I lost this so will error in loader. :-(
+PAGE_DIR 	equ PATT_PRESENT + PATT_RDWR + PATT_USER