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 72