]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/AltiAssist.s
6bf24f4aa250be4b27c15acf33213a600d958bff
[apple/xnu.git] / osfmk / ppc / AltiAssist.s
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 AltiAssist.s
24
25 Do the VMX assists
26
27 Lovingly crafted by Bill Angell using traditional methods and only natural or recycled materials.
28 No animal products are used other than rendered otter bile and deep fried pork lard.
29
30 */
31
32 #include <ppc/asm.h>
33 #include <ppc/proc_reg.h>
34 #include <ppc/exception.h>
35 #include <mach/machine/vm_param.h>
36 #include <assym.s>
37
38 ;
39 ;
40 ; General stuff what happens here:
41 ; 1) All general context saved, interrupts off, translation off
42 ; 2) Vector and floating point disabled, but there may be live context.
43 ; This code is responsible for saving and restoring what is used. This
44 ; includes exception states, java mode, etc.
45 ; 3) No attempt is made to resolve page faults. PTE misses are handled
46 ; automatically, but actual faults (ala copyin/copyout) are not. If
47 ; a fault does occur, the exception that caused entry to the emulation
48 ; routine is remapped to either an instruction or data miss (depending
49 ; upon the stage detected) and redriven through the exception handler.
50 ; The only time that an instruction fault can happen is when a different
51 ; processor removes a mapping between our original fault and when we
52 ; fetch the assisted instruction. For an assisted instruction, data
53 ; faults should not occur (except in the MP case). For a purely
54 ; emulated instruction, faults can occur.
55 ;
56 ; Emulation algorithms cloned from MacOS 9 code.
57 ;
58 ; Assumes that R2 = per_proc_area
59 ;
60 ;
61
62
63 .align 5
64 .globl EXT(AltivecAssist)
65
66 LEXT(AltivecAssist)
67
68 li r10,emvr0 ; Point to the vector savearea
69
70 li r11,emvr1 ; Another savearea
71 stvxl v0,r10,r2 ; Save V0
72 stvxl v1,r11,r2 ; Save V1
73 vspltisw v0,1 ; Set a 1 in V0
74 vspltisw v1,8 ; Get half of the shift
75 vslw v0,v0,v1 ; Shift half way
76 vslw v0,v0,v1 ; Shift the rest of the way (we now have 0x00010000)
77 mfvscr v1 ; Get the VSCR
78 vor v1,v1,v0 ; Turn off Java mode
79 lvxl v0,r10,r2 ; Restore V0
80 mtvscr v1 ; Set Java mode off
81 lvxl v1,r11,r2 ; Restore V1
82
83 li r11,T_IN_VAIN ; We are all done
84 b EXT(EmulExit) ; We are done, no tracing on...
85
86
87
88