Article View: pl.comp.lang.asm
Article #1126[Linux] Problem ze stostem
From: Tomasz Pieciak
Date: Sun, 13 May 2007 09:03
Date: Sun, 13 May 2007 09:03
78 lines
2567 bytes
2567 bytes
Dzień dobry
Mam problem ze stosem podczas używania GNU Asemblera w Linuksie.
Gdy szkielet mojego programu wygląda tak:
----------------------------
# dane
.text
.global _start
_start:
# kod
----------------------------
argumenty na stosie są następujące:
----------------------------
ARGN
...
ARG2
ARG1 <- pierwszy argument programu
ARGC <- rejestr ESP - ilość argumentów
.
.
0 <- address zerowy
----------------------------
zaś... kiedy zamienię etykietę '.global _start' na ' .globl mojanazwa'
----------------------------
# dane
.text
.globl mojanazwa
mojanazwa:
# kod
----------------------------
Pojawia się pewien problem - argumenty programu wrzucone na stos
wyglądają następująco:
----------------------------
ARGN
...
ARG2
ARG1 <- pierwszy argument programu
ARGC <- ilość argumentów
.
. <- zmienna ilość elementów
.
DANE <- rejestr ESP
.
.
0 <- address zerowy
----------------------------
Między elementem 'DANE', a 'ARGC' jest zmienna ilość elementów. Czasami
jest to 84 bajty (21 elementów), czasami 116 bajtów (29 elementów) -
różnie na różnych dystrybucjach systemu Linux.
Moje pytanie jest następujące:
Czy ta zmienna ilość elementów jest przez cokolwiek uwarunkowana ? Co
jest wrzucane na stos w chwili wywołania programu przed ARGC ? Czy to
jest zależne od linkera, kompilatora, jądra ?
--
Tomasz Pięciak
Technical Details
Message-ID:
<f26k9i$gu9$1@atlantis.news.tpi.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: Tomasz Pieciak <slash@-NO-SP*M-battlenet.pl> Newsgroups: pl.comp.lang.asm Subject: [Linux] Problem ze stostem Date: Sun, 13 May 2007 11:03:52 +0200 Organization: tp.internet - http://www.tpi.pl/ Lines: 78 Message-ID: <f26k9i$gu9$1@atlantis.news.tpi.pl> NNTP-Posting-Host: 213.25.217.241 Mime-Version: 1.0 X-Trace: atlantis.news.tpi.pl 1179047026 17353 213.25.217.241 (13 May 2007 09:03:46 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Sun, 13 May 2007 09:03:46 +0000 (UTC) User-Agent: Thunderbird 1.5.0.9 (X11/20061206) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit