Commit | Line | Data |
---|---|---|
cf5adce1 DM |
1 | /* NG2page.S: Niagara-2 optimized clear and copy page. |
2 | * | |
3 | * Copyright (C) 2007 (davem@davemloft.net) | |
4 | */ | |
5 | ||
6 | #include <asm/asi.h> | |
7 | #include <asm/page.h> | |
8 | #include <asm/visasm.h> | |
9 | ||
10 | .text | |
11 | .align 32 | |
12 | ||
13 | /* This is heavily simplified from the sun4u variants | |
14 | * because Niagara-2 does not have any D-cache aliasing issues. | |
15 | */ | |
16 | NG2copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ | |
17 | prefetch [%o1 + 0x00], #one_read | |
18 | prefetch [%o1 + 0x40], #one_read | |
19 | VISEntryHalf | |
20 | set PAGE_SIZE, %g7 | |
21 | sub %o0, %o1, %g3 | |
22 | 1: stxa %g0, [%o1 + %g3] ASI_BLK_INIT_QUAD_LDD_P | |
23 | subcc %g7, 64, %g7 | |
24 | ldda [%o1] ASI_BLK_P, %f0 | |
25 | stda %f0, [%o1 + %g3] ASI_BLK_P | |
26 | add %o1, 64, %o1 | |
27 | bne,pt %xcc, 1b | |
28 | prefetch [%o1 + 0x40], #one_read | |
29 | membar #Sync | |
30 | VISExitHalf | |
31 | retl | |
32 | nop | |
33 | ||
34 | #define BRANCH_ALWAYS 0x10680000 | |
35 | #define NOP 0x01000000 | |
36 | #define NG_DO_PATCH(OLD, NEW) \ | |
37 | sethi %hi(NEW), %g1; \ | |
38 | or %g1, %lo(NEW), %g1; \ | |
39 | sethi %hi(OLD), %g2; \ | |
40 | or %g2, %lo(OLD), %g2; \ | |
41 | sub %g1, %g2, %g1; \ | |
42 | sethi %hi(BRANCH_ALWAYS), %g3; \ | |
43 | sll %g1, 11, %g1; \ | |
44 | srl %g1, 11 + 2, %g1; \ | |
45 | or %g3, %lo(BRANCH_ALWAYS), %g3; \ | |
46 | or %g3, %g1, %g3; \ | |
47 | stw %g3, [%g2]; \ | |
48 | sethi %hi(NOP), %g3; \ | |
49 | or %g3, %lo(NOP), %g3; \ | |
50 | stw %g3, [%g2 + 0x4]; \ | |
51 | flush %g2; | |
52 | ||
53 | .globl niagara2_patch_pageops | |
54 | .type niagara2_patch_pageops,#function | |
55 | niagara2_patch_pageops: | |
56 | NG_DO_PATCH(copy_user_page, NG2copy_user_page) | |
57 | NG_DO_PATCH(_clear_page, NGclear_page) | |
58 | NG_DO_PATCH(clear_user_page, NGclear_user_page) | |
59 | retl | |
60 | nop | |
61 | .size niagara2_patch_pageops,.-niagara2_patch_pageops |