flat assembler
Message board for the users of flat assembler.

Index > Main > why does this line crashes?

Author
Thread Post new topic Reply to topic
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 08 Oct 2011, 17:05
Code:
cmp byte[esi-1],0    

_________________
Sorry if bad english.
Post 08 Oct 2011, 17:05
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 08 Oct 2011, 18:35

esi ? a page fault ?

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 08 Oct 2011, 18:35
View user's profile Send private message Send e-mail Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 08 Oct 2011, 19:29
check direction flag maybe
Post 08 Oct 2011, 19:29
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 08 Oct 2011, 19:33
> esi ? a page fault ?
could be!? Surprised

> check direction flag maybe
both crash:
Code:
cld
mov byte[esi-1],0
std
mov byte[esi-1],0    
Post 08 Oct 2011, 19:33
View user's profile Send private message Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat 08 Oct 2011, 20:45
If the "cmp byte[esi-1],0" instruction crashes it can only be because ESI-1 is not a valid address. Without seeing more of your code there's no way for anyone to know why that would be.
Post 08 Oct 2011, 20:45
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 08 Oct 2011, 20:48
Code:
;@Teehee
cld
mov byte[esi-1],0
std
mov byte[esi-1],0    
std, cld ?
but in this case it is not the direction flag that is causing the problem,
but it is also a page fault.
Only a page fault can trigger a crash with this code.
(or a power outage Wink )
A breakpoint just before, a good debugger ... (3 min)
100% agree with Goplat

edit:
cld and std does not affect cmp or mov

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 08 Oct 2011, 20:48
View user's profile Send private message Send e-mail Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 09 Oct 2011, 02:29
ouadji wrote:

(or a power outage )

Which power outage are we talking about here Very Happy lol
Post 09 Oct 2011, 02:29
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 09 Oct 2011, 12:28
Goplat wrote:
If the "cmp byte[esi-1],0" instruction crashes it can only be because ESI-1 is not a valid address. Without seeing more of your code there's no way for anyone to know why that would be.

I just made a new file with just that instruction. Very Happy

Quote:
cld and std does not affect cmp or mov

LOL i forgot that haha

_________________
Sorry if bad english.
Post 09 Oct 2011, 12:28
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 cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.