Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Nov 1998 19:15:56 +0200
From:      Ruslan Ermilov <ru@ucb.crimea.ua>
To:        Robert Nordier <rnordier@nordier.com>
Cc:        FreeBSD Hackers <hackers@FreeBSD.ORG>
Subject:   Re: FreeBSD on i386 memory model
Message-ID:  <19981114191556.A17660@ucb.crimea.ua>
In-Reply-To: <199811131930.VAA12575@ceia.nordier.com>; from Robert Nordier on Fri, Nov 13, 1998 at 09:30:44PM %2B0200
References:  <19981113202027.A15520@ucb.crimea.ua> <199811131930.VAA12575@ceia.nordier.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 13, 1998 at 09:30:44PM +0200, Robert Nordier wrote:
> Ruslan Ermilov wrote:
> > Hi!
> > 
> > I would like to practice in writing assembler programs
> > under FreeBSD.
> > 
> > Is there any doc/book/man which describes the FreeBSD
> > memory model on i386 architecture?
> 
> Essentially it's just a flat protected model, and for most purposes
> can simply be ignored.  Rather than documentation,  I'd suggest

What documentation do you mean?

> looking at C startup code (src/lib/csu), i386-specific C library
> functions (src/lib/libc/i386), and at the output of `cc -S'.
> 
> FWIW, here's a small standalone i386 assembler program:
> 
> 	main:   call .+0x5
> 	        popl %ebp
> 	        subl $0x5,%ebp
> 	        pushl $msg.1-msg
> 	        leal msg-main(%ebp),%eax
> 	        pushl %eax
> 	        pushl $0x1
> 	        movl $0x4,%eax
> 	        call .+0x5			<-- why this one?
> 	        lcall $0x7,$0x0
> 	        pushl $0x0
> 	        movl $0x1,%eax
> 	        call .+0x5			<-- and this one?
> 	        lcall $0x7,$0x0
> 	msg:    .ascii "hello, world!\n"
> 	msg.1:

Unfortunately, I can't compile it, as(1) gives the following:

{standard input}: Assembler messages:
{standard input}:5: Error: Unimplemented segment type 0 in parse_operand
{standard input}:10: Error: operands given don't match any known 386 instruction
{standard input}:14: Error: operands given don't match any known 386 instruction

It seems that as(1) doesn't understand ``lcall $SECTION, $OFFSET''.
At least on my 2.2.1, 2.2.5 and 2.2.7+ machines:

FreeBSD relay.ucb.crimea.ua 2.2.7-STABLE FreeBSD 2.2.7-STABLE #0: Sun Oct  4 18:08:06 EEST 1998     root@:/usr/src/sys/compile/CHYRO  i386

GNU assembler version 1.92.3, FreeBSD $Revision: 1.4 $

Any ideas?

-- 
Ruslan Ermilov		Sysadmin and DBA of the
ru@ucb.crimea.ua	United Commercial Bank
+380.652.247.647	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



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