diff options
author | Piotr Jaroszyński | 2010-05-26 18:55:06 +0200 |
---|---|---|
committer | Michael Brown | 2010-08-19 13:35:28 +0200 |
commit | a320085750c421782e64c266c4c3f66a408a35e1 (patch) | |
tree | 8bcf417e7a2a7c443ca8aaae0280f75c395787a2 /src/interface/linux | |
parent | [linux] Add timer (diff) | |
download | ipxe-a320085750c421782e64c266c4c3f66a408a35e1.tar.gz ipxe-a320085750c421782e64c266c4c3f66a408a35e1.tar.xz ipxe-a320085750c421782e64c266c4c3f66a408a35e1.zip |
[linux] Add uaccess
Add user access API for linux.
On linux userspace virtual == user == phys addresses. Physical
addresses also being the same is wrong, but there is no general way of
converting userspace addresses to physical as what appears to be
contiguous in userspace is physically fragmented. Currently only the
DMA memory is special-cased, but its conversion to bus addresses is
done in phys_to_bus. This is known to break virtio as it is passing
phys addresses to the virtual device.
Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/linux')
-rw-r--r-- | src/interface/linux/linux_uaccess.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/interface/linux/linux_uaccess.c b/src/interface/linux/linux_uaccess.c new file mode 100644 index 00000000..d4e52d09 --- /dev/null +++ b/src/interface/linux/linux_uaccess.c @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 Piotr Jaroszyński <p.jaroszynski@gmail.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +FILE_LICENCE(GPL2_OR_LATER); + +#include <ipxe/uaccess.h> + +/** @file + * + * iPXE user access API for linux + * + */ + +PROVIDE_UACCESS_INLINE(linux, phys_to_user); +PROVIDE_UACCESS_INLINE(linux, user_to_phys); +PROVIDE_UACCESS_INLINE(linux, virt_to_user); +PROVIDE_UACCESS_INLINE(linux, user_to_virt); +PROVIDE_UACCESS_INLINE(linux, userptr_add); +PROVIDE_UACCESS_INLINE(linux, memcpy_user); +PROVIDE_UACCESS_INLINE(linux, memmove_user); +PROVIDE_UACCESS_INLINE(linux, memset_user); +PROVIDE_UACCESS_INLINE(linux, strlen_user); +PROVIDE_UACCESS_INLINE(linux, memchr_user); |