When interrput occurred,it will reboot.
Posted: Wed Nov 04, 2015 6:41 am
If I changed page directory ,when interrupt occurred. It will reboot. I have no idea about what is going on.
But If I don't execute '__asm __volatile("sti")',everything will be ok.
And If I don't change page directory and execute '__asm __volatile("sti")',interrupt works very well.
But If I don't execute '__asm __volatile("sti")',everything will be ok.
And If I don't change page directory and execute '__asm __volatile("sti")',interrupt works very well.
Code: Select all
f01000bf <os_init_main>:
f01000bf: 55 push %ebp
f01000c0: 89 e5 mov %esp,%ebp
f01000c2: 83 ec 28 sub $0x28,%esp
f01000c5: 81 7d 0c 02 b0 ad 2b cmpl $0x2badb002,0xc(%ebp)
f01000cc: 74 02 je f01000d0 <os_init_main+0x11>
f01000ce: eb 5a jmp f010012a <os_init_main+0x6b>
f01000d0: ba c0 b2 2f f1 mov $0xf12fb2c0,%edx
f01000d5: b8 00 94 11 f0 mov $0xf0119400,%eax
f01000da: 29 c2 sub %eax,%edx
f01000dc: 89 d0 mov %edx,%eax
f01000de: 89 44 24 08 mov %eax,0x8(%esp)
f01000e2: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
f01000e9: 00
f01000ea: c7 04 24 00 94 11 f0 movl $0xf0119400,(%esp)
f01000f1: e8 1e 09 00 00 call f0100a14 <memset>
f01000f6: 8b 45 08 mov 0x8(%ebp),%eax
f01000f9: a3 bc 94 2f f1 mov %eax,0xf12f94bc
f01000fe: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
f0100102: 75 02 jne f0100106 <os_init_main+0x47>
f0100104: eb 24 jmp f010012a <os_init_main+0x6b>
f0100106: e8 b2 46 00 00 call f01047bd <init_console>
f010010b: e8 e4 44 00 00 call f01045f4 <init_mem>
f0100110: e8 5e 55 00 00 call f0105673 <init_trap>
f0100115: e8 0c 52 00 00 call f0105326 <init_8259A>
f010011a: e8 aa 54 00 00 call f01055c9 <timerinit>
f010011f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
f0100126: cd 20 int $0x20
f0100128: eb fe jmp f0100128 <os_init_main+0x69>
f010012a: c9 leave
f010012b: c3 ret
Code: Select all
void os_init_main(multiboot_info_t* m,unsigned int magic)
{
extern char _bss_start[],_bss_end[];
if(magic != 0x2BADB002)
return;
memset(_bss_start,0,_bss_end - _bss_start);
mbd = m;
if(m == NULL)
return;
init_console();
init_mem();
init_trap();
init_8259A();
timerinit();
//disable_8259A_irq(IRQ2_VECTOR);
//enable_8259A_irq(IRQ1_VECTOR);
//enable_8259A_irq(IRQ0_VECTOR);
unsigned long i = 0;
//__asm __volatile("sti");
__asm __volatile("int $32");
/*
for(i;;i++)
{
__asm __volatile("cli");
cprintf("pconpcon->buffer1[pcon->last_char++] = c;->buffer1[pcon->last_char++] = c;->%d \n",i);
__asm __volatile("sti");
//cons_flush(tty->p_console);
}
*/
while(1);
}
}
Code: Select all
<bochs:1> b 0x100126
<bochs:2> c
00000004000e[XGUI ] xkeypress(): keysym ffeb unhandled!
00000004661i[BIOS ] $Revision: 12579 $ $Date: 2014-12-26 11:31:39 +0100 (Fr, 26. Dez 2014) $
00000318049i[KBD ] reset-disable command received
00000320688i[PIDE ] new BM-DMA address: 0xc000
00000326568i[P2ISA ] PCI IRQ routing: PIRQA# set to 0x0b
00000326584i[P2ISA ] write: ELCR2 = 0x08
00000326604i[ACPI ] new irq line = 11
00000454402i[VBIOS ] VGABios $Id: vgabios.c,v 1.76 2013/02/10 08:07:03 vruppert Exp $
00000454473i[BXVGA ] VBE known Display Interface b0c0
00000454505i[BXVGA ] VBE known Display Interface b0c5
00000457430i[VBIOS ] VBE Bios $Id: vbe.c,v 1.65 2014/07/08 18:02:25 vruppert Exp $
00000600420i[XGUI ] charmap update. Font Height is 16
00000794255i[BIOS ] ata0-0: PCHS=99/16/63 translation=none LCHS=99/16/63
00004671461i[BIOS ] IDE time out
00016745701i[BIOS ] Booting from 0000:7c00
00129676551i[BXVGA ] VBE set bpp (32)
00129676573i[BXVGA ] VBE set xres (1024)
00129676612i[BXVGA ] VBE set yres (768)
00129676650i[BXVGA ] VBE enabling x 1024, y 768, bpp 32, 3145728 bytes visible
(0) Breakpoint 1, 0xf0100126 in ?? ()
Next at t=946635864
(0) [0x000000100126] 0010:f0100126 (unk. ctxt): int 0x20 ; cd20
<bochs:3> s
00946635864i[CPU0 ] CPU is in protected mode (active)
00946635864i[CPU0 ] CS.mode = 32 bit
00946635864i[CPU0 ] SS.mode = 32 bit
00946635864i[CPU0 ] EFER = 0x00000000
00946635864i[CPU0 ] | EAX=0000002e EBX=00010000 ECX=00000b15 EDX=00000040
00946635864i[CPU0 ] | ESP=f0117fc8 EBP=f0117ff0 ESI=00000000 EDI=00000000
00946635864i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf SF zf AF PF cf
00946635864i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00946635864i[CPU0 ] | CS:0010( 0002| 0| 0) 00000000 ffffffff 1 1
00946635864i[CPU0 ] | DS:0018( 0003| 0| 0) 00000000 ffffffff 1 1
00946635864i[CPU0 ] | SS:0018( 0003| 0| 0) 00000000 ffffffff 1 1
00946635864i[CPU0 ] | ES:0018( 0003| 0| 0) 00000000 ffffffff 1 1
00946635864i[CPU0 ] | FS:0018( 0003| 0| 0) 00000000 ffffffff 1 1
00946635864i[CPU0 ] | GS:0018( 0003| 0| 0) 00000000 ffffffff 1 1
00946635864i[CPU0 ] | EIP=f0100126 (f0100126)
00946635864i[CPU0 ] | CR0=0xe0050033 CR2=0x001136b0
00946635864i[CPU0 ] | CR3=0x012fc000 CR4=0x00000010
(0).[946635864] [0x000000100126] 0010:f0100126 (unk. ctxt): int 0x20 ; cd20
00946635864e[CPU0 ] exception(): 3rd (14) exception with no resolution, shutdown status is 00h, resetting
00946635864i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
00946635864i[CPU0 ] cpu hardware reset