jmp $ causes reboot

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
User avatar
david
Member
Member
Posts: 93
Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:

jmp $ causes reboot

Post 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.
Just For Fun
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: jmp $ causes reboot

Post 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
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: jmp $ causes reboot

Post 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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: jmp $ causes reboot

Post by AJ »

#-o Just testing - I wondered who would spot that first. Well done!

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

Cheers,
Adam
User avatar
david
Member
Member
Posts: 93
Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:

Re: jmp $ causes reboot

Post by david »

It's ok, tks =D>
Just For Fun
Post Reply