[PATCH] Add compatibility <sys/io.h>
Robert Millan
rmh at freebsd.org
Sun Mar 18 23:23:34 UTC 2012
El 12 de març de 2012 3:18, Bruce Evans <brde at 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
-------------- next part --------------
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))
More information about the freebsd-arch
mailing list