9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Hello Assembly
Date: Sat,  9 Feb 2008 05:34:14 -0500	[thread overview]
Message-ID: <9bcb80e28d8b5b74840bac68585c91c7@quanstro.net> (raw)
In-Reply-To: <900eb6253a34482ccdc5dd52435c184d@terzarima.net>

> actually, there's probably enough space above your current location to (appear to) work, but a further error
> is hinted in the address given by the trap:
>
> 	8.out 1183: suicide: invalid address 0x7 in sys call pc=0x104e
>
> since 7 is your length value, you've also got an off-by-4 error in your stack offsets.

actually, i think there's something else wrong:

acid: asm(_main)
_main 0x00001020	SUBL	$0x18,SP
_main+0x3 0x00001023	MOVL	$0x1,0x0(SP)
_main+0xa 0x0000102a	MOVL	$string(SB),0x4(FP)
_main+0x12 0x00001032	MOVL	$0x7,0x8(FP)
_main+0x1a 0x0000103a	MOVL	$0x0,0xc(FP)
_main+0x22 0x00001042	MOVL	$0x0,0x10(FP)
_main+0x2a 0x0000104a	MOVL	$0x33,AX
_main+0x2f 0x0000104f	INTB	$0x40
_main+0x31 0x00001051	ADDL	$0x18,SP
_main+0x34 0x00001054	RET

why does the
for the equivalent c "pwrite(1, string, 7, 0)" i get this

acid: asm(main)
main 0x00001020	SUBL	$0x18,SP
main+0x3 0x00001023	MOVL	$0x1,AX
main+0x8 0x00001028	MOVL	AX,0x0(SP)
main+0xb 0x0000102b	MOVL	string(SB),AX
main+0x11 0x00001031	MOVL	AX,0x4(SP)
main+0x15 0x00001035	MOVL	$0x7,AX
main+0x1a 0x0000103a	MOVL	AX,0x8(SP)
main+0x1e 0x0000103e	MOVL	$0x0,0xc(SP)
main+0x26 0x00001046	MOVL	$0x0,0x10(SP)
main+0x2e 0x0000104e	CALL	pwrite(SB)
main+0x33 0x00001053	ADDL	$0x18,SP
main+0x36 0x00001056	RET

- erik


  reply	other threads:[~2008-02-09 10:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-09  9:44 Anant Narayanan
2008-02-09  9:58 ` Charles Forsyth
2008-02-09 10:09   ` Anant Narayanan
2008-02-09 10:15     ` erik quanstrom
2008-02-09 10:32   ` Charles Forsyth
2008-02-09 10:34     ` erik quanstrom [this message]
2008-02-09 10:36       ` erik quanstrom
2008-02-09 20:15       ` Anant Narayanan
2008-02-09 20:17     ` Anant Narayanan
2008-02-09 14:37 ` Eris Discordia
2008-02-09 16:17   ` Brantley Coile
2008-02-09 16:27     ` ron minnich
2008-02-09 16:38       ` erik quanstrom
2008-02-09 16:51       ` Brantley Coile
2008-02-10  8:04       ` maht
2008-02-11 16:39       ` john
2008-02-09 17:32     ` Charles Forsyth
2008-02-10  8:18       ` Eris Discordia
2008-02-10  8:56         ` Martin Neubauer
2008-02-10 14:38           ` Pietro Gagliardi
2008-02-10 16:55             ` Anant Narayanan
2008-02-10 18:01               ` erik quanstrom
2008-02-10 18:11                 ` Pietro Gagliardi
2008-02-11  2:36               ` Adrian Tritschler
2008-02-11  2:36                 ` Pietro Gagliardi
2008-02-11  2:39                 ` Pietro Gagliardi
2008-02-11  6:26                   ` maht
2008-02-11  2:40                 ` Pietro Gagliardi
2008-02-11  2:55                   ` erik quanstrom
     [not found] <ead6208b996760a9eb2eeccb8c431b12@plan9.bell-labs.com>
2008-02-09 21:15 ` Anant Narayanan
2008-02-09 21:27   ` Pietro Gagliardi
2008-02-10  8:30     ` Anant Narayanan
2008-02-11 16:36   ` john
2008-02-11 16:43     ` erik quanstrom
2008-02-11 16:45       ` john
2008-02-11 19:41       ` Jon Snader
2008-02-11 19:49         ` Pietro Gagliardi

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=9bcb80e28d8b5b74840bac68585c91c7@quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@cse.psu.edu \
    /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;
as well as URLs for NNTP newsgroup(s).