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