source: mainline/arch/sparc64/src/context.S@ 0172eba

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 0172eba was 2ccd275, checked in by Jakub Jermar <jakub@…>, 20 years ago

Changes in build system.
For .S targets, always do -DASM.
Remove unnecessary #define ASM from various *.S files.
At the end of build, generate disassembler dump for kernel.raw.

ia64 work.
Better General Exception handler.

  • Property mode set to 100644
File size: 2.6 KB
Line 
1#
2# Copyright (C) 2005 Jakub Jermar
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/context_offset.h>
30
31.text
32
33.global context_save_arch
34.global context_restore_arch
35
36.macro CONTEXT_STORE r
37 stx %l0, [\r + OFFSET_L0]
38 stx %l1, [\r + OFFSET_L1]
39 stx %l2, [\r + OFFSET_L2]
40 stx %l3, [\r + OFFSET_L3]
41 stx %l4, [\r + OFFSET_L4]
42 stx %l5, [\r + OFFSET_L5]
43 stx %l6, [\r + OFFSET_L6]
44 stx %l7, [\r + OFFSET_L7]
45 stx %i1, [\r + OFFSET_I1]
46 stx %i2, [\r + OFFSET_I2]
47 stx %i3, [\r + OFFSET_I3]
48 stx %i4, [\r + OFFSET_I4]
49 stx %i5, [\r + OFFSET_I5]
50 stx %i6, [\r + OFFSET_SP]
51 stx %i7, [\r + OFFSET_PC]
52.endm
53
54.macro CONTEXT_LOAD r
55 ldx [\r + OFFSET_L0], %l0
56 ldx [\r + OFFSET_L1], %l1
57 ldx [\r + OFFSET_L2], %l2
58 ldx [\r + OFFSET_L3], %l3
59 ldx [\r + OFFSET_L4], %l4
60 ldx [\r + OFFSET_L5], %l5
61 ldx [\r + OFFSET_L6], %l6
62 ldx [\r + OFFSET_L7], %l7
63 ldx [\r + OFFSET_I1], %i1
64 ldx [\r + OFFSET_I2], %i2
65 ldx [\r + OFFSET_I3], %i3
66 ldx [\r + OFFSET_I4], %i4
67 ldx [\r + OFFSET_I5], %i5
68 ldx [\r + OFFSET_SP], %i6
69 ldx [\r + OFFSET_PC], %i7
70 ldx [\r + OFFSET_SP], %sp
71.endm
72
73
74context_save_arch:
75 save %sp, -128, %sp
76 CONTEXT_STORE %i0
77
78 # context_save returns 1
79 mov 1, %i0
80 ret
81 restore %sp, 128, %sp
82
83context_restore_arch:
84 save %sp, -128, %sp
85 CONTEXT_LOAD %i0
86
87 # context_restore returns 0
88 xor %i0, %i0, %i0
89 ret
90 restore %sp, 128, %sp
Note: See TracBrowser for help on using the repository browser.