[uaccess] Formalise the uaccess API

The userptr_t is now the fundamental type that gets used for conversions.
For example, virt_to_phys() is implemented in terms of virt_to_user() and
user_to_phys().
This commit is contained in:
Michael Brown
2008-10-13 04:10:34 +01:00
parent 667819becc
commit 6554b79ff9
21 changed files with 569 additions and 760 deletions
+9 -16
View File
@@ -15,8 +15,6 @@
* into a machine with such an old CPU anyway.
*/
#include <virtaddr.h>
#ifdef IOAPI_X86
#define IOAPI_PREFIX_x86
#else
@@ -28,24 +26,19 @@
*
*/
static inline __always_inline unsigned long
IOAPI_INLINE ( x86, virt_to_phys ) ( volatile const void *addr ) {
return ( ( ( unsigned long ) addr ) + virt_offset );
}
/*
* Physical<->Bus and Bus<->I/O address mappings
*
*/
static inline __always_inline void *
IOAPI_INLINE ( x86, phys_to_virt ) ( unsigned long phys_addr ) {
return ( ( void * ) ( phys_addr - virt_offset ) );
static inline __always_inline unsigned long
IOAPI_INLINE ( x86, phys_to_bus ) ( unsigned long phys_addr ) {
return phys_addr;
}
static inline __always_inline unsigned long
IOAPI_INLINE ( x86, virt_to_bus ) ( volatile const void *addr ) {
return virt_to_phys ( addr );
}
static inline __always_inline void *
IOAPI_INLINE ( x86, bus_to_virt ) ( unsigned long bus_addr ) {
return phys_to_virt ( bus_addr );
IOAPI_INLINE ( x86, bus_to_phys ) ( unsigned long bus_addr ) {
return bus_addr;
}
static inline __always_inline void *