54 #include <linux/kernel.h>
55 #include <asm/processor.h>
59 #define COPR_INST 0x30000000
65 #define extru(r,pos,len) (((r) >> (31-(pos))) & (( 1 << (len)) - 1))
72 #define fpclass1subpos 16
105 #define fpfusedsubop 26
111 #define fpzeroreg (32*sizeof(double)/sizeof(u_int))
116 #define get_major(op) extru(op,fpmajorpos,6)
121 #define get_class(op) extru(op,fpclasspos,2)
126 #define get_subop(op) extru(op,fpsubpos,3)
131 #define get_subop1_PA1_1(op) extru(op,fpclass1subpos,2)
132 #define get_subop1_PA2_0(op) extru(op,fpclass1subpos,3)
135 #define MAJOR_0C_EXCP 0x09
136 #define MAJOR_0E_EXCP 0x0b
137 #define MAJOR_06_EXCP 0x03
138 #define MAJOR_26_EXCP 0x23
139 #define MAJOR_2E_EXCP 0x2b
140 #define PA83_UNIMP_EXCP 0x01
146 #define FPU_TYPE_FLAG_POS (EM_FPU_TYPE_OFFSET>>2)
147 #define TIMEX_ROLEX_FPU_MASK (TIMEX_EXTEN_FLAG|ROLEX_EXTEN_FLAG)
153 #if defined(_PROTOTYPES) || defined(_lint)
161 static u_int decode_0c();
162 static u_int decode_0e();
163 static u_int decode_06();
164 static u_int decode_26();
165 static u_int decode_2e();
166 static void update_status_cbit();
171 static void parisc_linux_get_fpu_type(
u_int fpregs[])
198 u_int fpu_type_flags;
203 parisc_linux_get_fpu_type(fpregs);
207 class = get_class(ir);
222 return(decode_0c(ir,
class,subop,fpregs));
224 return(decode_0e(ir,
class,subop,fpregs));
226 return(decode_06(ir,fpregs));
228 return(decode_26(ir,fpregs));
230 return(decode_2e(ir,fpregs));
253 u_int fpu_type_flags;
261 class = get_class(ir);
272 return(decode_0c(ir,
class,subop,fpregs));
274 return(decode_0e(ir,
class,subop,fpregs));
276 return(decode_06(ir,fpregs));
278 return(decode_26(ir,fpregs));
280 return(decode_2e(ir,fpregs));
295 u_int fpu_type_flags;
302 local_status = fpregs[0];
307 if (t == 0 &&
class != 2)
324 fpregs[t+3] = fpregs[r1+3];
325 fpregs[t+2] = fpregs[r1+2];
327 fpregs[t+1] = fpregs[r1+1];
329 fpregs[
t] = fpregs[
r1];
339 fpregs[t+3] = fpregs[r1+3];
340 fpregs[t+2] = fpregs[r1+2];
342 fpregs[t+1] = fpregs[r1+1];
345 fpregs[
t] = fpregs[
r1] & 0x7fffffff;
355 fpregs[t+3] = fpregs[r1+3];
356 fpregs[t+2] = fpregs[r1+2];
358 fpregs[t+1] = fpregs[r1+1];
361 fpregs[
t] = fpregs[
r1] ^ 0x80000000;
371 fpregs[t+3] = fpregs[r1+3];
372 fpregs[t+2] = fpregs[r1+2];
374 fpregs[t+1] = fpregs[r1+1];
377 fpregs[
t] = fpregs[
r1] | 0x80000000;
408 if ((df & 2) || (fmt & 2)) {
420 fmt = (fmt << 1) | df;
561 update_status_cbit(status,local_status,
562 fpu_type_flags, subop);
568 update_status_cbit(status,local_status,
569 fpu_type_flags, subop);
592 update_status_cbit(status,local_status,
593 fpu_type_flags, subop);
599 update_status_cbit(status,local_status,
600 fpu_type_flags, subop);
640 return(
sgl_fadd(&fpregs[r1],&fpregs[r2],
643 return(
dbl_fadd(&fpregs[r1],&fpregs[r2],
652 return(
sgl_fsub(&fpregs[r1],&fpregs[r2],
655 return(
dbl_fsub(&fpregs[r1],&fpregs[r2],
664 return(
sgl_fmpy(&fpregs[r1],&fpregs[r2],
667 return(
dbl_fmpy(&fpregs[r1],&fpregs[r2],
676 return(
sgl_fdiv(&fpregs[r1],&fpregs[r2],
679 return(
dbl_fdiv(&fpregs[r1],&fpregs[r2],
688 return(
sgl_frem(&fpregs[r1],&fpregs[r2],
691 return(
dbl_frem(&fpregs[r1],&fpregs[r2],
705 decode_0e(ir,
class,subop,fpregs)
714 u_int fpu_type_flags;
717 local_status = fpregs[0];
722 if (t == 0 &&
class != 2)
751 fpregs[t+1] = fpregs[r1+1];
753 fpregs[
t] = fpregs[
r1];
762 fpregs[t+1] = fpregs[r1+1];
764 fpregs[
t] = fpregs[
r1] & 0x7fffffff;
773 fpregs[t+1] = fpregs[r1+1];
775 fpregs[
t] = fpregs[
r1] ^ 0x80000000;
784 fpregs[t+1] = fpregs[r1+1];
786 fpregs[
t] = fpregs[
r1] | 0x80000000;
793 &fpregs[t], status));
796 &fpregs[t], status));
805 &fpregs[t], status));
808 &fpregs[t], status));
824 if ((df & 2) || (fmt & 2))
827 fmt = (fmt << 1) | df;
951 if (fpu_type_flags & PA2_0_FPU_FLAG) {
965 update_status_cbit(status,local_status,
966 fpu_type_flags, subop);
972 update_status_cbit(status,local_status,
973 fpu_type_flags, subop);
997 update_status_cbit(status,local_status,
998 fpu_type_flags, subop);
1004 update_status_cbit(status,local_status,
1005 fpu_type_flags, subop);
1036 return(
sgl_fadd(&fpregs[r1],&fpregs[r2],
1037 &fpregs[t],status));
1039 return(
dbl_fadd(&fpregs[r1],&fpregs[r2],
1040 &fpregs[t],status));
1045 return(
sgl_fsub(&fpregs[r1],&fpregs[r2],
1046 &fpregs[t],status));
1048 return(
dbl_fsub(&fpregs[r1],&fpregs[r2],
1049 &fpregs[t],status));
1081 &fpregs[r2],&fpregs[t],status));
1084 &fpregs[r2],&fpregs[t],status));
1090 return(
sgl_fdiv(&fpregs[r1],&fpregs[r2],
1091 &fpregs[t],status));
1093 return(
dbl_fdiv(&fpregs[r1],&fpregs[r2],
1094 &fpregs[t],status));
1099 return(
sgl_frem(&fpregs[r1],&fpregs[r2],
1100 &fpregs[t],status));
1102 return(
dbl_frem(&fpregs[r1],&fpregs[r2],
1103 &fpregs[t],status));
1117 decode_06(ir,fpregs)
1125 u_int fpu_type_flags;
1155 if (
dbl_fmpy(&fpregs[rm1],&fpregs[rm2],
1156 &mtmp.ints.i1,&status))
1159 &atmp.ints.i1,&atmp.ints.i1,&status))
1164 if (
dbl_fmpy(&fpregs[rm1],&fpregs[rm2],&mtmp.ints.i1,
1167 if (
dbl_fadd(&fpregs[ta], &fpregs[ra], &atmp.ints.i1,
1179 if (
dbl_fmpy(&fpregs[rm1],&fpregs[rm2],&mtmp.ints.i1,
1182 if (
dbl_fadd(&fpregs[ta], &fpregs[ra], &atmp.ints.i1,
1192 fpregs[
tm] = mtmp.ints.i1;
1193 fpregs[tm+1] = mtmp.ints.i2;
1194 fpregs[
ta] = atmp.ints.i1;
1195 fpregs[ta+1] = atmp.ints.i2;
1220 if (ra == 0x20 &&(fpu_type_flags & TIMEX_ROLEX_FPU_MASK)) {
1226 if (
sgl_fmpy(&fpregs[rm1],&fpregs[rm2],&mtmp.ints.i1,
1230 &atmp.ints.i1,&status))
1234 if (
sgl_fmpy(&fpregs[rm1],&fpregs[rm2],&mtmp.ints.i1,
1237 if (
sgl_fadd(&fpregs[ta], &fpregs[ra], &atmp.ints.i1,
1245 fpregs[
tm] = mtmp.ints.i1;
1246 fpregs[
ta] = atmp.ints.i1;
1257 decode_26(ir,fpregs)
1291 if (
dbl_fmpy(&fpregs[rm1],&fpregs[rm2],&mtmp.ints.i1,&status))
1293 if (
dbl_fsub(&fpregs[ta], &fpregs[ra], &atmp.ints.i1,&status))
1299 fpregs[
tm] = mtmp.ints.i1;
1300 fpregs[tm+1] = mtmp.ints.i2;
1301 fpregs[
ta] = atmp.ints.i1;
1302 fpregs[ta+1] = atmp.ints.i2;
1327 if (
sgl_fmpy(&fpregs[rm1],&fpregs[rm2],&mtmp.ints.i1,&status))
1329 if (
sgl_fsub(&fpregs[ta], &fpregs[ra], &atmp.ints.i1,&status))
1335 fpregs[
tm] = mtmp.ints.i1;
1336 fpregs[
ta] = atmp.ints.i1;
1348 decode_2e(ir,fpregs)
1364 sizeof(double)/
sizeof(
u_int);
1373 &fpregs[ra], &fpregs[0], &fpregs[t]));
1376 &fpregs[ra], &fpregs[0], &fpregs[t]));
1395 &fpregs[ra], &fpregs[0], &fpregs[t]));
1398 &fpregs[ra], &fpregs[0], &fpregs[t]));
1414 update_status_cbit(status, new_status, fpu_type, y_field)
1415 u_int *status, new_status;
1427 (fpu_type & PA2_0_FPU_FLAG)) {
1429 *status = ((*status & 0x04000000) >> 5) |
1430 ((*status & 0x003ff000) >> 1) |
1431 (new_status & 0xffc007ff);
1433 *status = (*status & 0x04000000) |
1434 ((new_status & 0x04000000) >> (y_field+4)) |
1435 (new_status & ~0x04000000 &
1436 ~(0x04000000 >> (y_field+4)));
1441 *status = new_status;