Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2005 12:30:34 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        alexander <arundel@h3c.de>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Console ASCII interpretation
Message-ID:  <20050516173034.GB85914@dan.emsphone.com>
In-Reply-To: <20050516171143.GA19979@skatecity>
References:  <20050516171143.GA19979@skatecity>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (May 16), alexander said:
> I'm using syscall number 4 write() to output data to stdout using x86
> assembly. When I try to output the following DWORD: 0x00003532 I get
> the following output under Eterm and xterm: "25". Which is exactly
> what I want.
> 
> However when I do the very same under the console (using bash or sh.
> It doesn't matter) I get this output: "25 ".
> 
> I looked up the ASCII value for 00h and it says NUL. Doesn't that
> mean that there shouldn't be any output at all?

Did you maybe forget to push the 3rd argument to write onto the stack
before making the syscall?  That's the number of bytes to write.  If
there happened to be a 4 on the stack, then write() would write 4 bytes
starting at whatever buffer your 2nd argument points to.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050516173034.GB85914>