aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300/kernel/switch_to.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mn10300/kernel/switch_to.S')
-rw-r--r--arch/mn10300/kernel/switch_to.S71
1 files changed, 71 insertions, 0 deletions
diff --git a/arch/mn10300/kernel/switch_to.S b/arch/mn10300/kernel/switch_to.S
new file mode 100644
index 000000000000..630aad71b946
--- /dev/null
+++ b/arch/mn10300/kernel/switch_to.S
@@ -0,0 +1,71 @@
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>
18
19 .text
20
21###############################################################################
22#
23# struct task_struct *__switch_to(struct thread_struct *prev,
24# struct thread_struct *next,
25# struct task_struct *prev_task)
26#
27###############################################################################
28ENTRY(__switch_to)
29 movm [d2,d3,a2,a3,exreg1],(sp)
30 or EPSW_NMID,epsw
31
32 mov (44,sp),d2
33
34 mov d0,a0
35 mov d1,a1
36
37 # save prev context
38 mov (__frame),d0
39 mov d0,(THREAD_FRAME,a0)
40 mov __switch_back,d0
41 mov d0,(THREAD_PC,a0)
42 mov sp,a2
43 mov a2,(THREAD_SP,a0)
44 mov a3,(THREAD_A3,a0)
45
46 mov (THREAD_A3,a1),a3
47 mov (THREAD_SP,a1),a2
48
49 # switch
50 mov a2,sp
51
52 # load next context
53 GET_THREAD_INFO a2
54 mov a2,(__current_ti)
55 mov (TI_task,a2),a2
56 mov a2,(__current)
57#ifdef CONFIG_MN10300_CURRENT_IN_E2
58 mov a2,e2
59#endif
60
61 mov (THREAD_FRAME,a1),a2
62 mov a2,(__frame)
63 mov (THREAD_PC,a1),a2
64 mov d2,d0 # for ret_from_fork
65 mov d0,a0 # for __switch_to
66
67 jmp (a2)
68
69__switch_back:
70 and ~EPSW_NMID,epsw
71 ret [d2,d3,a2,a3,exreg1],32