🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50097

GCC & i386 documentation

#50097
From: Tony Denault
Date: Tue, 23 Nov 1993 04:01
50 lines
2172 bytes
Hello,

I trying to port some code to linux using gcc. I am looking for
documentation on using 386 inline assembly with gcc ( __asm__). I've tried 
looking at the man or gcc ftp sites. Is their anything out their than
explains:

	assembly language format. (GCC's  386 assembly syntax is different 
		from the intel documentation).

   register conventions. ( For example, the return value is
		stored in eax).

Please let me know if any books or on-line documents exist for gcc.


A Linux question: Right now I trying to port over functions to talk
to hardware via the io ports( inp8, outp8, inp16, outp16, inp32, outp32).
For example, my old function to read a 16 bit word is:

/*------------------------------------------------------------
**  in16() - read a 16-bit word from I/O port
**------------------------------------------------------------
*/
ushort inp16( port )
ushort port;
{
    asm {
        xor    eax, eax
        movzx  edx, port[EBP]
        in     ax, dx
    }
}


I am tring to write equivlant functions in linux using 
inline assembly. I know the kernel has the inpb() function. This
is 8 bit(?). I wish to have a 8, 16, and 32 bit version of this
function. As anyone written one they can share with me?


Thanks,

Tony

--
/------------------------------------------------------------------------\
| Tony Denault, Institute for Astronomy,  | denault@uhifa.ifa.hawaii.edu |
| 2680 Woodlawn Drive, Honolulu, HI 96789 |               (808) 956-8101 |
\------------------------------------------------------------------------/
Technical Details
Message-ID: <CGxF73.I13@news.Hawaii.Edu>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!gatech!swrinde!elroy.jpl.nasa.gov!ames!news.Hawaii.Edu!galileo!denault

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,bfaf15cd46b00525,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-11-22 23:19:34 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!gatech!swrinde!elroy.jpl.nasa.gov!ames!news.Hawaii.Edu!galileo!denault
From: denault@galileo.ifa.hawaii.edu (Tony Denault)
Subject: GCC & i386 documentation
Message-ID: <CGxF73.I13@news.Hawaii.Edu>
Sender: news@news.Hawaii.Edu
Organization: Institute for Astronomy, Hawaii
Date: Tue, 23 Nov 1993 04:01:50 GMT
Lines: 50