]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * @OSF_COPYRIGHT@ | |
24 | */ | |
25 | ||
26 | #include <debug.h> | |
27 | #include <ppc/asm.h> | |
28 | #include <ppc/proc_reg.h> | |
29 | #include <mach/ppc/vm_param.h> | |
30 | #include <assym.s> | |
31 | ||
32 | /* void | |
33 | * db_phys_copy(src, dst, bytecount) | |
34 | * vm_offset_t src; | |
35 | * vm_offset_t dst; | |
36 | * int bytecount | |
37 | * | |
38 | * This routine will copy bytecount bytes from physical address src to physical | |
39 | * address dst. | |
40 | */ | |
41 | ENTRY(db_phys_copy, TAG_NO_FRAME_USED) | |
42 | ||
43 | /* Switch off data translations */ | |
44 | mfmsr r6 | |
45 | rlwinm r7, r6, 0, MSR_DR_BIT+1, MSR_DR_BIT-1 | |
46 | mtmsr r7 | |
47 | isync /* Ensure data translations are off */ | |
48 | ||
49 | subi r3, r3, 4 | |
50 | subi r4, r4, 4 | |
51 | ||
52 | cmpwi r5, 3 | |
53 | ble- .L_db_phys_copy_bytes | |
54 | .L_db_phys_copy_loop: | |
55 | lwz r0, 4(r3) | |
56 | addi r3, r3, 4 | |
57 | subi r5, r5, 4 | |
58 | stw r0, 4(r4) | |
59 | addi r4, r4, 4 | |
60 | cmpwi r5, 3 | |
61 | bgt+ .L_db_phys_copy_loop | |
62 | ||
63 | /* If no leftover bytes, we're done now */ | |
64 | cmpwi r5, 0 | |
65 | beq+ .L_db_phys_copy_done | |
66 | ||
67 | .L_db_phys_copy_bytes: | |
68 | addi r3, r3, 3 | |
69 | addi r4, r4, 3 | |
70 | .L_db_phys_copy_byte_loop: | |
71 | lbz r0, 1(r3) | |
72 | addi r3, r3, 1 | |
73 | subi r5, r5, 1 | |
74 | stb r0, 1(r4) | |
75 | addi r4, r4, 1 | |
76 | cmpwi r5, 0 | |
77 | bne+ .L_db_phys_copy_loop | |
78 | ||
79 | .L_db_phys_copy_done: | |
80 | mtmsr r6 /* Restore original translations */ | |
81 | isync /* Ensure data translations are off */ | |
82 | ||
83 | blr | |
84 | ||
85 | /* void | |
86 | * db_phys_cmp(src_a, src_b, bytecount) | |
87 | * vm_offset_t src_a; | |
88 | * vm_offset_t src_b; | |
89 | * int bytecount | |
90 | * | |
91 | * This routine will compare bytecount bytes from physical address src_a and physical | |
92 | * address src_b. | |
93 | */ | |
94 | ||
95 | /* Switch off data translations */ | |
96 | mfmsr r6 | |
97 | rlwinm r7, r6, 0, MSR_DR_BIT+1, MSR_DR_BIT-1 | |
98 | mtmsr r7 | |
99 | isync /* Ensure data translations are off */ | |
100 | ||
101 | subi r3, r3, 4 | |
102 | subi r4, r4, 4 | |
103 | ||
104 | cmpwi r5, 3 | |
105 | ble- .L_db_phys_cmp_bytes | |
106 | .L_db_phys_cmp_loop: | |
107 | lwz r0, 4(r3) | |
108 | lwz r7, 4(r4) | |
109 | addi r3, r3, 4 | |
110 | addi r4, r4, 4 | |
111 | subi r5, r5, 4 | |
112 | cmpw r0, r7 | |
113 | bne .L_db_phys_cmp_false | |
114 | cmpwi r5, 3 | |
115 | bgt+ .L_db_phys_cmp_loop | |
116 | ||
117 | /* If no leftover bytes, we're done now */ | |
118 | cmpwi r5, 0 | |
119 | beq+ .L_db_phys_cmp_true | |
120 | ||
121 | .L_db_phys_cmp_bytes: | |
122 | addi r3, r3, 3 | |
123 | addi r4, r4, 3 | |
124 | .L_db_phys_cmp_byte_loop: | |
125 | lbz r0, 1(r3) | |
126 | lbz r7, 1(r4) | |
127 | addi r3, r3, 1 | |
128 | addi r4, r4, 1 | |
129 | subi r5, r5, 1 | |
130 | cmpw r0, r7 | |
131 | bne .L_db_phys_cmp_false | |
132 | cmpwi r5, 0 | |
133 | bne+ .L_db_phys_cmp_loop | |
134 | ||
135 | .L_db_phys_cmp_true: | |
136 | li r3, 1 | |
137 | b .L_db_phys_cmp_done | |
138 | ||
139 | .L_db_phys_cmp_false: | |
140 | li r3, 0 | |
141 | ||
142 | .L_db_phys_cmp_done: | |
143 | mtmsr r6 /* Restore original translations */ | |
144 | isync /* Ensure data translations are off */ | |
145 | ||
146 | blr | |
147 |