Skip to contentSkip to conversation

csky: uaccess.h: Coding convention with asm generic

PATCH New [email protected] 1 participant 1 message Apr 28, 2021

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH v2 1/1 csky: uaccess.h: Coding convention with asm generic

From: Guo Ren <[email protected]>

Using asm-generic/uaccess.h to prevent duplicated code:
- Add user_addr_max which mentioned in generic uaccess.h
- Remove custom definitions of KERNEL/USER_DS, get/set_fs, uaccess_kerenl
- Using generic extable.h instead of custom definitions in uaccess.h

Change v2:
- Fixup tinyconfig compile error, "__put_user_bad"
- Add __get_user_asm_64

---
 arch/csky/include/asm/Kbuild    |   1 +
 arch/csky/include/asm/segment.h |   7 -
 arch/csky/include/asm/uaccess.h | 452 ++++++++++++----------------------------
 arch/csky/lib/usercopy.c        | 364 ++++++++++++++++++--------------
 arch/csky/mm/fault.c            |   2 +-
 5 files changed, 345 insertions(+), 481 deletions(-)
arch/csky/include/asm/Kbuild +1 -0
index cc24bb8..904a18a 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 generic-y += asm-offsets.h
+generic-y += extable.h
 generic-y += gpio.h
 generic-y += kvm_para.h
 generic-y += qrwlock.h
arch/csky/include/asm/segment.h +0 -7
index 589e832..5bc1cc62 100644
@@ -7,11 +7,4 @@ typedef struct {
 	unsigned long seg;
 } mm_segment_t;
 
-#define KERNEL_DS		((mm_segment_t) { 0xFFFFFFFF })
-
-#define USER_DS			((mm_segment_t) { PAGE_OFFSET })
-#define get_fs()		(current_thread_info()->addr_limit)
-#define set_fs(x)		(current_thread_info()->addr_limit = (x))
-#define uaccess_kernel()	(get_fs().seg == KERNEL_DS.seg)
-
 #endif /* __ASM_CSKY_SEGMENT_H */
arch/csky/include/asm/uaccess.h +132 -320

509 lines not on this page · raw message

arch/csky/lib/usercopy.c +211 -153

414 lines not on this page · raw message

arch/csky/mm/fault.c +1 -1
index 1482de5..466ad94 100644
@@ -12,7 +12,7 @@ int fixup_exception(struct pt_regs *regs)
 
 	fixup = search_exception_tables(instruction_pointer(regs));
 	if (fixup) {
-		regs->pc = fixup->nextinsn;
+		regs->pc = fixup->fixup;
 
 		return 1;
 	}
Signature · 1 line
2.7.4