Skip to contentSkip to conversation

Seg Fault

DISCUSSION dAvId KeDrOsKy 2 participants 2 messages Jan 26, 2003

lore
Share & tools
lore
#0 lore raw

Can somebody help me out with why I'm getting a segmentation fault All I'm trying to do is send some text to stdout. The output I get is:.

Some message
Segmentation Fault

--------------------------------------------------------------------------------
section .model small
section .stack 100h

section .data
mesg db 'Some message',0ah, 0

section .text

global _start
_start:

        mov     eax, 4
        mov     ebx, 1
        mov     ecx, mesg
        mov     edx, 13

int 0x80
ret

mov eax, 1
xor ebx, ebx
int 0x80

#1 lore raw
Quoted 2 lines

Can somebody help me out with why I'm getting a segmentation fault All I'm trying to do is send some text to stdout.

Take out the "ret" line. You have an appropriate exit syscall at the end -- let that execute instead of trying to return.

b

Quoted 21 lines

section .model small
section .stack 100h

section .data
mesg db 'Some message',0ah, 0

section .text

global _start
_start:

        mov     eax, 4
        mov     ebx, 1
        mov     ecx, mesg
        mov     edx, 13

int 0x80
ret

mov eax, 1
xor ebx, ebx
int 0x80