The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dragoslav Zaric <dragoslav.zaric.kd@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Subject: Address of .globl _start
Date: Tue, 21 Apr 2009 01:44:36 +0200	[thread overview]
Message-ID: <2d05c4580904201644n58160449n2e917cbac096ceeb@mail.gmail.com> (raw)

Hello,

I have compiled test.s (bellow) with 'as' compiler:

-------------------------------------------------
.section .data

.globl var
var:
.long 10

.section .text

.globl _start
_start:
 movl $_start, %ebx
 jmp loop_exit

loop_exit:
  movl $1, %eax             #1 is the exit() syscall
  int $0x80

-------------------------------------------------
and got output with echo $? (reads %ebx register)
116

After that I compiled test.s (bellow) with 'as' compiler:

-------------------------------------------------
.section .data

.globl var
var:
.long 10

.section .text

.globl _start
_start:
 movl _start, %ebx
 jmp loop_exit

loop_exit:
  movl $1, %eax             #1 is the exit() syscall
  int $0x80

-------------------------------------------------
and got output with echo $? (reads %ebx register)
139

After that I compiled test.s (bellow) with 'as' compiler:

-------------------------------------------------
.section .data

.globl var
var:
.long 10

.section .text

.globl _start
_start:
 movl var, %ebx
 jmp loop_exit

loop_exit:
  movl $1, %eax             #1 is the exit() syscall
  int $0x80

-------------------------------------------------
and got output with echo $? (reads %ebx register)
10

After that I compiled test.s (bellow) with 'as' compiler:

-------------------------------------------------
.section .data

.globl var
var:
.long 10

.section .text

.globl _start
_start:
 movl $var, %ebx
 jmp loop_exit

loop_exit:
  movl $1, %eax             #1 is the exit() syscall
  int $0x80

-------------------------------------------------
and got output with echo $? (reads %ebx register)
132

So my question is, what these numbers mean ? From which
point in memory they are counted from ? From this I can conclude
that value for "movl _start, %ebx" is always 139 and it can be on
various addresses. Is this means that beginning of 'as' assembly program is
signed with value 139 ???

thanks,

Dragoslav Zaric,
[Programmer; M Sc Astrophysics]

             reply	other threads:[~2009-04-20 23:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 23:44 Dragoslav Zaric [this message]
     [not found] ` <20090421000048.GA25860@goodmis.org>
2009-04-21  0:12   ` Address of .globl _start Dragoslav Zaric

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=2d05c4580904201644n58160449n2e917cbac096ceeb@mail.gmail.com \
    --to=dragoslav.zaric.kd@gmail.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox