Subversion Repositories HelenOS-historic

Rev

Rev 982 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
860 decky 1
#
2
# Copyright (C) 2006 Martin Decky
3
# All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
7
# are met:
8
#
9
# - Redistributions of source code must retain the above copyright
10
#   notice, this list of conditions and the following disclaimer.
11
# - Redistributions in binary form must reproduce the above copyright
12
#   notice, this list of conditions and the following disclaimer in the
13
#   documentation and/or other materials provided with the distribution.
14
# - The name of the author may not be used to endorse or promote products
15
#   derived from this software without specific prior written permission.
16
#
17
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
28
 
29
#include <arch/asm/regname.h>
30
#include <arch/context_offset.h>
31
 
32
.text   
33
 
34
.global fpu_context_save
35
.global fpu_context_restore
36
 
37
.macro FPU_CONTEXT_STORE r
38
	stfd fr14, OFFSET_FR14(\r)
39
	stfd fr15, OFFSET_FR15(\r)
40
	stfd fr16, OFFSET_FR16(\r)
41
	stfd fr17, OFFSET_FR17(\r)
42
	stfd fr18, OFFSET_FR18(\r)
43
	stfd fr19, OFFSET_FR19(\r)
44
	stfd fr20, OFFSET_FR20(\r)
45
	stfd fr21, OFFSET_FR21(\r)
46
	stfd fr22, OFFSET_FR22(\r)
47
	stfd fr23, OFFSET_FR23(\r)
48
	stfd fr24, OFFSET_FR24(\r)
49
	stfd fr25, OFFSET_FR25(\r)
50
	stfd fr26, OFFSET_FR26(\r)
51
	stfd fr27, OFFSET_FR27(\r)
52
	stfd fr28, OFFSET_FR28(\r)
53
	stfd fr29, OFFSET_FR29(\r)
54
	stfd fr30, OFFSET_FR30(\r)
55
	stfd fr31, OFFSET_FR31(\r)
56
.endm
57
 
58
.macro FPU_CONTEXT_LOAD r
59
	lfd fr14, OFFSET_FR14(\r)
60
	lfd fr15, OFFSET_FR15(\r)
61
	lfd fr16, OFFSET_FR16(\r)
62
	lfd fr17, OFFSET_FR17(\r)
63
	lfd fr18, OFFSET_FR18(\r)
64
	lfd fr19, OFFSET_FR19(\r)
65
	lfd fr20, OFFSET_FR20(\r)
66
	lfd fr21, OFFSET_FR21(\r)
67
	lfd fr22, OFFSET_FR22(\r)
68
	lfd fr23, OFFSET_FR23(\r)
69
	lfd fr24, OFFSET_FR24(\r)
70
	lfd fr25, OFFSET_FR25(\r)
71
	lfd fr26, OFFSET_FR26(\r)
72
	lfd fr27, OFFSET_FR27(\r)
73
	lfd fr28, OFFSET_FR28(\r)
74
	lfd fr29, OFFSET_FR29(\r)
75
	lfd fr30, OFFSET_FR30(\r)
76
	lfd fr31, OFFSET_FR31(\r)
77
.endm
78
 
79
fpu_context_save:
80
	FPU_CONTEXT_STORE r3
81
 
82
	mffs fr0
83
	stfd fr0, OFFSET_FPSCR(r3)
84
 
85
	blr
86
 
87
fpu_context_restore:
88
	FPU_CONTEXT_LOAD r3
89
 
90
	lfd fr0, OFFSET_FPSCR(r3)
91
	mtfsf 7, fr0
92
 
93
	blr