Subversion Repositories tendra.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/* 	handle_sregs.c,v 1.3 1995/08/21 08:44:43 john Exp	 */
32
 
33
#ifndef lint
34
static char vcid[] = "handle_sregs.c,v 1.3 1995/08/21 08:44:43 john Exp";
35
#endif /* lint */
36
 
37
/*
38
  handle_sregs.c
39
  This file contains code to handle preserved registers.
40
*/
41
 
42
 
43
 
44
#include "config.h"
45
#include "alpha_ins.h"
46
#include "inst_fmt.h"
47
#include "addresstypes.h"
48
#include "expmacs.h"
49
#include "frames.h"
50
#include "reg_defs.h"
51
#include "maxminmacs.h"
52
#include "fail.h"
53
 
54
extern long frame_size;
55
extern int arg_stack_space;
56
extern int in_general_proc;
57
 
58
int  dumpstart;		/* where to start dumping fixeds */
59
int  fldumpstart;		/* where to start dumping floats */
60
 
61
int  fixdump;			/* all the fixeds to be dumped */
62
int  floatdump;		/* all the floats to be dumped */
63
 
64
int  fixdone;			/* the fixeds which have already been
65
				   dumped */
66
int  fltdone;			/* the floats which have already been
67
				   dumped */
68
 
69
baseoff dump_baseoff
70
    PROTO_N ( ( dstart ) )
71
    PROTO_T ( int dstart )
72
{
73
  baseoff b;
74
  b.base = Has_vcallees?local_reg:(Has_fp?FP:SP);
75
  if(in_general_proc) {
76
    b.offset = (Has_vcallees)?(dstart - (frame_size>>3)):
77
      (Has_fp)?(dstart - (arg_stack_space+((frame_size+callee_size)>>3))):dstart;
78
  }
79
  else {
80
    b.offset = (Has_vcallees)?(dstart - (frame_size>>3)):
81
      (Has_fp)?(dstart - ((frame_size+callee_size)>>3)):dstart;
82
  }
83
  return b;
84
}
85
 
86
 
87
/*
88
** Dump registers to the stack.
89
*/
90
void dump_sregs
91
    PROTO_N ( ( fdi, fldi ) )
92
    PROTO_T ( unsigned int fdi X unsigned int fldi )
93
{
94
  unsigned int mask = 1<<31;
95
  int  ds=dumpstart-8;
96
  int fds=fldumpstart-8;
97
  unsigned int fd = fdi;
98
  unsigned int fld = fldi;
99
  baseoff b;
100
  int   i;
101
  b = dump_baseoff(ds);
102
  for(i=31;(fd!=0)&&(mask!=0);i--){
103
    if(fixdump&mask){
104
      /*b.offset = (ds +=8 );*/
105
      b.offset += 8;
106
      if(fd & mask){
107
	load_store(i_stq,i,b);
108
	fd &= ~mask;
109
      }	
110
    }
111
    mask>>=1;
112
  }
113
  if(fd!=0) failer("fd <> 0");
114
  mask=1<<31;
115
  b = dump_baseoff(fds);
116
  for (i = 31; (fld != 0)&&(mask!=0); i--){
117
    if (floatdump&mask) {
118
      b.offset += 8;
119
      /*b.offset = (fds+=8);*/
120
      if (fld & mask){
121
	fld &= ~mask;
122
	float_load_store(i_stt,i,b);
123
      }	
124
    }	
125
    mask>>=1;
126
  }
127
  if(fld!=0)failer("float dump failed\n");
128
  fixdone |= fdi;
129
  fltdone |= fldi;
130
}
131
 
132
 
133
/*
134
  restore registers from stack.
135
*/
136
void restore_sregs
137
    PROTO_N ( ( fd, fld ) )
138
    PROTO_T ( unsigned int fd X unsigned int fld )
139
{
140
  unsigned int mask = 1<<31;
141
  int ds=dumpstart-8;
142
  int fds=fldumpstart-8;
143
  baseoff b = dump_baseoff(ds);
144
  int   i;
145
  for (i = 31; (fd != 0)&&(mask!=0); i--) {
146
    if (fixdump & mask) {
147
      b.offset += 8;
148
      /*b.offset = (ds+=8);*/
149
      if (fd & mask) {
150
	load_store(i_ldq,i,b);
151
	fd &= ~mask;
152
      }
153
    }
154
    mask >>= 1;
155
  }
156
  if(fd != 0) failer("fd<>0");
157
  b = dump_baseoff(fds);
158
  mask = 1<<31;
159
  for (i = 31; (fld != 0)&(mask!=0); i--) {
160
    if (floatdump & mask) {
161
      b.offset += 8;
162
      /*b.offset = (fds+=8);*/
163
      if (fld & mask) {
164
	float_load_store(i_ldt,i,b);
165
	fld &= ~mask;
166
      }
167
    }
168
    mask = mask>>1;
169
  }
170
}
171
 
172
 
173
 
174
 
175
 
176
 
177
 
178
 
179
 
180
 
181
 
182
 
183
 
184