Date: Mon, 19 Mar 2012 00:23:33 +0100 From: Robert Millan <rmh@freebsd.org> To: Bruce Evans <brde@optusnet.com.au> Cc: Adrian Chadd <adrian@freebsd.org>, freebsd-arch@freebsd.org Subject: Re: [PATCH] Add compatibility <sys/io.h> Message-ID: <CAOfDtXMmR-On5k7rLKNqXhGTPLkc4XOao672HcS-9vAbVJxiSQ@mail.gmail.com> In-Reply-To: <20120312121852.P1122@besplex.bde.org> References: <CAOfDtXPGPP0reN9NTBw_5%2BNwXZ56Yy0oyx_fH%2BDOvmpc1O%2BQdQ@mail.gmail.com> <CAJ-Vmonu_ApSd192cjvsW6k3eNNK4Kz=MmAMe_e=zmwbrS8Ayw@mail.gmail.com> <CAOfDtXOCyjga5QHz98Re3jXkefNzB-MbULcAVUQH89ToVLkw9g@mail.gmail.com> <20120312121852.P1122@besplex.bde.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] El 12 de març de 2012 3:18, Bruce Evans <brde@optusnet.com.au> ha escrit: > I would prefer to make it fail to build if it gets the arg order wrong, > but I don't see how to do that, since both args are integers. I don't think you can. E.g. consider: outb (0x60, 0x61); then only semantical analysis could tell. >> Looks good. So you suggest we tell userspace users to switch to >> bus_space_write_*? > > > The problem with that is that if you don't do the switch yourself then > most users won't even know that it is necessary. You have to remove > the functionaility in cpufunc.h and/or add messy userland ifdefs as > well as messy kernel ifdefs to unremove it, so that users who don't > know what they are doing and which you haven't adjusted get warned > by build failures. All users that knew what they were doing have to > do it differently. Okay, I see your point. Maybe we can try a conservative approach and just issue warnings. How does this look for a start? -- Robert Millan [-- Attachment #2 --] Index: sys/i386/include/cpufunc.h =================================================================== --- sys/i386/include/cpufunc.h (revision 233095) +++ sys/i386/include/cpufunc.h (working copy) @@ -42,6 +42,10 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#ifndef _KERNEL +#warning "No user-serviceable parts inside. For user-space I/O, use the bus_space(9) family of functions." +#endif + #ifdef XEN extern void xen_cli(void); extern void xen_sti(void); Index: sys/amd64/include/cpufunc.h =================================================================== --- sys/amd64/include/cpufunc.h (revision 233095) +++ sys/amd64/include/cpufunc.h (working copy) @@ -43,6 +43,10 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#ifndef _KERNEL +#warning "No user-serviceable parts inside. For user-space I/O, use the bus_space(9) family of functions." +#endif + struct region_descriptor; #define readb(va) (*(volatile uint8_t *) (va))help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfDtXMmR-On5k7rLKNqXhGTPLkc4XOao672HcS-9vAbVJxiSQ>
