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
#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;
*/
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 );
}
{
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 ++ )
{
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--; ) {
*/
void MM_FinishVirtualInit(void)
{
- #if USE_PAE
- gaInitPDPT[ 0 ] = 0;
- #else
gaInitPageDir[ 0 ] = 0;
- #endif
}
/**
; 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
; 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
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 ---
#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) )
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();
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
"r"(thread->MemState.CR3),
"r"(thread->bInstrTrace&&thread->SavedState.EIP==(Uint)&GetEIP_Sched_ret?0x100:0)
);
- #endif
for(;;); // Shouldn't reach here
}
/**
* \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;
--- /dev/null
+Makefile.i386.cfg
\ No newline at end of file
+++ /dev/null
-Makefile.i386.cfg
\ No newline at end of file
+++ /dev/null
-Makefile.i386.cfg
\ No newline at end of file