* [PATCH 0/2] nds32:Renaming file and fixing the unaligned access handler
@ 2018-05-07 6:45 Nickhu
2018-05-07 6:45 ` [PATCH 1/2] nds32: Renaming the file for unaligned access Nickhu
2018-05-07 6:45 ` [PATCH 2/2] nds32: Fix the unaligned access handler Nickhu
0 siblings, 2 replies; 5+ messages in thread
From: Nickhu @ 2018-05-07 6:45 UTC (permalink / raw)
To: greentime, linux-kernel, arnd, green.hu, vincentc; +Cc: Nickhu
The name of /proc/sys/nds32/unaligned_acess spelled wrong, so we renaming it
to /proc/sys/nds32/unaligned_access.
The unaligned access handler in nds32 goes wrong when the immediate field of
load/store instruction is negative. We fix it by recongnizing whether the
immediate field is positive or negative and then change the value of immediate
filed to unsigned integer number.
Nickhu (2):
nds32: Renaming the file for unaligned access
nds32: Fix the unaligned access handler
arch/nds32/mm/alignment.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--
2.17.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] nds32: Renaming the file for unaligned access
2018-05-07 6:45 [PATCH 0/2] nds32:Renaming file and fixing the unaligned access handler Nickhu
@ 2018-05-07 6:45 ` Nickhu
2018-05-08 13:45 ` Greentime Hu
2018-05-07 6:45 ` [PATCH 2/2] nds32: Fix the unaligned access handler Nickhu
1 sibling, 1 reply; 5+ messages in thread
From: Nickhu @ 2018-05-07 6:45 UTC (permalink / raw)
To: greentime, linux-kernel, arnd, green.hu, vincentc; +Cc: Nickhu
Change the name of the file '/proc/sys/nds32/unaligned_acess'
to '/proc/sys/nds32/unaligned_access'
Signed-off-by: Nickhu <nickhu@andestech.com>
---
arch/nds32/mm/alignment.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/nds32/mm/alignment.c b/arch/nds32/mm/alignment.c
index b96a01b10ca7..e515f6f3d247 100644
--- a/arch/nds32/mm/alignment.c
+++ b/arch/nds32/mm/alignment.c
@@ -552,7 +552,7 @@ static struct ctl_table alignment_tbl[3] = {
static struct ctl_table nds32_sysctl_table[2] = {
{
- .procname = "unaligned_acess",
+ .procname = "unaligned_access",
.mode = 0555,
.child = alignment_tbl},
{}
--
2.17.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] nds32: Fix the unaligned access handler
2018-05-07 6:45 [PATCH 0/2] nds32:Renaming file and fixing the unaligned access handler Nickhu
2018-05-07 6:45 ` [PATCH 1/2] nds32: Renaming the file for unaligned access Nickhu
@ 2018-05-07 6:45 ` Nickhu
2018-05-08 13:44 ` Greentime Hu
1 sibling, 1 reply; 5+ messages in thread
From: Nickhu @ 2018-05-07 6:45 UTC (permalink / raw)
To: greentime, linux-kernel, arnd, green.hu, vincentc; +Cc: Nickhu
If the kernel config 'CONFIG_ALIGNMENT_TRAP' and the file
'/proc/sys/nds32/unaligned_access/enable' are set, the kernel
unaligned access handler does not handle correctly when the
value of immediate field is negative. This commit fixes the
unaligned access handler in kernel.
Signed-off-by: Nickhu <nickhu@andestech.com>
---
arch/nds32/mm/alignment.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/nds32/mm/alignment.c b/arch/nds32/mm/alignment.c
index e515f6f3d247..e1aed9dc692d 100644
--- a/arch/nds32/mm/alignment.c
+++ b/arch/nds32/mm/alignment.c
@@ -19,7 +19,7 @@
#define RA(inst) (((inst) >> 15) & 0x1FUL)
#define RB(inst) (((inst) >> 10) & 0x1FUL)
#define SV(inst) (((inst) >> 8) & 0x3UL)
-#define IMM(inst) (((inst) >> 0) & 0x3FFFUL)
+#define IMM(inst) (((inst) >> 0) & 0x7FFFUL)
#define RA3(inst) (((inst) >> 3) & 0x7UL)
#define RT3(inst) (((inst) >> 6) & 0x7UL)
@@ -28,6 +28,9 @@
#define RA5(inst) (((inst) >> 0) & 0x1FUL)
#define RT4(inst) (((inst) >> 5) & 0xFUL)
+#define GET_IMMSVAL(imm_value) \
+ (((imm_value >> 14) & 0x1) ? (imm_value - 0x8000) : imm_value)
+
#define __get8_data(val,addr,err) \
__asm__( \
"1: lbi.bi %1, [%2], #1\n" \
@@ -467,7 +470,7 @@ static inline int do_32(unsigned long inst, struct pt_regs *regs)
}
if (imm)
- shift = IMM(inst) * len;
+ shift = GET_IMMSVAL(IMM(inst)) * len;
else
shift = *idx_to_addr(regs, RB(inst)) << SV(inst);
--
2.17.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] nds32: Fix the unaligned access handler
2018-05-07 6:45 ` [PATCH 2/2] nds32: Fix the unaligned access handler Nickhu
@ 2018-05-08 13:44 ` Greentime Hu
0 siblings, 0 replies; 5+ messages in thread
From: Greentime Hu @ 2018-05-08 13:44 UTC (permalink / raw)
To: Nickhu; +Cc: Greentime, Linux Kernel Mailing List, Arnd Bergmann, Vincent Chen
2018-05-07 14:45 GMT+08:00 Nickhu <nickhu@andestech.com>:
> If the kernel config 'CONFIG_ALIGNMENT_TRAP' and the file
> '/proc/sys/nds32/unaligned_access/enable' are set, the kernel
> unaligned access handler does not handle correctly when the
> value of immediate field is negative. This commit fixes the
> unaligned access handler in kernel.
>
> Signed-off-by: Nickhu <nickhu@andestech.com>
Thank you, Nick.
Reviewed-by: Greentime Hu <greentime@andestech.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] nds32: Renaming the file for unaligned access
2018-05-07 6:45 ` [PATCH 1/2] nds32: Renaming the file for unaligned access Nickhu
@ 2018-05-08 13:45 ` Greentime Hu
0 siblings, 0 replies; 5+ messages in thread
From: Greentime Hu @ 2018-05-08 13:45 UTC (permalink / raw)
To: Nickhu; +Cc: Greentime, Linux Kernel Mailing List, Arnd Bergmann, Vincent Chen
2018-05-07 14:45 GMT+08:00 Nickhu <nickhu@andestech.com>:
> Change the name of the file '/proc/sys/nds32/unaligned_acess'
> to '/proc/sys/nds32/unaligned_access'
>
> Signed-off-by: Nickhu <nickhu@andestech.com>
Thank you, Nick.
Reviewed-by: Greentime Hu <greentime@andestech.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-05-08 13:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-07 6:45 [PATCH 0/2] nds32:Renaming file and fixing the unaligned access handler Nickhu
2018-05-07 6:45 ` [PATCH 1/2] nds32: Renaming the file for unaligned access Nickhu
2018-05-08 13:45 ` Greentime Hu
2018-05-07 6:45 ` [PATCH 2/2] nds32: Fix the unaligned access handler Nickhu
2018-05-08 13:44 ` Greentime Hu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.