Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / arch / arc / plat-eznps / ctop.c
1 /*
2  * Copyright(c) 2015 EZchip Technologies.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms and conditions of the GNU General Public License,
6  * version 2, as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  * more details.
12  *
13  * The full GNU General Public License is included in this distribution in
14  * the file called "COPYING".
15  */
16
17 #include <linux/sched.h>
18 #include <asm/processor.h>
19 #include <plat/ctop.h>
20
21 void dp_save_restore(struct task_struct *prev, struct task_struct *next)
22 {
23         struct eznps_dp *prev_task_dp = &prev->thread.dp;
24         struct eznps_dp *next_task_dp = &next->thread.dp;
25
26         /* Here we save all Data Plane related auxiliary registers */
27         prev_task_dp->eflags = read_aux_reg(CTOP_AUX_EFLAGS);
28         write_aux_reg(CTOP_AUX_EFLAGS, next_task_dp->eflags);
29
30         prev_task_dp->gpa1 = read_aux_reg(CTOP_AUX_GPA1);
31         write_aux_reg(CTOP_AUX_GPA1, next_task_dp->gpa1);
32 }