Triple fault by Memory Manager of JamesM

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
PHPnerd
Member
Member
Posts: 34
Joined: Mon Nov 05, 2007 11:15 am
Location: The Netherlands
Contact:

Triple fault by Memory Manager of JamesM

Post by PHPnerd »

After i created the memory manager from JamesM tutorials, everything works fine.
Than i did the Multitasker, and now i got a triple fault. I found that he occurs when calling the last switchPageDirectory()
in the init paging code.

Code: Select all

void pagingInit()
{
	u32int memEndPage = 0x1000000;
	
	nframes = memEndPage / 0x1000;
	frames = (u32int*)kmalloc(INDEX_FROM_BIT(nframes));
	memset(frames, 0, INDEX_FROM_BIT(nframes));

u32int phys;
	kernelDirectory = (pageDirectoryT*)kmalloc_a(sizeof(pageDirectoryT));
	memset(kernelDirectory, 0, sizeof(pageDirectoryT));
kernelDirectory->physicalAddr = (u32int)kernelDirectory->tablesPhysical;
//currentDirectory = kernelDirectory;

	int i = 0;
	for(i = KHEAP_START; i < KHEAP_END; i += 0x1000)
		getPage(i, 1, kernelDirectory);

	i = 0;
	while(i < placementAddress+0x1000)
	{
		allocFrame(getPage(i, 1, kernelDirectory),0,0);
		i += 0x1000;
	}

	for(i = KHEAP_START; i < KHEAP_START+KHEAP_INITIAL_SIZE; i += 0x1000)
		allocFrame(getPage(i, 1, kernelDirectory), 0, 0);

	registerInterruptHandler(14, pageFault);

	switchPageDirectory(kernelDirectory);

	kheap = createHeap(KHEAP_START, KHEAP_START+KHEAP_INITIAL_SIZE, 0xCFFFF000,0,0);

currentDirectory = cloneDirectory(kernelDirectory);
switchPageDirectory(currentDirectory); 
/// <------------- HERE OCCURS THE TRIPLE FAULT
}

void switchPageDirectory(pageDirectoryT *dir)
{
	currentDirectory = dir;
	asm volatile("mov %0, %%cr3":: "r"(dir->physicalAddr));
	u32int cr0;
	asm volatile("mov %%cr0, %0": "=r"(cr0));
	cr0 |= 0x80000000;
	asm volatile("mov %0, %%cr0":: "r"(cr0));
}
i have checked all the code of mine MM with the one of JamesM and i haven't found anything.

This is what i get:

Code: Select all

jos@linux01:~/ProjectOS$ ./run_qemu
Could not open '/dev/kqemu' - QEMU acceleration layer not activated: No such file or directory
qemu: fatal: triple fault
EAX=00001000 EBX=0002d000 ECX=0000033f EDX=0010c000
ESI=00053ca2 EDI=00053ca3 EBP=00067e58 ESP=00067e48
EIP=00102b86 EFL=00000202 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0010 00000000 ffffffff 00cf9300
CS =0008 00000000 ffffffff 00cf9a00
SS =0010 00000000 ffffffff 00cf9300
DS =0010 00000000 ffffffff 00cf9300
FS =0010 00000000 ffffffff 00cf9300
GS =0010 00000000 ffffffff 00cf9300
LDT=0000 00000000 0000ffff 00008000
TR =0000 00000000 0000ffff 00008000
GDT=     00107840 00000027
IDT=     00107020 000007ff
CR0=e0000011 CR2=00107060 CR3=00001000 CR4=00000000
CCS=00000010 CCD=00067e48 CCO=SUBL    
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
./run_qemu: line 4:  6486 Aborted                 (core dumped) sudo qemu -L /usr/local/share/qemu -m 32 -fda /dev/loop0 -soundhw all -localtime -boot a
jos@linux01:~/ProjectOS$ 
Can someone help me with solving of my problem?

Thanx in advance.

// PHP
Jinix
User avatar
karloathian
Posts: 22
Joined: Fri Mar 28, 2008 12:09 am

Re: Triple fault by Memory Manager of JamesM

Post by karloathian »

I can't see anything from the current code, but I think you should inspect your "cloneDirectory" code.
PHPnerd
Member
Member
Posts: 34
Joined: Mon Nov 05, 2007 11:15 am
Location: The Netherlands
Contact:

Re: Triple fault by Memory Manager of JamesM

Post by PHPnerd »

checked cloneDirectory again, and the fucntion cloneTabe too, and cloneTablePhysicall too. Found nothing wrong.

All My source is attached.
Last edited by PHPnerd on Fri Aug 15, 2008 12:03 pm, edited 1 time in total.
Jinix
PHPnerd
Member
Member
Posts: 34
Joined: Mon Nov 05, 2007 11:15 am
Location: The Netherlands
Contact:

Re: Triple fault by Memory Manager of JamesM

Post by PHPnerd »

i have found it. i forget a ( and a ) :P in the heap.

// PHP
Jinix
Post Reply