flat assembler
Message board for the users of flat assembler.

Index > Linux > mmx segment fault !?

Author
Thread Post new topic Reply to topic
catafest



Joined: 05 Aug 2010
Posts: 129
catafest 16 Apr 2013, 22:00
Hi , can you tell me what is wrong with my source code ?
Thank you . Regards
Code:
use32
format ELF executable 3
entry start
segment readable executable
start:
        call mmxtest
mmxtest:
        push ebx
        push ecx
        push edx
        mov eax,1
        cpuid
        mov eax,edx
        shr eax,23
        and eax,1
        pop edx
        pop ecx
        pop ebx
        ret
segment readable writeable
align 4    
Post 16 Apr 2013, 22:00
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 16 Apr 2013, 22:26
You have to call sys_exit syscall after 'call mmxtest'.
Post 16 Apr 2013, 22:26
View user's profile Send private message Visit poster's website Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 16 Apr 2013, 22:40
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 21:02; edited 1 time in total
Post 16 Apr 2013, 22:40
View user's profile Send private message Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 129
catafest 25 Jun 2013, 14:06
$ ./fasm mmm.asm
flat assembler version 1.70.03 (16384 kilobytes memory)
mmm.asm [5]:
here
error: illegal instruction.
Post 25 Jun 2013, 14:06
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 25 Jun 2013, 14:33
Show your source code please.
Post 25 Jun 2013, 14:33
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 25 Jun 2013, 16:41
Code:
use32
format ELF executable 3
entry start
segment readable executable

start: 
        ; program entry point. OK!
        call mmxtest
        ; after calling "mmxtest" it will return here, so put an end here
        ; param1 in ebx (0)
        xor ebx,ebx
        ; syscall number in eax (1 = sys_exit)
        mov eax,$00000001
        ; int $80, call kernel function (it won't return, program terminates)
        int $80
        ; no more execution after this
mmxtest:
        push ebx 
        push ecx 
        push edx 
        mov eax,1 
        cpuid 
        mov eax,edx 
        shr eax,23 
        and eax,1 
        pop edx 
        pop ecx 
        pop ebx 
        ret
    

flat assembler version 1.71.10 (16384 kilobytes memory)
2 passes, 120 bytes.
FDBG shows that eax resolves to 1
Post 25 Jun 2013, 16:41
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger 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.