Page 1 of 1

strange interrupt problem with bochs?

Posted: Fri Nov 09, 2007 9:50 pm
by jinglexy

Code: Select all

	sti();
	__asm__ __volatile__("ud2a\n\t");
	*(int*)2 = 3;
	CKernel::syshalt();
the "ud2a" can trap into interrupt,
but "*(int*)2 = 3;" can't work?
why it's in bochs?

Re: strange interrupt problem with bochs?

Posted: Sat Nov 10, 2007 3:51 am
by bluecode

Code: Select all

*(int*)2 = 3;
That would only cause a pagefault if the page at virtual address 0 is not mapped or you do not have enough rights to write that page.

Re: strange interrupt problem with bochs?

Posted: Sun Nov 11, 2007 9:24 pm
by jinglexy
bluecode wrote:

Code: Select all

*(int*)2 = 3;
That would only cause a pagefault if the page at virtual address 0 is not mapped or you do not have enough rights to write that page.
hi,
i only mapped 3G~4G virtual address, and alloc 32M for bochs,

Code: Select all

void CTrap::test_trap(UNUSED int n)
{
        *(int *)0x2 = 3;			// failed trap in fault
        *(int *)0x40000020 = 3;		// failed trap in fault

        __asm__ __volatile__("ud2a\n\t");	// success trap in fault
}
 
thanks

Re: strange interrupt problem with bochs?

Posted: Mon Nov 12, 2007 5:59 am
by jinglexy

Code: Select all

void CTrap::test_trap(UNUSED int n)
{
        *(int *)0x2 = 3;			// failed trap in fault
        *(int *)0x40000020 = 3;		// success trap in fault

        __asm__ __volatile__("ud2a\n\t");	// success trap in fault
}
i made a little mistake, address 0x40000020 traps in gear,
all runs ok.
thanks

Posted: Mon Nov 12, 2007 6:16 am
by Combuster
did you forget to unmap the first 4M ? (tlb flushes and all)

Posted: Mon Nov 12, 2007 6:50 pm
by jinglexy
Combuster wrote:did you forget to unmap the first 4M ? (tlb flushes and all)
maybe i forgot, the first 4M memory setup by grub, i just take reference of linux-2.4, and din't see unmap in linux.
kernel only init addresss 3G~3G+memsize , nothing exception