🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2699

asm in 386

#2699
From: Dirk Grunwald
Date: Tue, 30 May 1989 17:42
49 lines
1671 bytes
this is gcc 1.35, stock, installed in SysV-386 machine.

I want to use the ``rep insd'' instruction on the 386.

This takes arguments in registers AD, AC and EDI.

i386.md states that it has the following restrictions:
	`d'	 -> AD
	`c'	 -> AC
	`D'	 -> EDI

However, tm-i386.h shows that REG_CLASS_FROMLETTER
doesn't recognize a regclass for `D', so I assume that
the documentation is out of date.

Furthermore, when I try to use the explicit register number (5), I get
bogus results -- the address of my input string buffer is store in
ebx, which won't work.

Any workarounds welcome, please response by mail.

Example follows.
--------------------foo.c--------------------
static inline void foo(int port, char *bar, int count)
{
   asm volatile("cld");
   asm volatile("rep insd " : : "rd" (port), "rc" (count), "r5" (bar) );
}

void bar()
{
   char str[128];
   foo(10, str, 128);
}
--------------------foo.s--------------------
	....
        movl $10,%eax
        leal -128(%ebp),%edx
        movl $128,%ecx
        leal -128(%ebp),%ebx		<<<< this should be %edi
/APP
        cld
        rep insd
	....
--
Dirk Grunwald
Univ. of Illinois
grunwald@flute.cs.uiuc.edu
Technical Details
Message-ID: <GRUNWALD.89May30124201@flute.cs.uiuc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!deimos.cis.ksu.edu!uxc!garcon!garcon.cso.uiuc.edu!grunwald

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!deimos.cis.ksu.edu!uxc!garcon!garcon.cso.uiuc.edu!grunwald
From: grunwald@flute.cs.uiuc.edu (Dirk Grunwald)
Newsgroups: gnu.gcc.bug
Subject: asm in 386
Message-ID: <GRUNWALD.89May30124201@flute.cs.uiuc.edu>
Date: 30 May 89 17:42:01 GMT
Sender: news@garcon.cso.uiuc.edu
Reply-To: grunwald@flute.cs.uiuc.edu
Distribution: gnu
Organization: University of Illinois, Urbana-Champaign
Lines: 49