From: John Hodge Date: Mon, 8 Aug 2011 04:40:10 +0000 (+0800) Subject: Kernel/x86 - Removed PAE support X-Git-Tag: rel0.11~159 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=4ed0dbeaa387b3d04e7b2853ceac4e148d0f8ea9;p=tpg%2Facess2.git Kernel/x86 - Removed PAE support --- diff --git a/Kernel/arch/x86/Makefile b/Kernel/arch/x86/Makefile index 6d9d14b9..00a02ac3 100644 --- a/Kernel/arch/x86/Makefile +++ b/Kernel/arch/x86/Makefile @@ -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 diff --git a/Kernel/arch/x86/mm_virt.c b/Kernel/arch/x86/mm_virt.c index 424547ac..69b67194 100644 --- a/Kernel/arch/x86/mm_virt.c +++ b/Kernel/arch/x86/mm_virt.c @@ -16,12 +16,7 @@ #include #include -#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 @@ -61,11 +56,7 @@ #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 } /** diff --git a/Kernel/arch/x86/proc.asm b/Kernel/arch/x86/proc.asm index 944b24dd..f53f11d9 100644 --- a/Kernel/arch/x86/proc.asm +++ b/Kernel/arch/x86/proc.asm @@ -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 diff --git a/Kernel/arch/x86/proc.c b/Kernel/arch/x86/proc.c index 89335291..ceb80ad6 100644 --- a/Kernel/arch/x86/proc.c +++ b/Kernel/arch/x86/proc.c @@ -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 } diff --git a/Kernel/lib.c b/Kernel/lib.c index 83965cc0..a30bdfce 100644 --- a/Kernel/lib.c +++ b/Kernel/lib.c @@ -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 index 00000000..5b8aab70 --- /dev/null +++ b/Makefile.i386-smp.cfg @@ -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 index 5b8aab70..00000000 --- a/Makefile.i486.cfg +++ /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 index 5b8aab70..00000000 --- a/Makefile.i586.cfg +++ /dev/null @@ -1 +0,0 @@ -Makefile.i386.cfg \ No newline at end of file