• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU)
3  * Licensed under the Mulan PSL v2.
4  * You can use this software according to the terms and conditions of the Mulan PSL v2.
5  * You may obtain a copy of Mulan PSL v2 at:
6  *     http://license.coscl.org.cn/MulanPSL2
7  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
8  * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
9  * PURPOSE.
10  * See the Mulan PSL v2 for more details.
11  */
12 #include <common/util.h>
13 #include <common/vars.h>
14 #include <common/types.h>
15 #include <common/kprint.h>
16 #include <common/macro.h>
17 
18 /*
19  * Currently, we enable EL1 (kernel) to directly access EL0 (user)  memory.
20  * But, El1 cannot execute EL0 code.
21  */
22 
23 #ifndef FBINFER
24 
copy_from_user(void * kernel_buf,void * user_buf,size_t size)25 int copy_from_user(void *kernel_buf, void *user_buf, size_t size)
26 {
27     /* validate user_buf */
28     BUG_ON((u64)user_buf >= KBASE);
29     return __copy_from_user(kernel_buf, user_buf, size);
30 }
31 
copy_to_user(void * user_buf,void * kernel_buf,size_t size)32 int copy_to_user(void *user_buf, void *kernel_buf, size_t size)
33 {
34     /* validate user_buf */
35     BUG_ON((u64)user_buf >= KBASE);
36     return __copy_to_user(user_buf, kernel_buf, size);
37 }
38 
39 #endif
40