| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: context.S,v 1.3 2009/11/27 03:23:10 rmind Exp $ */ | | 1 | /* $NetBSD: context.S,v 1.4 2013/01/15 13:43:27 kiyohara Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2003 Marcel Moolenaar | | 4 | * Copyright (c) 2003 Marcel Moolenaar |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * | | 10 | * |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -18,27 +18,26 @@ | | | @@ -18,27 +18,26 @@ |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | * | | 27 | * |
28 | * $FreeBSD: src/sys/ia64/ia64/context.S,v 1.3 2003/07/02 12:57:07 ru Exp $ | | 28 | * $FreeBSD: src/sys/ia64/ia64/context.S,v 1.3 2003/07/02 12:57:07 ru Exp $ |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | #include <sys/cdefs.h> | | | |
32 | #include <machine/asm.h> | | 31 | #include <machine/asm.h> |
33 | #include "assym.h" | | 32 | #include "assym.h" |
34 | | | 33 | |
35 | .text | | 34 | .text |
36 | | | 35 | |
37 | /* | | 36 | /* |
38 | * void restorectx(struct pcb *) | | 37 | * void restorectx(struct pcb *) |
39 | */ | | 38 | */ |
40 | ENTRY(restorectx, 1) | | 39 | ENTRY(restorectx, 1) |
41 | { .mmi | | 40 | { .mmi |
42 | invala | | 41 | invala |
43 | mov ar.rsc=0 | | 42 | mov ar.rsc=0 |
44 | add r31=8,r32 | | 43 | add r31=8,r32 |
| @@ -821,33 +820,39 @@ ENTRY(cpu_switchto, 3) | | | @@ -821,33 +820,39 @@ ENTRY(cpu_switchto, 3) |
821 | /* | | 820 | /* |
822 | * Save old context, unless the LWP is exiting. | | 821 | * Save old context, unless the LWP is exiting. |
823 | */ | | 822 | */ |
824 | cmp.eq p6,p0=r0,in0 // p6 = (in0 == 0) | | 823 | cmp.eq p6,p0=r0,in0 // p6 = (in0 == 0) |
825 | add r14=PC_CURLWP,r13 // r2 = &ci->ci_curlwp | | 824 | add r14=PC_CURLWP,r13 // r2 = &ci->ci_curlwp |
826 | ;; | | 825 | ;; |
827 | } | | 826 | } |
828 | { .mii | | 827 | { .mii |
829 | add r2=L_PCB,in0 // r2 = lwp_getpcb(&oldlwp) | | 828 | add r2=L_PCB,in0 // r2 = lwp_getpcb(&oldlwp) |
830 | add r3=L_PCB,in1 // r3 = lwp_getpcb(&newlwp) | | 829 | add r3=L_PCB,in1 // r3 = lwp_getpcb(&newlwp) |
831 | mov loc1=rp // save rp (loc1 = rp) | | 830 | mov loc1=rp // save rp (loc1 = rp) |
832 | ;; | | 831 | ;; |
833 | } | | 832 | } |
| | | 833 | { .mmi |
| | | 834 | st8 [r14]=in1 // ci->ci_curlwp = newlwp |
| | | 835 | mov r9=in0 // r9 = oldlwp |
| | | 836 | nop 0 |
| | | 837 | ;; |
| | | 838 | } |
834 | { .mmb | | 839 | { .mmb |
| | | 840 | nop 0 |
835 | /* | | 841 | /* |
836 | * Switch to new context, if p6 == true. | | 842 | * Switch to new context, if p6 == true. |
837 | * We assum to return to restorectx_return_here for swapped context. | | 843 | * We assum to return to restorectx_return_here for swapped context. |
838 | */ | | 844 | */ |
839 | (p6) ld8 out0=[r3] // if (p6) out0 = pcb of &newlwp | | 845 | (p6) ld8 out0=[r3] // out0 = pcb of &newlwp |
840 | xchg8 r9=[r14],in1 // ci->ci_curlwp = newlwp | | | |
841 | (p6) br.call.sptk.many rp=restorectx // if (p6) restorectx(out0) | | 846 | (p6) br.call.sptk.many rp=restorectx // if (p6) restorectx(out0) |
842 | ;; | | 847 | ;; |
843 | } | | 848 | } |
844 | { .mmb | | 849 | { .mmb |
845 | /* | | 850 | /* |
846 | * Swap to new context. | | 851 | * Swap to new context. |
847 | */ | | 852 | */ |
848 | ld8 out0=[r2] | | 853 | ld8 out0=[r2] |
849 | ld8 out1=[r3] | | 854 | ld8 out1=[r3] |
850 | br.call.sptk.many rp=swapctx | | 855 | br.call.sptk.many rp=swapctx |
851 | ;; | | 856 | ;; |
852 | } | | 857 | } |
853 | | | 858 | |