OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [include/] [asm-sparc/] [winmacro.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* $Id: winmacro.h,v 1.1.1.1 2001-09-10 07:44:43 simons Exp $
2
 * winmacro.h: Window loading-unloading macros.
3
 *
4
 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5
 */
6
 
7
#ifndef _SPARC_WINMACRO_H
8
#define _SPARC_WINMACRO_H
9
 
10
#include <asm/ptrace.h>
11
#include <asm/psr.h>
12
 
13
/* These are just handy. */
14
#define _SV     save    %sp, -REGWIN_SZ, %sp
15
#define _RS     restore 
16
 
17
#define FLUSH_ALL_KERNEL_WINDOWS \
18
        _SV; _SV; _SV; _SV; _SV; _SV; _SV; \
19
        _RS; _RS; _RS; _RS; _RS; _RS; _RS;
20
 
21
/* Store the register window onto the 8-byte aligned area starting
22
 * at %reg.  It might be %sp, it might not, we don't care.
23
 */
24
#define STORE_WINDOW(reg) \
25
        std     %l0, [%reg + RW_L0]; \
26
        std     %l2, [%reg + RW_L2]; \
27
        std     %l4, [%reg + RW_L4]; \
28
        std     %l6, [%reg + RW_L6]; \
29
        std     %i0, [%reg + RW_I0]; \
30
        std     %i2, [%reg + RW_I2]; \
31
        std     %i4, [%reg + RW_I4]; \
32
        std     %i6, [%reg + RW_I6];
33
 
34
/* Load a register window from the area beginning at %reg. */
35
#define LOAD_WINDOW(reg) \
36
        ldd     [%reg + RW_L0], %l0; \
37
        ldd     [%reg + RW_L2], %l2; \
38
        ldd     [%reg + RW_L4], %l4; \
39
        ldd     [%reg + RW_L6], %l6; \
40
        ldd     [%reg + RW_I0], %i0; \
41
        ldd     [%reg + RW_I2], %i2; \
42
        ldd     [%reg + RW_I4], %i4; \
43
        ldd     [%reg + RW_I6], %i6;
44
 
45
/* Loading and storing struct pt_reg trap frames. */
46
#define LOAD_PT_INS(base_reg) \
47
        ldd     [%base_reg + REGWIN_SZ + PT_I0], %i0; \
48
        ldd     [%base_reg + REGWIN_SZ + PT_I2], %i2; \
49
        ldd     [%base_reg + REGWIN_SZ + PT_I4], %i4; \
50
        ldd     [%base_reg + REGWIN_SZ + PT_I6], %i6;
51
 
52
#define LOAD_PT_GLOBALS(base_reg) \
53
        ld      [%base_reg + REGWIN_SZ + PT_G1], %g1; \
54
        ldd     [%base_reg + REGWIN_SZ + PT_G2], %g2; \
55
        ldd     [%base_reg + REGWIN_SZ + PT_G4], %g4; \
56
        ldd     [%base_reg + REGWIN_SZ + PT_G6], %g6;
57
 
58
#define LOAD_PT_YREG(base_reg, scratch) \
59
        ld      [%base_reg + REGWIN_SZ + PT_Y], %scratch; \
60
        wr      %scratch, 0x0, %y;
61
 
62
#define LOAD_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \
63
        ld      [%base_reg + REGWIN_SZ + PT_PSR], %pt_psr; \
64
        ld      [%base_reg + REGWIN_SZ + PT_PC], %pt_pc; \
65
        ld      [%base_reg + REGWIN_SZ + PT_NPC], %pt_npc;
66
 
67
#define LOAD_PT_ALL(base_reg, pt_psr, pt_pc, pt_npc, scratch) \
68
        LOAD_PT_YREG(base_reg, scratch) \
69
        LOAD_PT_INS(base_reg) \
70
        LOAD_PT_GLOBALS(base_reg) \
71
        LOAD_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc)
72
 
73
#define STORE_PT_INS(base_reg) \
74
        std     %i0, [%base_reg + REGWIN_SZ + PT_I0]; \
75
        std     %i2, [%base_reg + REGWIN_SZ + PT_I2]; \
76
        std     %i4, [%base_reg + REGWIN_SZ + PT_I4]; \
77
        std     %i6, [%base_reg + REGWIN_SZ + PT_I6];
78
 
79
#define STORE_PT_GLOBALS(base_reg) \
80
        st      %g1, [%base_reg + REGWIN_SZ + PT_G1]; \
81
        std     %g2, [%base_reg + REGWIN_SZ + PT_G2]; \
82
        std     %g4, [%base_reg + REGWIN_SZ + PT_G4]; \
83
        std     %g6, [%base_reg + REGWIN_SZ + PT_G6];
84
 
85
#define STORE_PT_YREG(base_reg, scratch) \
86
        rd      %y, %scratch; \
87
        st      %scratch, [%base_reg + REGWIN_SZ + PT_Y];
88
 
89
#define STORE_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \
90
        st      %pt_psr, [%base_reg + REGWIN_SZ + PT_PSR]; \
91
        st      %pt_pc,  [%base_reg + REGWIN_SZ + PT_PC]; \
92
        st      %pt_npc, [%base_reg + REGWIN_SZ + PT_NPC];
93
 
94
#define STORE_PT_ALL(base_reg, reg_psr, reg_pc, reg_npc, g_scratch) \
95
        STORE_PT_PRIV(base_reg, reg_psr, reg_pc, reg_npc) \
96
        STORE_PT_GLOBALS(base_reg) \
97
        STORE_PT_YREG(base_reg, g_scratch) \
98
        STORE_PT_INS(base_reg)
99
 
100
#define SAVE_BOLIXED_USER_STACK(cur_reg, scratch) \
101
        ld       [%cur_reg + THREAD_W_SAVED], %scratch; \
102
        sll      %scratch, 2, %scratch; \
103
        add      %scratch, %cur_reg, %scratch; \
104
        st       %sp, [%scratch + THREAD_STACK_PTRS]; \
105
        sub      %scratch, %cur_reg, %scratch; \
106
        sll      %scratch, 4, %scratch; \
107
        add      %scratch, %cur_reg, %scratch; \
108
        STORE_WINDOW(scratch + THREAD_REG_WINDOW); \
109
        sub      %scratch, %cur_reg, %scratch; \
110
        srl      %scratch, 6, %scratch; \
111
        add      %scratch, 1, %scratch; \
112
        st       %scratch, [%cur_reg + THREAD_W_SAVED];
113
 
114
#ifdef __SMP__
115
#define LOAD_CURRENT(dest_reg, idreg) \
116
        rd       %tbr, %idreg; \
117
        srl      %idreg, 10, %idreg; \
118
        and      %idreg, 0xc, %idreg; \
119
        sethi    %hi(C_LABEL(current_set)), %dest_reg; \
120
        or       %dest_reg, %lo(C_LABEL(current_set)), %dest_reg; \
121
        add      %dest_reg, %idreg, %dest_reg; \
122
        ld       [%dest_reg], %dest_reg;
123
#else
124
#define LOAD_CURRENT(dest_reg, idreg) \
125
        sethi    %hi(C_LABEL(current_set)), %dest_reg; \
126
        ld       [%dest_reg + %lo(C_LABEL(current_set))], %dest_reg;
127
#endif
128
 
129
#endif /* !(_SPARC_WINMACRO_H) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.