]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/AltiAssist.s
2f5d931fcfb5057925ffd593daf94ed49726c3ab
[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 * 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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 AltiAssist.s
25
26 Do the VMX assists
27
28 Lovingly crafted by Bill Angell using traditional methods and only natural or recycled materials.
29 No animal products are used other than rendered otter bile and deep fried pork lard.
30
31 */
32
33 #include <ppc/asm.h>
34 #include <ppc/proc_reg.h>
35 #include <ppc/exception.h>
36 #include <mach/machine/vm_param.h>
37 #include <assym.s>
38
39 ;
40 ;
41 ; General stuff what happens here:
42 ; 1) All general context saved, interrupts off, translation off
43 ; 2) Vector and floating point disabled, but there may be live context.
44 ; This code is responsible for saving and restoring what is used. This
45 ; includes exception states, java mode, etc.
46 ; 3) No attempt is made to resolve page faults. PTE misses are handled
47 ; automatically, but actual faults (ala copyin/copyout) are not. If
48 ; a fault does occur, the exception that caused entry to the emulation
49 ; routine is remapped to either an instruction or data miss (depending
50 ; upon the stage detected) and redriven through the exception handler.
51 ; The only time that an instruction fault can happen is when a different
52 ; processor removes a mapping between our original fault and when we
53 ; fetch the assisted instruction. For an assisted instruction, data
54 ; faults should not occur (except in the MP case). For a purely
55 ; emulated instruction, faults can occur.
56 ;
57 ; Emulation algorithms cloned from MacOS 9 code.
58 ;
59 ; Assumes that R2 = per_proc_area
60 ;
61 ;
62
63
64 .align 5
65 .globl EXT(AltivecAssist)
66
67 LEXT(AltivecAssist)
68
69 li r10,emvr0 ; Point to the vector savearea
70
71 li r11,emvr1 ; Another savearea
72 stvxl v0,r10,r2 ; Save V0
73 stvxl v1,r11,r2 ; Save V1
74 vspltisw v0,1 ; Set a 1 in V0
75 vspltisw v1,8 ; Get half of the shift
76 vslw v0,v0,v1 ; Shift half way
77 vslw v0,v0,v1 ; Shift the rest of the way (we now have 0x00010000)
78 mfvscr v1 ; Get the VSCR
79 vor v1,v1,v0 ; Turn off Java mode
80 lvxl v0,r10,r2 ; Restore V0
81 mtvscr v1 ; Set Java mode off
82 lvxl v1,r11,r2 ; Restore V1
83
84 li r11,T_IN_VAIN ; We are all done
85 b EXT(EmulExit) ; We are done, no tracing on...
86
87
88
89