Skip to content

Commit 664eec4

Browse files
author
Greentime Hu
committed
nds32: MMU fault handling and page table management
This patch includes page fault handler, mmap and fixup implementations. Signed-off-by: Vincent Chen <vincentc@andestech.com> Signed-off-by: Greentime Hu <greentime@andestech.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
1 parent 59fd53c commit 664eec4

4 files changed

Lines changed: 536 additions & 0 deletions

File tree

‎arch/nds32/lib/copy_page.S‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Copyright (C) 2005-2017 Andes Technology Corporation
3+
4+
#include <linux/linkage.h>
5+
#include <asm/page.h>
6+
7+
.text
8+
ENTRY(copy_page)
9+
pushm $r2, $r10
10+
movi $r2, PAGE_SIZE >> 5
11+
.Lcopy_loop:
12+
lmw.bim $r3, [$r1], $r10
13+
smw.bim $r3, [$r0], $r10
14+
subi45 $r2, #1
15+
bnez38 $r2, .Lcopy_loop
16+
popm $r2, $r10
17+
ret
18+
ENDPROC(copy_page)
19+
20+
ENTRY(clear_page)
21+
pushm $r1, $r9
22+
movi $r1, PAGE_SIZE >> 5
23+
movi55 $r2, #0
24+
movi55 $r3, #0
25+
movi55 $r4, #0
26+
movi55 $r5, #0
27+
movi55 $r6, #0
28+
movi55 $r7, #0
29+
movi55 $r8, #0
30+
movi55 $r9, #0
31+
.Lclear_loop:
32+
smw.bim $r2, [$r0], $r9
33+
subi45 $r1, #1
34+
bnez38 $r1, .Lclear_loop
35+
popm $r1, $r9
36+
ret
37+
ENDPROC(clear_page)

‎arch/nds32/mm/extable.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Copyright (C) 2005-2017 Andes Technology Corporation
3+
4+
#include <linux/extable.h>
5+
#include <linux/uaccess.h>
6+
7+
int fixup_exception(struct pt_regs *regs)
8+
{
9+
const struct exception_table_entry *fixup;
10+
11+
fixup = search_exception_tables(instruction_pointer(regs));
12+
if (fixup)
13+
regs->ipc = fixup->fixup;
14+
15+
return fixup != NULL;
16+
}

0 commit comments

Comments
 (0)