Na hallo wieder einmal
ich habe immer noch probleme mit meinem paging code...
mein pc / emulator startet immer wieder neu. hat jemand eine ahnung? nach der letzten zeile in SetupPaging() startet er neu...
/*
;
;---------------------------------------------------------------+
; .__ __ ¦
;______ |__|___________ _/ |_ ____ ______ ¦
;\____ \| \_ __ \__ \\ __\ ______ / _ \/ ___/ ¦
;| |_> > || | \// __ \| | /_____/ ( <_> )___ \ ¦
;| __/|__||__| (____ /__| \____/____ > ¦
;|__| \/ \/ ¦
;---------------------------------------------------------------+
;
;[1] Informations
;
; Last Modified: 21. Oktober 2004
; Begin: 15. Juni 2004
; Version: 0.000
; Coder: z4ck
;
;
;[2] Tasks
;
; Task Done Coder
;----------------------------------------------------------------
; - [ 0%] z4ck
;----------------------------------------------------------------
; TOTAL [ 0%] z4ck
;================================================================
*/
#include <memory.h>
#include <io.h>
/***************************************/
//Global Variables
PageDir *PageDirectory;
PageTbl *PageTable;
void SetupPaging()
{
PageDirectory = (PageDir *) 0x100000;
PageTable = (PageTbl *) 0x101000;
unsigned long i = 0;
for (; i < 1024; i++)
{
PageDirectory[i].PageTable = (PageTbl *)((unsigned long)&PageTable[i] | PAGE_RW | PAGE_PRE);
}
MapMemory ( 0, 0, 1024 * 4, PAGE_RW | PAGE_PRE);
WriteCr( (int)PageDirectory, 3);
WriteCr( (ReadCr(0) | 0x80000000) , 0);
};
int SetPage ( unsigned long _phyAdress, unsigned long _vAdress, unsigned long _opt)
{
unsigned long table = _vAdress >> 22;
unsigned long entry = ( (_vAdress & 0xFFFFF000) << 10) >> 22;
if (table < 1024 && entry < 1024)
{
PageDirectory[table].PageTable->PageFrame[entry] = _phyAdress | _opt;
return 1;
}
return 0;
};
int MapMemory ( unsigned long _phyAdress, unsigned long _vAdress, unsigned long _lenght, unsigned long _opt)
{
while (_lenght > 0)
{
SetPage (_phyAdress, _vAdress, _opt);
_vAdress += 4096;
_phyAdress += 4096;
_lenght--;
}
return 0;
};
void *malloc(unsigned long _size)
{
return (void *) 0;
};
void free()
{
};
void memcpy(unsigned *_dest, unsigned *_src, unsigned long _lenght)
{
unsigned long i = 0;
for (; i < _lenght; i++)
_dest[i] = _src[i];
};