]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
37839358 A |
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. | |
1c79356b | 11 | * |
37839358 A |
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 | |
1c79356b A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
37839358 A |
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. | |
1c79356b A |
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 | ||
1c79356b A |
32 | |
33 | /* void | |
34 | * db_phys_cmp(src_a, src_b, bytecount) | |
35 | * vm_offset_t src_a; | |
36 | * vm_offset_t src_b; | |
37 | * int bytecount | |
38 | * | |
39 | * This routine will compare bytecount bytes from physical address src_a and physical | |
40 | * address src_b. | |
41 | */ | |
42 | ||
55e303ae A |
43 | #warning THIS IS BROKEN FOR 64-BIT |
44 | ||
1c79356b | 45 | /* Switch off data translations */ |
55e303ae A |
46 | lis r7,hi16(MASK(MSR_VEC)) |
47 | ori r7,r7,lo16(MASK(MSR_FP)) | |
1c79356b | 48 | mfmsr r6 |
55e303ae A |
49 | andc r6,r6,r7 ; Force FP and vec off |
50 | ori r7,r7,lo16(MASK(MSR_DR)) ; Set the DR bit | |
51 | andc r7,r6,r7 ; Force DR off | |
1c79356b A |
52 | mtmsr r7 |
53 | isync /* Ensure data translations are off */ | |
54 | ||
55 | subi r3, r3, 4 | |
56 | subi r4, r4, 4 | |
57 | ||
58 | cmpwi r5, 3 | |
59 | ble- .L_db_phys_cmp_bytes | |
60 | .L_db_phys_cmp_loop: | |
61 | lwz r0, 4(r3) | |
62 | lwz r7, 4(r4) | |
63 | addi r3, r3, 4 | |
64 | addi r4, r4, 4 | |
65 | subi r5, r5, 4 | |
66 | cmpw r0, r7 | |
67 | bne .L_db_phys_cmp_false | |
68 | cmpwi r5, 3 | |
69 | bgt+ .L_db_phys_cmp_loop | |
70 | ||
71 | /* If no leftover bytes, we're done now */ | |
72 | cmpwi r5, 0 | |
73 | beq+ .L_db_phys_cmp_true | |
74 | ||
75 | .L_db_phys_cmp_bytes: | |
76 | addi r3, r3, 3 | |
77 | addi r4, r4, 3 | |
78 | .L_db_phys_cmp_byte_loop: | |
79 | lbz r0, 1(r3) | |
80 | lbz r7, 1(r4) | |
81 | addi r3, r3, 1 | |
82 | addi r4, r4, 1 | |
83 | subi r5, r5, 1 | |
84 | cmpw r0, r7 | |
85 | bne .L_db_phys_cmp_false | |
86 | cmpwi r5, 0 | |
87 | bne+ .L_db_phys_cmp_loop | |
88 | ||
89 | .L_db_phys_cmp_true: | |
90 | li r3, 1 | |
91 | b .L_db_phys_cmp_done | |
92 | ||
93 | .L_db_phys_cmp_false: | |
94 | li r3, 0 | |
95 | ||
96 | .L_db_phys_cmp_done: | |
97 | mtmsr r6 /* Restore original translations */ | |
98 | isync /* Ensure data translations are off */ | |
99 | ||
100 | blr | |
101 |