Skip to main content

Thread: [Nasm] Segmentation fault


basically i'm trying new things in assembly. i'm manipulating strings/addresses , got segmentation fault can't seem debug.
here code:
code:
jmp short var  doit:  pop ecx  xor eax,eax  mov [ecx+4],eax  lea ecx,[ecx+1]  mov eax,4  mov ebx,1  mov edx,8  int 0x80  mov eax,1  mov ebx,0  int 0x80  var:  call doit  db 'testxing'
any help?

i'm not sure here goes...
make sure right type of call. near calls push (e)ip on stack far calls push (e)ip , cs. therefore value popped ecx might not address want.

btw better place ask @ nasm forums. have better answer mine

easier way is...
code:
section .data  	string: db "testxing",0xa  	stringlen: equ $-string    section .text  	global _start    _start:  	;print string  	mov eax,4	  	mov ebx,1  	mov ecx,string		;same lea ecx,[string]  	mov edx,stringlen  	int 0x80    	;end program  	mov eax,1  	mov ebx,0  	int 0x80


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [Nasm] Segmentation fault


Ubuntu

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial