Page 1 of 1

jmp $ causes reboot

Posted: Mon Feb 02, 2009 3:20 am
by david
My code is very simple, first , entry protect mode, then print yellow string 'Protect', then jmp $.
I can see the yellow string, but the computer reboots after that.

Code: Select all

; print 'Protect' 
mov ax, GDT_Video_Sel
mov gs, ax
mov bx, (5 * 80 + 5) * 2	; row 5, col 5
mov al, 'P'
mov ah, 14
mov gs:[bx], ax
......
mov bx, (5 * 80 + 11) * 2	; row 5, col 11
mov al, 't'
mov ah, 14
mov gs:[bx], ax

jmp $                ; cause reboot
I don't know why.

Re: jmp $ causes reboot

Posted: Mon Feb 02, 2009 3:59 am
by AJ
Hi,

JMP $ by itself cannot cause a reboot and you haven't got paging on yet, so can't be executing from unmapped memory.

Have you got interrupts disabled? If not,try adding an STI before you jump in to protected mode.

If that fails, use bochs to establish where EIP actually is.

Cheers,
Adam

Re: jmp $ causes reboot

Posted: Mon Feb 02, 2009 4:17 am
by Love4Boobies
AJ wrote:Have you got interrupts disabled? If not,try adding an STI before you jump in to protected mode.
He means CLI.

Re: jmp $ causes reboot

Posted: Mon Feb 02, 2009 4:21 am
by AJ
#-o Just testing - I wondered who would spot that first. Well done!

[I think I got away with it :-s ]

Cheers,
Adam

Re: jmp $ causes reboot

Posted: Mon Feb 02, 2009 8:45 pm
by david
It's ok, tks =D>