flat assembler
Message board for the users of flat assembler.

Index > Heap > one instruction = infinite loop or bugggggg


endless loop
call $ , no problem
0%
 0%  [ 0 ]
jmp $ , big problem
0%
 0%  [ 0 ]
halt , it don't works
33%
 33%  [ 1 ]
call $ , big problem
33%
 33%  [ 1 ]
jmp $ , the solution
33%
 33%  [ 1 ]
Total Votes : 3

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
Code:
call $
jmp $
halt
    


what are these instructions?
Post 19 Feb 2008, 16:26
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17278
Location: In your JS exploiting you and your system
revolution
HALT is used to wait for the next interrupt. CALL will fill you stack with return addresses. JMP will burn power in you CPU only.
Post 19 Feb 2008, 16:39
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
HLT, not HALT. Wink
Post 19 Feb 2008, 16:48
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17278
Location: In your JS exploiting you and your system
revolution
Oh yeah, Embarassed
Post 19 Feb 2008, 16:49
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
ha ha ha ha

call $ is a crasher
yep, it will generate a stack overflow...

Code:
org 100h
call $
    


Code:
org 100h
jmp $
    


Code:
org 100h
cli
hlt
    



the first generate an error

the two others freeze the µP

i'm sooo sorry, there is not any possibility to make:
Code:
mov eip,$
    
Post 19 Feb 2008, 17:10
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
What about:
Code:
push $
retn    

? Smile
Post 19 Feb 2008, 17:12
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17278
Location: In your JS exploiting you and your system
revolution
edfed wrote:
i'm sooo sorry, there is not any possibility to make:
Code:
mov eip,$
    
Yeah there is, that is what 'jmp $' does, duh!
Post 19 Feb 2008, 17:13
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
and to make:
add eip,80

jmp near @80
...
@80:


but it is not really a mov.

Code:
push $
ret
    

good! Very Happy
Code:
xor eax,eax
@@:
je @b
    

but it can be ended by an irq that modify the return eflags...
Post 19 Feb 2008, 17:21
View user's profile Send private message Visit poster's website Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22
Code:
.inf:
mov ecx,-1
loopnz .inf
    


Last edited by r22 on 25 Feb 2008, 18:35; edited 1 time in total
Post 19 Feb 2008, 20:49
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
loop decrement ecx automatically, so, it don't works...
Post 19 Feb 2008, 21:01
View user's profile Send private message Visit poster's website Reply with quote
System86



Joined: 15 Aug 2007
Posts: 77
System86
Code:
.inf:
cli
hlt
jmp .inf
    
Post 19 Feb 2008, 21:29
View user's profile Send private message Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 975
Location: Czechoslovakia
MazeGen
My favourite is:

Code:
mov eax, $
jmp $+1
db 0E0h
    
Post 20 Feb 2008, 08:26
View user's profile Send private message Visit poster's website Reply with quote
System86



Joined: 15 Aug 2007
Posts: 77
System86
I'm pretty sure hlt uses less power than jmp $. cli then hlt stops, the loop is in case an NMI happens. For hlt, you must be either in ring 0 or in real mode, not just IOPL=3. If you want IRQs to be serviced, just use this:
Code:
@@:
sti
hlt
jmp @b
    

To block NMI, use this:
Code:
mov al, 80h ;bit 7 set, nothing else matters
out 70h, al
in al, 71h ;dummy read, needed to keep RTC in valid state on old hardware
    
Post 20 Feb 2008, 21:16
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.