From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8832 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?0KDRi9GB0Yw=?= Newsgroups: gmane.linux.lib.musl.general Subject: Re: sys/io.h lacks inb_p and outb_p on x86 Date: Tue, 10 Nov 2015 15:08:18 +0700 Message-ID: <20151110150818.5820b37d@r2lynx> References: <20151108112655.4ad63277@r2lynx> <20151108045045.GM3818@brightrain.aerifal.cx> <20151108121337.7114adab@r2lynx> <20151108052358.GN3818@brightrain.aerifal.cx> <20151109221734.GR3818@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1447142753 6715 80.91.229.3 (10 Nov 2015 08:05:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Nov 2015 08:05:53 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8845-gllmg-musl=m.gmane.org@lists.openwall.com Tue Nov 10 09:05:44 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Zw3vz-0007Od-ME for gllmg-musl@m.gmane.org; Tue, 10 Nov 2015 09:05:43 +0100 Original-Received: (qmail 19609 invoked by uid 550); 10 Nov 2015 08:05:40 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 19574 invoked from network); 10 Nov 2015 08:05:39 -0000 X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=ALL_TRUSTED,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.0 In-Reply-To: <20151109221734.GR3818@brightrain.aerifal.cx> X-Mailer: claws Xref: news.gmane.org gmane.linux.lib.musl.general:8832 Archived-At: On Mon, 9 Nov 2015 17:17:34 -0500 Rich Felker wrote: > On Sun, Nov 08, 2015 at 12:23:58AM -0500, Rich Felker wrote: > > On Sun, Nov 08, 2015 at 12:13:37PM +0700, =D0=A0=D1=8B=D1=81=D1=8C wrot= e: > > > On Sat, 7 Nov 2015 23:50:45 -0500 > > > Rich Felker wrote: > > >=20 > > > > On Sun, Nov 08, 2015 at 11:26:55AM +0700, =D0=A0=D1=8B=D1=81=D1=8C = wrote: > > > > > x86 arch lacks inb_p and outb_p inline functions. This is > > > > > required for memtest86+. > > > > >=20 > > > > > I don't know how properly make an assembly here, so when > > > > > making memtest I copied sys/io.h into local directory, and > > > > > copied these functions from uClibc. > > > > >=20 > > > > > I attach modified header for reference (they should go into > > > > > bits/io.h). > > > >=20 > > > > Any idea what these are intended to do? Are they documented > > > > anywhere? > > > >=20 > > > > Rich > > >=20 > > > I can't say much, but looking into memtest code I see they're > > > used only for beeping a PC speaker. > > >=20 > > > Comment in io.h include file of memtest says: > > >=20 > > > * This file contains the definitions for the x86 IO instructions > > > * inb/inw/inl/outb/outw/outl and the "string versions" of the > > > same > > > * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing" > > > * versions of the single-IO instructions (inb_p/inw_p/..). > > >=20 > > > However memtest builds with assumption they're present in > > > sys/io.h from host and io.h included with memtest does not define > > > inb_p/outb_p in any way. > > >=20 > > > I probably will go with uClibc defines, or just nop memtest > > > beeper. > >=20 > > See > > http://stackoverflow.com/questions/6793899/what-does-the-0x80-port-addr= ess-connects > >=20 > > So apparently these are convenience functions to show the most > > recent port io that was performed on a hardware debugging device in > > case the memtest crashes. I don't mind adding them is software > > expects them to be there, but they should be written in terms of > > the existing functions rather than duplicating asm. >=20 > Hmm, according to the man page this is actually to "pause". See: > http://man7.org/linux/man-pages/man2/outb.2.html >=20 > Of course there's also all kinds of nonsense claiming they won't work > with -O0, so I'm not sure what to believe. >=20 > If you want these, can you prepare a patch adding all 6 *_p functions > as calls to plain in[bwl]/out[bwl] followed by a call to outb to port > 0x80? >=20 > Rich Well, I am not good at assembly right now, so no. While digging this I came to suspection that grabbed versions from uClibc cannot be rewritten as function calls, or I misunderstand assembly (or it's gcc variant) at all. So, after three+ years of experience with musl I just hit this once, and I don't think they worth adding if there is no much interest. memtest86+ uses no libc code, and suddenly only grabs those two from host which is easily patchable. I used uClibc versions just to get a conformant binary. --=20 http://lynxlynx.tk/ Power electronics made simple Unix and simple KISS C code