The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Address of .globl _start
@ 2009-04-20 23:44 Dragoslav Zaric
       [not found] ` <20090421000048.GA25860@goodmis.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dragoslav Zaric @ 2009-04-20 23:44 UTC (permalink / raw)
  To: LKML

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]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-21  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-20 23:44 Address of .globl _start Dragoslav Zaric
     [not found] ` <20090421000048.GA25860@goodmis.org>
2009-04-21  0:12   ` Dragoslav Zaric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox