diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2013-06-12 04:19:02 -0400 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2013-06-22 09:53:20 -0400 |
commit | 3e1ae441886b82fbf605f37ac0756b811d55f3d5 (patch) | |
tree | 36c7e28d41922288ae1b3a466cf851f7a64da68e /arch/arc/mm | |
parent | 3abc94480225677ea08af817d56edfb0df9e9b80 (diff) |
ARC: [mm] Remove @write argument to do_page_fault()
This can be ascertained within do_page_fault() since it gets the full
ECR (Exception Cause Register).
Further, for both the callers of do_page_fault(): Prot-V / D-TLB-Miss,
the cause sub-fields in ECR are same for same type of access, making the
code much more simpler.
D-TLB-Miss [LD] 0x00_21_01_00
Prot-V [LD] 0x00_23_01_00
^^
D-TLB-Miss [ST] 0x00_21_02_00
Prot-V [ST] 0x00_23_02_00
^^
D-TLB-Miss [EX] 0x00_21_03_00
Prot-V [EX] 0x00_23_03_00
^^
This helps code consolidation, which is even better when moving code from
assembler to "C".
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/mm')
-rw-r--r-- | arch/arc/mm/fault.c | 3 | ||||
-rw-r--r-- | arch/arc/mm/tlbex.S | 14 |
2 files changed, 4 insertions, 13 deletions
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index c0decc1f8d22..fdafeb1917cc 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c | |||
@@ -52,7 +52,7 @@ bad_area: | |||
52 | return 1; | 52 | return 1; |
53 | } | 53 | } |
54 | 54 | ||
55 | void do_page_fault(struct pt_regs *regs, int write, unsigned long address, | 55 | void do_page_fault(struct pt_regs *regs, unsigned long address, |
56 | unsigned long cause_code) | 56 | unsigned long cause_code) |
57 | { | 57 | { |
58 | struct vm_area_struct *vma = NULL; | 58 | struct vm_area_struct *vma = NULL; |
@@ -60,6 +60,7 @@ void do_page_fault(struct pt_regs *regs, int write, unsigned long address, | |||
60 | struct mm_struct *mm = tsk->mm; | 60 | struct mm_struct *mm = tsk->mm; |
61 | siginfo_t info; | 61 | siginfo_t info; |
62 | int fault, ret; | 62 | int fault, ret; |
63 | int write = cause_code & (1 << ECR_C_BIT_DTLB_ST_MISS); /* ST/EX */ | ||
63 | unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | | 64 | unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | |
64 | (write ? FAULT_FLAG_WRITE : 0); | 65 | (write ? FAULT_FLAG_WRITE : 0); |
65 | 66 | ||
diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S index 7bf811d51af8..bd8bc90f61d3 100644 --- a/arch/arc/mm/tlbex.S +++ b/arch/arc/mm/tlbex.S | |||
@@ -381,18 +381,8 @@ do_slow_path_pf: | |||
381 | 381 | ||
382 | ; ------- setup args for Linux Page fault Hanlder --------- | 382 | ; ------- setup args for Linux Page fault Hanlder --------- |
383 | mov_s r0, sp | 383 | mov_s r0, sp |
384 | lr r2, [efa] | 384 | lr r1, [efa] |
385 | lr r3, [ecr] | 385 | lr r2, [ecr] |
386 | |||
387 | ; Both st and ex imply WRITE access of some sort, hence do_page_fault( ) | ||
388 | ; invoked with write=1 for DTLB-st/ex Miss and write=0 for ITLB miss or | ||
389 | ; DTLB-ld Miss | ||
390 | ; DTLB Miss Cause code is ld = 0x01 , st = 0x02, ex = 0x03 | ||
391 | ; Following code uses that fact that st/ex have one bit in common | ||
392 | |||
393 | btst_s r3, ECR_C_BIT_DTLB_ST_MISS | ||
394 | mov.z r1, 0 | ||
395 | mov.nz r1, 1 | ||
396 | 386 | ||
397 | ; We don't want exceptions to be disabled while the fault is handled. | 387 | ; We don't want exceptions to be disabled while the fault is handled. |
398 | ; Now that we have saved the context we return from exception hence | 388 | ; Now that we have saved the context we return from exception hence |