2018-09-07 16:00:13 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Atmosphère-NX
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-02-20 04:18:53 +00:00
|
|
|
#ifndef EXOSPHERE_USERPAGE_H
|
|
|
|
#define EXOSPHERE_USERPAGE_H
|
|
|
|
|
2018-02-25 14:05:52 +00:00
|
|
|
#include "utils.h"
|
|
|
|
#include "memory_map.h"
|
2018-02-20 04:18:53 +00:00
|
|
|
|
2018-02-26 21:09:35 +00:00
|
|
|
static inline uintptr_t get_user_page_secure_monitor_addr(void) {
|
|
|
|
return TZRAM_GET_SEGMENT_ADDRESS(TZRAM_SEGMENT_ID_USERPAGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define USER_PAGE_SECURE_MONITOR_ADDR (get_user_page_secure_monitor_addr())
|
2018-02-20 04:18:53 +00:00
|
|
|
|
|
|
|
typedef struct {
|
2018-02-25 14:05:52 +00:00
|
|
|
uintptr_t user_address;
|
|
|
|
uintptr_t secure_monitor_address;
|
2018-02-20 04:18:53 +00:00
|
|
|
} upage_ref_t;
|
|
|
|
|
2018-02-23 03:58:39 +00:00
|
|
|
bool upage_init(upage_ref_t *user_page, void *user_address);
|
2018-02-20 04:18:53 +00:00
|
|
|
|
2018-02-23 03:58:39 +00:00
|
|
|
bool user_copy_to_secure(upage_ref_t *user_page, void *secure_dst, void *user_src, size_t size);
|
|
|
|
bool secure_copy_to_user(upage_ref_t *user_page, void *user_dst, void *secure_src, size_t size);
|
2018-02-20 04:18:53 +00:00
|
|
|
|
2018-02-25 14:05:52 +00:00
|
|
|
#endif
|