Kernel/x86 - Removed PAE support
authorJohn Hodge <[email protected]>
Mon, 8 Aug 2011 04:40:10 +0000 (12:40 +0800)
committerJohn Hodge <[email protected]>
Mon, 8 Aug 2011 04:40:10 +0000 (12:40 +0800)
Kernel/arch/x86/Makefile
Kernel/arch/x86/mm_virt.c
Kernel/arch/x86/proc.asm
Kernel/arch/x86/proc.c
Kernel/lib.c
Makefile.i386-smp.cfg [new symlink]
Makefile.i486.cfg [deleted symlink]
Makefile.i586.cfg [deleted symlink]

index 6d9d14b..00a02ac 100644 (file)
@@ -10,21 +10,16 @@ CFLAGS              =
 ASFLAGS                = -f elf
 
 USE_MP=0
-USE_PAE=0
 
 ifeq ($(ARCH),i386)
        USE_MP=0
-       USE_PAE=0
-else ifeq ($(ARCH),i486)
+else ifeq ($(ARCH),i386-smp)
        USE_MP=1
-else ifeq ($(ARCH),i586)
-       USE_MP=1
-       USE_PAE=1
 endif
 
 #ASFLAGS               += -D ARCH=\"$(ARCH)\" -D ARCHDIR=\"$(ARCHDIR)\"
-ASFLAGS += -D USE_MP=$(USE_MP) -D USE_PAE=$(USE_PAE)
-CPPFLAGS += -DUSE_MP=$(USE_MP) -DUSE_PAE=$(USE_PAE)
+ASFLAGS += -D USE_MP=$(USE_MP)
+CPPFLAGS += -DUSE_MP=$(USE_MP)
 
 A_OBJ  = start.ao main.o lib.o desctab.ao errors.o irq.o
 A_OBJ += mm_phys.o mm_virt.o
index 424547a..69b6719 100644 (file)
 #include <mm_phys.h>
 #include <proc.h>
 
-#if USE_PAE
-# define TAB   21
-# define DIR   30
-#else
-# define TAB   22
-#endif
+#define TAB    22
 
 #define KERNEL_STACKS          0xF0000000
 #define        KERNEL_STACK_SIZE       0x00008000
 
 #define INVLPG(addr)   __asm__ __volatile__ ("invlpg (%0)"::"r"(addr))
 
-#if USE_PAE
-typedef Uint64 tTabEnt;
-#else
 typedef Uint32 tTabEnt;
-#endif
 
 // === IMPORTS ===
 extern void    _UsertextEnd, _UsertextBase;
@@ -116,11 +107,7 @@ struct sPageInfo {
  */
 void MM_PreinitVirtual(void)
 {
-       #if USE_PAE
-       gaInitPageDir[ ((PAGE_TABLE_ADDR >> TAB)-3*512+3)*2 ] = ((tTabEnt)&gaInitPageDir - KERNEL_BASE) | 3;
-       #else
        gaInitPageDir[ PAGE_TABLE_ADDR >> 22 ] = ((tTabEnt)&gaInitPageDir - KERNEL_BASE) | 3;
-       #endif
        INVLPG( PAGE_TABLE_ADDR );
 }
 
@@ -132,23 +119,6 @@ void MM_InstallVirtual(void)
 {
         int    i;
        
-       #if USE_PAE
-       // --- Pre-Allocate kernel tables
-       for( i = KERNEL_BASE >> TAB; i < 1024*4; i ++ )
-       {
-               if( gaPAE_PageDir[ i ] )        continue;
-               
-               // Skip stack tables, they are process unique
-               if( i > KERNEL_STACKS >> TAB && i < KERNEL_STACKS_END >> TAB) {
-                       gaPAE_PageDir[ i ] = 0;
-                       continue;
-               }
-               // Preallocate table
-               gaPAE_PageDir[ i ] = MM_AllocPhys() | 3;
-               INVLPG( &gaPAE_PageTable[i*512] );
-               memset( &gaPAE_PageTable[i*512], 0, 0x1000 );
-       }
-       #else
        // --- Pre-Allocate kernel tables
        for( i = KERNEL_BASE>>22; i < 1024; i ++ )
        {
@@ -163,7 +133,6 @@ void MM_InstallVirtual(void)
                INVLPG( &gaPageTable[i*1024] );
                memset( &gaPageTable[i*1024], 0, 0x1000 );
        }
-       #endif
        
        // Unset kernel on the User Text pages
        for( i = ((tVAddr)&_UsertextEnd-(tVAddr)&_UsertextBase+0xFFF)/4096; i--; ) {
@@ -176,11 +145,7 @@ void MM_InstallVirtual(void)
  */
 void MM_FinishVirtualInit(void)
 {
-       #if USE_PAE
-       gaInitPDPT[ 0 ] = 0;
-       #else
        gaInitPageDir[ 0 ] = 0;
-       #endif
 }
 
 /**
index 944b24d..f53f11d 100644 (file)
@@ -186,14 +186,10 @@ Proc_ReturnToUser:
        ; Validate user ESP
        ; - Page Table
        mov edx, [eax+KSTACK_USERSTATE_SIZE-12] ; User ESP is at top of kstack - 3*4
-       %if USE_PAE
-       %error PAE Support
-       %else
        mov ecx, edx
        shr ecx, 22
        test BYTE [0xFC3F0000+ecx*4], 1
        jnz .justKillIt
-       %endif
        ; - Page
        mov ecx, edx
        shr ecx, 12
@@ -202,13 +198,10 @@ Proc_ReturnToUser:
        ; Adjust
        sub edx, 8
        ; - Page Table
-       %if USE_PAE
-       %else
        mov ecx, edx
        shr ecx, 22
        test BYTE [0xFC3F0000+ecx*4], 1
        jnz .justKillIt
-       %endif
        ; - Page
        mov ecx, edx
        shr ecx, 12
index 8933529..ceb80ad 100644 (file)
@@ -93,9 +93,6 @@ tTSS  gaTSSs[MAX_CPUS];       // TSS Array
 tThread        *gCurrentThread = NULL;
 tThread        *gpIdleThread = NULL;
 #endif
-#if USE_PAE
-Uint32 *gPML4s[4] = NULL;
-#endif
 tTSS   *gTSSs = NULL;  // Pointer to TSS array
 tTSS   gTSS0 = {0};
 // --- Error Recovery ---
@@ -371,13 +368,7 @@ void ArchThreads_Init(void)
        #endif
        gThreadZero.CurCPU = 0;
        
-       #if USE_PAE
-       gThreadZero.MemState.PDP[0] = 0;
-       gThreadZero.MemState.PDP[1] = 0;
-       gThreadZero.MemState.PDP[2] = 0;
-       #else
        gThreadZero.MemState.CR3 = (Uint)gaInitPageDir - KERNEL_BASE;
-       #endif
        
        // Create Per-Process Data Block
        if( !MM_Allocate(MM_PPD_CFG) )
@@ -591,11 +582,7 @@ int Proc_Clone(Uint *Err, Uint Flags)
                Uint    tmpEbp, oldEsp = esp;
 
                // Set CR3
-               #if USE_PAE
-               # warning "PAE Unimplemented"
-               #else
                newThread->MemState.CR3 = cur->MemState.CR3;
-               #endif
 
                // Create new KStack
                newThread->KernelStack = MM_NewKStack();
@@ -1050,9 +1037,6 @@ void Proc_Scheduler(int CPU)
                Log("%p Scheduled", thread);
        }
        
-       #if USE_PAE
-       # error "Todo: Implement PAE Address space switching"
-       #else
        // Set thread pointer
        __asm__ __volatile__("mov %0, %%db0\n\t" : : "r"(thread) );
        // Switch threads
@@ -1067,7 +1051,6 @@ void Proc_Scheduler(int CPU)
                "r"(thread->MemState.CR3),
                "r"(thread->bInstrTrace&&thread->SavedState.EIP==(Uint)&GetEIP_Sched_ret?0x100:0)
                );
-       #endif
        for(;;);        // Shouldn't reach here
 }
 
index 83965cc..a30bdfc 100644 (file)
@@ -908,7 +908,7 @@ int ModUtil_SetIdent(char *Dest, const char *Value)
 /**
  * \brief Convert a string of hexadecimal digits into a byte stream
  */
-int    UnHex(Uint8 *Dest, size_t DestSize, const char *SourceString)
+int UnHex(Uint8 *Dest, size_t DestSize, const char *SourceString)
 {
         int    i;
        
diff --git a/Makefile.i386-smp.cfg b/Makefile.i386-smp.cfg
new file mode 120000 (symlink)
index 0000000..5b8aab7
--- /dev/null
@@ -0,0 +1 @@
+Makefile.i386.cfg
\ No newline at end of file
diff --git a/Makefile.i486.cfg b/Makefile.i486.cfg
deleted file mode 120000 (symlink)
index 5b8aab7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Makefile.i386.cfg
\ No newline at end of file
diff --git a/Makefile.i586.cfg b/Makefile.i586.cfg
deleted file mode 120000 (symlink)
index 5b8aab7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Makefile.i386.cfg
\ No newline at end of file

UCC git Repository :: git.ucc.asn.au