All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Hrebien <m_hrebien@wp.pl>
To: linux-assembly@vger.kernel.org
Subject: Re: jump_code
Date: Fri, 06 Sep 2002 21:59:22 +0200	[thread overview]
Message-ID: <3D79091A.6D77404F@wp.pl> (raw)
In-Reply-To: web-46559356@m1.plasa.com

You have wrong value in edx register when calling kernel's write
routine!

> I build this code , iget output but i little bug ithink.
> i hope some body be correct it..
> 
> .data
>  msg1: .ascii "Mencetak Saya\n"
> msg2: .ascii "\nKok saya dilompati sih\n"
> msg2_len: .long .-msg2
> msg3: .ascii "Hai ini pesen ketiga "
> msg3_len: .long .-msg3
> 
> .text
>         .globl _start
> _start:
>         mov $4,%eax
>         mov $1,%ebx
>         mov $msg1,%ecx
>         mov $14,%edx
>         int $0x80
> 
>         jmp pesan3
> pesan2:
>         mov $4,%eax
>         mov $1,%ebx
>         mov $msg2,%ecx
>         sub $24,%edx

Change "sub $24,%edx" to "mov msg2_len,%edx".

>         int $0x80
> 
>         mov $1,%eax
>         xor %edx,%edx
>         xor %ecx,%ecx
>         int $0x80
> pesan3:
>         mov $3,%ecx
>    ulang:
>           push %ecx
> 
>         mov $4,%eax
>         mov $1,%ebx
>         mov $msg3,%ecx
>         sub $21,%edx

Change "sub $21,%edx" to "mov msg3_len,%edx".

>         int $0x80
>         pop %ecx
>         dec %ecx
>         jnz ulang
>         jmp pesan2
> 
> Output
>         Mencetak Saya
>         Hai ini pesen ketiga
>         Hai ini pesen ketiga
>         Hai ini pesen ketiga
>         Kok saya dilompati sih
>         Hai ini pesen ketiga
> 
> my questio is ..
> why the third message is printing for one again in the end
> of output
> althought no instruction point it..?

Regards,

-- 
Maciej Hrebien


      reply	other threads:[~2002-09-06 19:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-06 17:14 jump_code ssams
2002-09-06 19:59 ` Maciej Hrebien [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D79091A.6D77404F@wp.pl \
    --to=m_hrebien@wp.pl \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.