]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
8ad349bb | 4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ |
1c79356b | 5 | * |
8ad349bb A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the | |
10 | * License may not be used to create, or enable the creation or | |
11 | * redistribution of, unlawful or unlicensed copies of an Apple operating | |
12 | * system, or to circumvent, violate, or enable the circumvention or | |
13 | * violation of, any terms of an Apple operating system software license | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
20 | * The Original Code and all software distributed under the License are | |
21 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
22 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
23 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
25 | * Please see the License for the specific language governing rights and | |
26 | * limitations under the License. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
1c79356b A |
29 | */ |
30 | /* | |
31 | * @OSF_COPYRIGHT@ | |
32 | */ | |
33 | ||
34 | #include <debug.h> | |
35 | #include <ppc/asm.h> | |
36 | #include <ppc/proc_reg.h> | |
37 | #include <mach/ppc/vm_param.h> | |
38 | #include <assym.s> | |
39 | ||
1c79356b A |
40 | |
41 | /* void | |
42 | * db_phys_cmp(src_a, src_b, bytecount) | |
43 | * vm_offset_t src_a; | |
44 | * vm_offset_t src_b; | |
45 | * int bytecount | |
46 | * | |
47 | * This routine will compare bytecount bytes from physical address src_a and physical | |
48 | * address src_b. | |
49 | */ | |
50 | ||
55e303ae A |
51 | #warning THIS IS BROKEN FOR 64-BIT |
52 | ||
1c79356b | 53 | /* Switch off data translations */ |
55e303ae A |
54 | lis r7,hi16(MASK(MSR_VEC)) |
55 | ori r7,r7,lo16(MASK(MSR_FP)) | |
1c79356b | 56 | mfmsr r6 |
55e303ae A |
57 | andc r6,r6,r7 ; Force FP and vec off |
58 | ori r7,r7,lo16(MASK(MSR_DR)) ; Set the DR bit | |
59 | andc r7,r6,r7 ; Force DR off | |
1c79356b A |
60 | mtmsr r7 |
61 | isync /* Ensure data translations are off */ | |
62 | ||
63 | subi r3, r3, 4 | |
64 | subi r4, r4, 4 | |
65 | ||
66 | cmpwi r5, 3 | |
67 | ble- .L_db_phys_cmp_bytes | |
68 | .L_db_phys_cmp_loop: | |
69 | lwz r0, 4(r3) | |
70 | lwz r7, 4(r4) | |
71 | addi r3, r3, 4 | |
72 | addi r4, r4, 4 | |
73 | subi r5, r5, 4 | |
74 | cmpw r0, r7 | |
75 | bne .L_db_phys_cmp_false | |
76 | cmpwi r5, 3 | |
77 | bgt+ .L_db_phys_cmp_loop | |
78 | ||
79 | /* If no leftover bytes, we're done now */ | |
80 | cmpwi r5, 0 | |
81 | beq+ .L_db_phys_cmp_true | |
82 | ||
83 | .L_db_phys_cmp_bytes: | |
84 | addi r3, r3, 3 | |
85 | addi r4, r4, 3 | |
86 | .L_db_phys_cmp_byte_loop: | |
87 | lbz r0, 1(r3) | |
88 | lbz r7, 1(r4) | |
89 | addi r3, r3, 1 | |
90 | addi r4, r4, 1 | |
91 | subi r5, r5, 1 | |
92 | cmpw r0, r7 | |
93 | bne .L_db_phys_cmp_false | |
94 | cmpwi r5, 0 | |
95 | bne+ .L_db_phys_cmp_loop | |
96 | ||
97 | .L_db_phys_cmp_true: | |
98 | li r3, 1 | |
99 | b .L_db_phys_cmp_done | |
100 | ||
101 | .L_db_phys_cmp_false: | |
102 | li r3, 0 | |
103 | ||
104 | .L_db_phys_cmp_done: | |
105 | mtmsr r6 /* Restore original translations */ | |
106 | isync /* Ensure data translations are off */ | |
107 | ||
108 | blr | |
109 |