mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 03:20:53 +07:00
aeb3987683
This is based upon a report from Chris Torek and his initial patch. From Chris's report: -------------------- This came up in testing kgdb, using the built-in tests -- turn on CONFIG_KGDB_TESTS, then echo V1 > /sys/module/kgdbts/parameters/kgdbts -- but it would affect using kgdb if you were debugging and looking at bad pointers. -------------------- When we get a copy_{from,to}_user() request and the %asi is set to something other than ASI_AIUS (which is userspace) then we branch off to a routine called memcpy_user_stub(). It just does a straight memcpy since we are copying from kernel to kernel in this case. The logic was that since source and destination are both kernel pointers we don't need to have exception checks. But for what probe_kernel_{read,write}() is trying to do, we have to have the checks, otherwise things like kgdb bad kernel pointer accesses don't do the right thing. Signed-off-by: David S. Miller <davem@davemloft.net>
36 lines
703 B
ArmAsm
36 lines
703 B
ArmAsm
/* NG2copy_from_user.S: Niagara-2 optimized copy from userspace.
|
|
*
|
|
* Copyright (C) 2007 David S. Miller (davem@davemloft.net)
|
|
*/
|
|
|
|
#define EX_LD(x) \
|
|
98: x; \
|
|
.section __ex_table,"a";\
|
|
.align 4; \
|
|
.word 98b, __retl_one_asi;\
|
|
.text; \
|
|
.align 4;
|
|
|
|
#ifndef ASI_AIUS
|
|
#define ASI_AIUS 0x11
|
|
#endif
|
|
|
|
#ifndef ASI_BLK_AIUS_4V
|
|
#define ASI_BLK_AIUS_4V 0x17
|
|
#endif
|
|
|
|
#define FUNC_NAME NG2copy_from_user
|
|
#define LOAD(type,addr,dest) type##a [addr] %asi, dest
|
|
#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_AIUS_4V, dest
|
|
#define EX_RETVAL(x) 0
|
|
|
|
#ifdef __KERNEL__
|
|
#define PREAMBLE \
|
|
rd %asi, %g1; \
|
|
cmp %g1, ASI_AIUS; \
|
|
bne,pn %icc, ___copy_in_user; \
|
|
nop
|
|
#endif
|
|
|
|
#include "NG2memcpy.S"
|