summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/m32r/context_switch.S
blob: dd95a461fba8855e0fd56c0d016a61a637fa1c1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 *  Context switch for the Reneas M32C
 *
 *  COPYRIGHT (c) 1989-2008.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 *
 *  $Id$
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#define ARG_EXECUTING 8
#define ARG_HEIR      12

#define CONTEXT_R8       0x00
#define CONTEXT_R9       0x04
#define CONTEXT_R10      0x08
#define CONTEXT_R11      0x0C
#define CONTEXT_R12      0x10
#define CONTEXT_R13_FP   0x14
#define CONTEXT_R14_LR   0x18
#define CONTEXT_R15_SP   0x1C
#define CONTEXT_ACC_LOW  0x20
#define CONTEXT_ACC_HIGH 0x24

	.file	"context_switch.S"
	.text
	.global	_CPU_Context_switch
	.type	_CPU_Context_switch, @function
_CPU_Context_switch:
	st      r8,  @(CONTEXT_R8,r0)
	st      r9,  @(CONTEXT_R9,r0)
	st      r10, @(CONTEXT_R10,r0)
	st      r11, @(CONTEXT_R11,r0)
	st      r12, @(CONTEXT_R12,r0)
	st      r13, @(CONTEXT_R13_FP,r0)
	st      r14, @(CONTEXT_R14_LR,r0)
	st      r15, @(CONTEXT_R15_SP,r0)
        mvfaclo r2
	st      r2,  @(CONTEXT_ACC_LOW,r0)
        mvfachi r2
	st      r2,  @(CONTEXT_ACC_HIGH,r0)

restore:
	ld      r8,  @(CONTEXT_R8,r1)
	ld      r9,  @(CONTEXT_R9,r1)
	ld      r10, @(CONTEXT_R10,r1)
	ld      r11, @(CONTEXT_R11,r1)
	ld      r12, @(CONTEXT_R12,r1)
	ld      r13, @(CONTEXT_R13_FP,r1)
	ld      r14, @(CONTEXT_R14_LR,r1)
	ld      r15, @(CONTEXT_R15_SP,r1)
	ld      r2,  @(CONTEXT_ACC_LOW,r1)
        mvtaclo r2
	ld      r2,  @(CONTEXT_ACC_HIGH,r1)
        mvtachi r2
        jmp     lr	

	.global	_CPU_Context_Restart_self
	.type	_CPU_Context_Restart_self, @function
_CPU_Context_Restart_self:
	mv	r1, r0
	bra	restore