Commit | Line | Data |
---|---|---|
b920de1b DH |
1 | ############################################################################### |
2 | # | |
3 | # MN10300 Context switch operation | |
4 | # | |
5 | # Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | |
6 | # Written by David Howells (dhowells@redhat.com) | |
7 | # | |
8 | # This program is free software; you can redistribute it and/or | |
9 | # modify it under the terms of the GNU General Public Licence | |
10 | # as published by the Free Software Foundation; either version | |
11 | # 2 of the Licence, or (at your option) any later version. | |
12 | # | |
13 | ############################################################################### | |
14 | #include <linux/sys.h> | |
15 | #include <linux/linkage.h> | |
16 | #include <asm/thread_info.h> | |
17 | #include <asm/cpu-regs.h> | |
368dd5ac AT |
18 | #ifdef CONFIG_SMP |
19 | #include <proc/smp-regs.h> | |
20 | #endif /* CONFIG_SMP */ | |
b920de1b DH |
21 | |
22 | .text | |
23 | ||
24 | ############################################################################### | |
25 | # | |
26 | # struct task_struct *__switch_to(struct thread_struct *prev, | |
27 | # struct thread_struct *next, | |
28 | # struct task_struct *prev_task) | |
29 | # | |
30 | ############################################################################### | |
31 | ENTRY(__switch_to) | |
32 | movm [d2,d3,a2,a3,exreg1],(sp) | |
33 | or EPSW_NMID,epsw | |
34 | ||
35 | mov (44,sp),d2 | |
36 | ||
37 | mov d0,a0 | |
38 | mov d1,a1 | |
39 | ||
40 | # save prev context | |
b920de1b DH |
41 | mov __switch_back,d0 |
42 | mov d0,(THREAD_PC,a0) | |
43 | mov sp,a2 | |
44 | mov a2,(THREAD_SP,a0) | |
45 | mov a3,(THREAD_A3,a0) | |
46 | ||
47 | mov (THREAD_A3,a1),a3 | |
48 | mov (THREAD_SP,a1),a2 | |
49 | ||
50 | # switch | |
51 | mov a2,sp | |
52 | ||
53 | # load next context | |
54 | GET_THREAD_INFO a2 | |
55 | mov a2,(__current_ti) | |
56 | mov (TI_task,a2),a2 | |
57 | mov a2,(__current) | |
58 | #ifdef CONFIG_MN10300_CURRENT_IN_E2 | |
59 | mov a2,e2 | |
60 | #endif | |
61 | ||
b920de1b DH |
62 | mov (THREAD_PC,a1),a2 |
63 | mov d2,d0 # for ret_from_fork | |
64 | mov d0,a0 # for __switch_to | |
65 | ||
66 | jmp (a2) | |
67 | ||
68 | __switch_back: | |
69 | and ~EPSW_NMID,epsw | |
70 | ret [d2,d3,a2,a3,exreg1],32 |