From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Given Subject: Re: Kernel size over 64K: what is needed, how to implement? Date: Sun, 19 Feb 2012 21:36:01 +0000 Message-ID: <4F416B41.7000804@cowlark.com> References: <4F3E9A88.7030105@jodybruchon.com> <4F3ED9FB.4010408@cowlark.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigACB7A4A065824CDBE8690915" Return-path: In-Reply-To: <4F3ED9FB.4010408@cowlark.com> Sender: linux-8086-owner@vger.kernel.org List-ID: To: ELKS Mailing List This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigACB7A4A065824CDBE8690915 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 17/02/12 22:51, David Given wrote: [...] > Regarding C compilers --- has anyone ever tried Open Watcom? It claims > to support all these weird 8086 segmentation modes, and there is a Linu= x > version. It's also supposed to produce pretty decent code, which may > well be more compact than bcc's and so save crucial kernel space. Neve= r > touched it myself, though. I just had a play. Apparently Open Watcom produces OMF object files, which none of myself, binutils-multiarch or file have ever heard of. Rumour has it that the Open Watcom linker is capable of being scripted --- I don't know whether this is to a useful extent. OTOH the code is definitely good. Here's a source file: int global; fnord(a, b) int a; int b; { int i =3D a + b; int j =3D global - a; global +=3D i; return j; } (K&R C because I wanted to use the same file for Open Watcom and bcc; Open Watcom supports ANSI. It even supports some C99.) In fastcall mode, Open Watcom produces: 0000 @fnord: 0000 01 C2 add dx,ax 0002 8B 1E 00 00 mov bx,word ptr _global 0006 29 C3 sub bx,ax 0008 89 D8 mov ax,bx 000A 01 16 00 00 add word ptr _global,dx 000E C3 ret In cdecl mode, it produces: 0000 _fnord: 0000 55 push bp 0001 89 E5 mov bp,sp 0003 8B 46 04 mov ax,word ptr 0x4[bp] 0006 8B 56 06 mov dx,word ptr 0x6[bp] 0009 01 C2 add dx,ax 000B 8B 1E 00 00 mov bx,word ptr _global 000F 29 C3 sub bx,ax 0011 89 D8 mov ax,bx 0013 01 16 00 00 add word ptr _global,dx 0017 5D pop bp 0018 C2 04 00 ret 0x0004 bcc produces (and you may want to brace yourselves): _fnord: push bp mov bp,sp push di push si dec sp dec sp mov ax,4[bp] add ax,6[bp] mov -6[bp],ax dec sp dec sp mov ax,[_global] sub ax,4[bp] mov -8[bp],ax mov ax,[_global] add ax,-6[bp] mov [_global],ax mov ax,-8[bp] add sp,*4 pop si pop di pop bp ret Note that that last is without optimisation; when I try -O I get an error message about not being able to find /usr/lib/bcc/rules.start. Is optimisation supported for the 8086? Also I notice that the bcc code seems to be returning the value in ax, so I may not have got the calling conventions to match. If anyone actually wanted to use this, I suspect the easiest thing to do would be to compile with Open Watcom, disassemble the object files and use a script of some kind to convert them to gas syntax. Which would suck, but is almost certainly easier than adding OMF support to dev86. --=20 =E2=94=8C=E2=94=80=E2=94=80=E2=94=80 =EF=BD=84=EF=BD=87=EF=BC=A0=EF=BD=83= =EF=BD=8F=EF=BD=97=EF=BD=8C=EF=BD=81=EF=BD=92=EF=BD=8B=EF=BC=8E=EF=BD=83=EF= =BD=8F=EF=BD=8D =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 http://www.= cowlark.com =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 =E2=94=82 "Never attribute to malice what can be adequately explained by =E2=94=82 stupidity." --- Nick Diamos (Hanlon's Razor) --------------enigACB7A4A065824CDBE8690915 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFPQWtEf9E0noFvlzgRAvOmAKDFojEm7wJK4J5L2kfnL0Z29mylsACdH5uc xJIc+mXQzea+GMdHkb1Y+Gc= =lNNI -----END PGP SIGNATURE----- --------------enigACB7A4A065824CDBE8690915--