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