1/** 2 * \file 3 * \brief User space memory access functions. 4 */ 5 6/* 7 * Copyright (c) 2012, ETH Zurich. 8 * All rights reserved. 9 * 10 * This file is distributed under the terms in the attached LICENSE file. 11 * If you do not find this file, copies can be found by writing to: 12 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15#ifndef USERACCESS_H 16#define USERACCESS_H 17 18/** 19 * Type of access to a user space memory region. 20 */ 21#define ACCESS_READ 0 22#define ACCESS_WRITE 1 23 24/** 25 * Check the validity of the user space buffer. 26 * 27 * \param type Type of access to check: ACCESS_WRITE or ACCESS_READ. 28 * \param buffer Pointer to beginning of buffer. 29 * \param size Size of buffer. 30 */ 31bool access_ok(uint8_t type, lvaddr_t buffer, size_t size); 32 33/** 34 * Walk page tables to check if we can access region 35 * This needs to be implemented for every arch we support 36 */ 37bool paging_is_region_valid(lvaddr_t base, size_t npages, uint8_t type); 38 39#endif // USER_ACCESS_H 40