]>
git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/v850/simops.c
4 #include "sys/syscall.h"
33 static void trace_input
PARAMS ((char *name
, enum op_types type
, int size
));
34 static void trace_output
PARAMS ((enum op_types result
));
36 #ifndef SIZE_INSTRUCTION
37 #define SIZE_INSTRUCTION 6
41 #define SIZE_OPERANDS 16
45 #define SIZE_VALUES 11
49 trace_input (name
, type
, size
)
59 if ((v850_debug
& DEBUG_TRACE
) == 0)
62 (*v850_callback
->printf_filtered
) (v850_callback
,
65 SIZE_INSTRUCTION
, name
);
72 strcpy (buf
, "unknown");
76 sprintf (buf
, "%d", OP
[0]);
80 sprintf (buf
, "r%d", OP
[0]);
86 sprintf (buf
, "r%d,r%d", OP
[0], OP
[1]);
92 sprintf (buf
, "%d,r%d", OP
[1], OP
[0]);
96 sprintf (buf
, "%d", SEXT9 (OP
[0]));
100 sprintf (buf
, "%d[r30],r%d", SEXT7 (OP
[1]) * size
, OP
[0]);
104 sprintf (buf
, "r%d,%d[r30]", OP
[0], SEXT7 (OP
[1]) * size
);
108 sprintf (buf
, "%d[r%d],r%d", SEXT16 (OP
[2]), OP
[0], OP
[1]);
112 sprintf (buf
, "r%d,%d[r%d]", OP
[1], SEXT16 (OP
[2]), OP
[0]);
116 sprintf (buf
, "%d,r%d", SEXT22 (OP
[0]), OP
[1]);
120 sprintf (buf
, "%d,r%d,r%d", SEXT16 (OP
[0]), OP
[1], OP
[2]);
123 case OP_UIMM_REG_REG
:
124 sprintf (buf
, "%d,r%d,r%d", OP
[0] & 0xffff, OP
[1], OP
[2]);
128 sprintf (buf
, "%d,%d[r%d]", OP
[1] & 0x7, SEXT16 (OP
[2]), OP
[0]);
134 default: cond
= "?"; break;
135 case 0x0: cond
= "v"; break;
136 case 0x1: cond
= "c"; break;
137 case 0x2: cond
= "z"; break;
138 case 0x3: cond
= "nh"; break;
139 case 0x4: cond
= "s"; break;
140 case 0x5: cond
= "t"; break;
141 case 0x6: cond
= "lt"; break;
142 case 0x7: cond
= "le"; break;
143 case 0x8: cond
= "nv"; break;
144 case 0x9: cond
= "nc"; break;
145 case 0xa: cond
= "nz"; break;
146 case 0xb: cond
= "h"; break;
147 case 0xc: cond
= "ns"; break;
148 case 0xd: cond
= "sa"; break;
149 case 0xe: cond
= "ge"; break;
150 case 0xf: cond
= "gt"; break;
153 sprintf (buf
, "%s,r%d", cond
, OP
[1]);
162 sprintf (buf
, "r%d,s%d", OP
[0], OP
[1]);
166 if ((v850_debug
& DEBUG_VALUES
) == 0)
168 (*v850_callback
->printf_filtered
) (v850_callback
, "%s\n", buf
);
172 (*v850_callback
->printf_filtered
) (v850_callback
, "%-*s", SIZE_OPERANDS
, buf
);
183 case OP_REG_REG_MOVE
:
184 values
[0] = State
.regs
[OP
[0]];
190 values
[0] = State
.regs
[OP
[1]];
191 values
[1] = State
.regs
[OP
[0]];
197 values
[0] = SEXT5 (OP
[0]);
202 case OP_IMM_REG_MOVE
:
203 values
[0] = SEXT5 (OP
[0]);
208 values
[0] = State
.pc
;
209 values
[1] = SEXT9 (OP
[0]);
210 values
[2] = State
.sregs
[5];
215 values
[0] = SEXT7 (OP
[1]) * size
;
216 values
[1] = State
.regs
[30];
221 values
[0] = State
.regs
[OP
[0]];
222 values
[1] = SEXT7 (OP
[1]) * size
;
223 values
[2] = State
.regs
[30];
228 values
[0] = SEXT16 (OP
[2]);
229 values
[1] = State
.regs
[OP
[0]];
234 values
[0] = State
.regs
[OP
[1]];
235 values
[1] = SEXT16 (OP
[2]);
236 values
[2] = State
.regs
[OP
[0]];
241 values
[0] = SEXT22 (OP
[0]);
242 values
[1] = State
.pc
;
247 values
[0] = SEXT16 (OP
[0]) << size
;
248 values
[1] = State
.regs
[OP
[1]];
252 case OP_UIMM_REG_REG
:
253 values
[0] = (OP
[0] & 0xffff) << size
;
254 values
[1] = State
.regs
[OP
[1]];
263 values
[0] = State
.sregs
[5];
272 values
[0] = State
.regs
[OP
[0]];
277 values
[0] = State
.sregs
[OP
[1]];
281 for (i
= 0; i
< num_values
; i
++)
282 (*v850_callback
->printf_filtered
) (v850_callback
, "%*s0x%.8lx", SIZE_VALUES
- 10, "", values
[i
]);
285 (*v850_callback
->printf_filtered
) (v850_callback
, "%*s", SIZE_VALUES
, "");
290 trace_output (result
)
291 enum op_types result
;
293 if ((v850_debug
& (DEBUG_TRACE
| DEBUG_VALUES
)) == (DEBUG_TRACE
| DEBUG_VALUES
))
313 (*v850_callback
->printf_filtered
) (v850_callback
, " :: 0x%.8lx",
314 (unsigned long)State
.regs
[OP
[0]]);
318 case OP_REG_REG_MOVE
:
320 case OP_IMM_REG_MOVE
:
323 (*v850_callback
->printf_filtered
) (v850_callback
, " :: 0x%.8lx",
324 (unsigned long)State
.regs
[OP
[1]]);
328 case OP_UIMM_REG_REG
:
329 (*v850_callback
->printf_filtered
) (v850_callback
, " :: 0x%.8lx",
330 (unsigned long)State
.regs
[OP
[2]]);
335 (*v850_callback
->printf_filtered
) (v850_callback
, " :: 0x%.8lx",
336 (unsigned long)State
.regs
[OP
[1]]);
340 (*v850_callback
->printf_filtered
) (v850_callback
, " :: 0x%.8lx",
341 (unsigned long)State
.sregs
[OP
[1]]);
345 (*v850_callback
->printf_filtered
) (v850_callback
, "\n");
350 #define trace_input(NAME, IN1, IN2, IN3)
351 #define trace_output(RESULT)
362 trace_input ("sld.b", OP_LOAD16
, 1);
366 result
= get_byte (State
.mem
+ State
.regs
[30] + op2
);
367 State
.regs
[OP
[0]] = SEXT8 (result
);
368 trace_output (OP_LOAD16
);
378 trace_input ("sld.h", OP_LOAD16
, 2);
382 result
= get_half (State
.mem
+ State
.regs
[30] + op2
);
383 State
.regs
[OP
[0]] = SEXT16 (result
);
384 trace_output (OP_LOAD16
);
394 trace_input ("sld.w", OP_LOAD16
, 4);
398 result
= get_word (State
.mem
+ State
.regs
[30] + op2
);
399 State
.regs
[OP
[0]] = result
;
400 trace_output (OP_LOAD16
);
407 unsigned int op0
, op1
;
410 trace_input ("sst.b", OP_STORE16
, 1);
411 op0
= State
.regs
[OP
[0]];
415 put_byte (State
.mem
+ State
.regs
[30] + op1
, op0
);
416 trace_output (OP_STORE16
);
423 unsigned int op0
, op1
;
426 trace_input ("sst.h", OP_STORE16
, 2);
427 op0
= State
.regs
[OP
[0]];
431 put_half (State
.mem
+ State
.regs
[30] + op1
, op0
);
432 trace_output (OP_STORE16
);
439 unsigned int op0
, op1
;
442 trace_input ("sst.w", OP_STORE16
, 4);
443 op0
= State
.regs
[OP
[0]];
447 put_word (State
.mem
+ State
.regs
[30] + op1
, op0
);
448 trace_output (OP_STORE16
);
455 unsigned int op0
, op2
;
458 trace_input ("ld.b", OP_LOAD32
, 1);
459 op0
= State
.regs
[OP
[0]];
460 temp
= SEXT16 (OP
[2]);
462 result
= get_byte (State
.mem
+ op0
+ op2
);
463 State
.regs
[OP
[1]] = SEXT8 (result
);
464 trace_output (OP_LOAD32
);
471 unsigned int op0
, op2
;
474 trace_input ("ld.h", OP_LOAD32
, 2);
475 op0
= State
.regs
[OP
[0]];
476 temp
= SEXT16 (OP
[2]);
479 result
= get_half (State
.mem
+ op0
+ op2
);
480 State
.regs
[OP
[1]] = SEXT16 (result
);
481 trace_output (OP_LOAD32
);
488 unsigned int op0
, op2
;
491 trace_input ("ld.w", OP_LOAD32
, 4);
492 op0
= State
.regs
[OP
[0]];
493 temp
= SEXT16 (OP
[2]);
496 result
= get_word (State
.mem
+ op0
+ op2
);
497 State
.regs
[OP
[1]] = result
;
498 trace_output (OP_LOAD32
);
505 unsigned int op0
, op1
, op2
;
508 trace_input ("st.b", OP_STORE32
, 1);
509 op0
= State
.regs
[OP
[0]];
510 op1
= State
.regs
[OP
[1]];
511 temp
= SEXT16 (OP
[2]);
513 put_byte (State
.mem
+ op0
+ op2
, op1
);
514 trace_output (OP_STORE32
);
521 unsigned int op0
, op1
, op2
;
524 trace_input ("st.h", OP_STORE32
, 2);
525 op0
= State
.regs
[OP
[0]];
526 op1
= State
.regs
[OP
[1]];
527 temp
= SEXT16 (OP
[2] & ~0x1);
529 put_half (State
.mem
+ op0
+ op2
, op1
);
530 trace_output (OP_STORE32
);
537 unsigned int op0
, op1
, op2
;
540 trace_input ("st.w", OP_STORE32
, 4);
541 op0
= State
.regs
[OP
[0]];
542 op1
= State
.regs
[OP
[1]];
543 temp
= SEXT16 (OP
[2] & ~0x1);
545 put_word (State
.mem
+ op0
+ op2
, op1
);
546 trace_output (OP_STORE32
);
556 trace_input ("bv", OP_COND_BR
, 0);
558 psw
= State
.sregs
[5];
560 if ((psw
& PSW_OV
) != 0)
564 trace_output (OP_COND_BR
);
574 trace_input ("bl", OP_COND_BR
, 0);
576 psw
= State
.sregs
[5];
578 if ((psw
& PSW_CY
) != 0)
582 trace_output (OP_COND_BR
);
592 trace_input ("be", OP_COND_BR
, 0);
594 psw
= State
.sregs
[5];
596 if ((psw
& PSW_Z
) != 0)
600 trace_output (OP_COND_BR
);
610 trace_input ("bnh", OP_COND_BR
, 0);
612 psw
= State
.sregs
[5];
614 if ((((psw
& PSW_CY
) != 0) | ((psw
& PSW_Z
) != 0)) != 0)
618 trace_output (OP_COND_BR
);
628 trace_input ("bn", OP_COND_BR
, 0);
630 psw
= State
.sregs
[5];
632 if ((psw
& PSW_S
) != 0)
636 trace_output (OP_COND_BR
);
646 trace_input ("br", OP_COND_BR
, 0);
649 trace_output (OP_COND_BR
);
659 trace_input ("blt", OP_COND_BR
, 0);
661 psw
= State
.sregs
[5];
663 if ((((psw
& PSW_S
) != 0) ^ ((psw
& PSW_OV
) != 0)) != 0)
667 trace_output (OP_COND_BR
);
677 trace_input ("ble", OP_COND_BR
, 0);
679 psw
= State
.sregs
[5];
681 if ((((psw
& PSW_Z
) != 0)
682 || (((psw
& PSW_S
) != 0) ^ ((psw
& PSW_OV
) != 0))) != 0)
686 trace_output (OP_COND_BR
);
696 trace_input ("bnv", OP_COND_BR
, 0);
698 psw
= State
.sregs
[5];
700 if ((psw
& PSW_OV
) == 0)
704 trace_output (OP_COND_BR
);
714 trace_input ("bnl", OP_COND_BR
, 0);
716 psw
= State
.sregs
[5];
718 if ((psw
& PSW_CY
) == 0)
722 trace_output (OP_COND_BR
);
732 trace_input ("bne", OP_COND_BR
, 0);
734 psw
= State
.sregs
[5];
736 if ((psw
& PSW_Z
) == 0)
740 trace_output (OP_COND_BR
);
750 trace_input ("bh", OP_COND_BR
, 0);
752 psw
= State
.sregs
[5];
754 if ((((psw
& PSW_CY
) != 0) | ((psw
& PSW_Z
) != 0)) == 0)
758 trace_output (OP_COND_BR
);
768 trace_input ("bp", OP_COND_BR
, 0);
770 psw
= State
.sregs
[5];
772 if ((psw
& PSW_S
) == 0)
776 trace_output (OP_COND_BR
);
786 trace_input ("bsa", OP_COND_BR
, 0);
788 psw
= State
.sregs
[5];
790 if ((psw
& PSW_SAT
) != 0)
794 trace_output (OP_COND_BR
);
804 trace_input ("bge", OP_COND_BR
, 0);
806 psw
= State
.sregs
[5];
808 if ((((psw
& PSW_S
) != 0) ^ ((psw
& PSW_OV
) != 0)) == 0)
812 trace_output (OP_COND_BR
);
822 trace_input ("bgt", OP_COND_BR
, 0);
824 psw
= State
.sregs
[5];
826 if ((((psw
& PSW_Z
) != 0)
827 || (((psw
& PSW_S
) != 0) ^ ((psw
& PSW_OV
) != 0))) == 0)
831 trace_output (OP_COND_BR
);
838 /* interp.c will bump this by +2, so correct for it here. */
839 trace_input ("jmp", OP_REG
, 0);
840 State
.pc
= State
.regs
[OP
[0]] - 2;
841 trace_output (OP_REG
);
844 /* jarl disp22, reg */
848 unsigned int op0
, opc
;
851 trace_input ("jarl", OP_JUMP
, 0);
852 temp
= SEXT22 (OP
[0]);
858 /* Gross. jarl X,r0 is really jr and doesn't save its result. */
860 State
.regs
[OP
[1]] = opc
+ 4;
861 trace_output (OP_JUMP
);
868 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
;
870 trace_input ("add", OP_REG_REG
, 0);
871 /* Compute the result. */
872 op0
= State
.regs
[OP
[0]];
873 op1
= State
.regs
[OP
[1]];
876 /* Compute the condition codes. */
878 s
= (result
& 0x80000000);
879 cy
= (result
< op0
|| result
< op1
);
880 ov
= ((op0
& 0x80000000) == (op1
& 0x80000000)
881 && (op0
& 0x80000000) != (result
& 0x80000000));
883 /* Store the result and condition codes. */
884 State
.regs
[OP
[1]] = result
;
885 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
886 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
887 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0));
888 trace_output (OP_REG_REG
);
891 /* add sign_extend(imm5), reg */
895 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
;
898 trace_input ("add", OP_IMM_REG
, 0);
900 /* Compute the result. */
901 temp
= SEXT5 (OP
[0]);
903 op1
= State
.regs
[OP
[1]];
906 /* Compute the condition codes. */
908 s
= (result
& 0x80000000);
909 cy
= (result
< op0
|| result
< op1
);
910 ov
= ((op0
& 0x80000000) == (op1
& 0x80000000)
911 && (op0
& 0x80000000) != (result
& 0x80000000));
913 /* Store the result and condition codes. */
914 State
.regs
[OP
[1]] = result
;
915 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
916 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
917 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0));
918 trace_output (OP_IMM_REG
);
921 /* addi sign_extend(imm16), reg, reg */
925 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
;
928 trace_input ("addi", OP_IMM_REG_REG
, 0);
930 /* Compute the result. */
931 temp
= SEXT16 (OP
[0]);
933 op1
= State
.regs
[OP
[1]];
936 /* Compute the condition codes. */
938 s
= (result
& 0x80000000);
939 cy
= (result
< op0
|| result
< op1
);
940 ov
= ((op0
& 0x80000000) == (op1
& 0x80000000)
941 && (op0
& 0x80000000) != (result
& 0x80000000));
943 /* Store the result and condition codes. */
944 State
.regs
[OP
[2]] = result
;
945 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
946 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
947 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0));
948 trace_output (OP_IMM_REG_REG
);
955 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
;
957 trace_input ("sub", OP_REG_REG
, 0);
958 /* Compute the result. */
959 op0
= State
.regs
[OP
[0]];
960 op1
= State
.regs
[OP
[1]];
963 /* Compute the condition codes. */
965 s
= (result
& 0x80000000);
967 ov
= ((op1
& 0x80000000) != (op0
& 0x80000000)
968 && (op1
& 0x80000000) != (result
& 0x80000000));
970 /* Store the result and condition codes. */
971 State
.regs
[OP
[1]] = result
;
972 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
973 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
974 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0));
975 trace_output (OP_REG_REG
);
978 /* subr reg1, reg2 */
982 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
;
984 trace_input ("subr", OP_REG_REG
, 0);
985 /* Compute the result. */
986 op0
= State
.regs
[OP
[0]];
987 op1
= State
.regs
[OP
[1]];
990 /* Compute the condition codes. */
992 s
= (result
& 0x80000000);
994 ov
= ((op0
& 0x80000000) != (op1
& 0x80000000)
995 && (op0
& 0x80000000) != (result
& 0x80000000));
997 /* Store the result and condition codes. */
998 State
.regs
[OP
[1]] = result
;
999 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
1000 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1001 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0));
1002 trace_output (OP_REG_REG
);
1005 /* mulh reg1, reg2 */
1009 trace_input ("mulh", OP_REG_REG
, 0);
1010 State
.regs
[OP
[1]] = ((State
.regs
[OP
[1]] & 0xffff)
1011 * (State
.regs
[OP
[0]] & 0xffff));
1012 trace_output (OP_REG_REG
);
1015 /* mulh sign_extend(imm5), reg2
1021 int value
= SEXT5 (OP
[0]);
1023 trace_input ("mulh", OP_IMM_REG
, 0);
1024 State
.regs
[OP
[1]] = (State
.regs
[OP
[1]] & 0xffff) * value
;
1025 trace_output (OP_IMM_REG
);
1028 /* mulhi imm16, reg1, reg2 */
1032 int value
= OP
[0] & 0xffff;
1034 trace_input ("mulhi", OP_IMM_REG_REG
, 0);
1035 State
.regs
[OP
[2]] = (State
.regs
[OP
[1]] & 0xffff) * value
;
1036 trace_output (OP_IMM_REG_REG
);
1039 /* divh reg1, reg2 */
1043 unsigned int op0
, op1
, result
, ov
, s
, z
;
1046 trace_input ("divh", OP_REG_REG
, 0);
1048 /* Compute the result. */
1049 temp
= SEXT16 (State
.regs
[OP
[0]]);
1051 op1
= State
.regs
[OP
[1]];
1053 if (op0
== 0xffffffff && op1
== 0x80000000)
1055 result
= 0x80000000;
1069 /* Compute the condition codes. */
1071 s
= (result
& 0x80000000);
1073 /* Store the result and condition codes. */
1074 State
.regs
[OP
[1]] = result
;
1075 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
);
1076 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1077 | (ov
? PSW_OV
: 0));
1078 trace_output (OP_REG_REG
);
1085 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
;
1087 trace_input ("cmp", OP_REG_REG_CMP
, 0);
1088 /* Compute the result. */
1089 op0
= State
.regs
[OP
[0]];
1090 op1
= State
.regs
[OP
[1]];
1093 /* Compute the condition codes. */
1095 s
= (result
& 0x80000000);
1097 ov
= ((op1
& 0x80000000) != (op0
& 0x80000000)
1098 && (op1
& 0x80000000) != (result
& 0x80000000));
1100 /* Set condition codes. */
1101 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
1102 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1103 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0));
1104 trace_output (OP_REG_REG_CMP
);
1107 /* cmp sign_extend(imm5), reg */
1111 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
;
1114 /* Compute the result. */
1115 trace_input ("cmp", OP_IMM_REG_CMP
, 0);
1116 temp
= SEXT5 (OP
[0]);
1118 op1
= State
.regs
[OP
[1]];
1121 /* Compute the condition codes. */
1123 s
= (result
& 0x80000000);
1125 ov
= ((op1
& 0x80000000) != (op0
& 0x80000000)
1126 && (op1
& 0x80000000) != (result
& 0x80000000));
1128 /* Set condition codes. */
1129 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
1130 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1131 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0));
1132 trace_output (OP_IMM_REG_CMP
);
1135 /* setf cccc,reg2 */
1139 /* Hack alert. We turn off a bit in op0 since we really only
1141 unsigned int op0
, psw
, result
= 0;
1143 trace_input ("setf", OP_EX1
, 0);
1145 psw
= State
.sregs
[5];
1150 result
= ((psw
& PSW_OV
) != 0);
1153 result
= ((psw
& PSW_CY
) != 0);
1156 result
= ((psw
& PSW_Z
) != 0);
1159 result
= ((((psw
& PSW_CY
) != 0) | ((psw
& PSW_Z
) != 0)) != 0);
1162 result
= ((psw
& PSW_S
) != 0);
1168 result
= ((((psw
& PSW_S
) != 0) ^ ((psw
& PSW_OV
) != 0)) != 0);
1171 result
= (((((psw
& PSW_S
) != 0) ^ ((psw
& PSW_OV
) != 0))
1172 || ((psw
& PSW_Z
) != 0)) != 0);
1175 result
= ((psw
& PSW_OV
) == 0);
1178 result
= ((psw
& PSW_CY
) == 0);
1181 result
= ((psw
& PSW_Z
) == 0);
1184 result
= ((((psw
& PSW_CY
) != 0) | ((psw
& PSW_Z
) != 0)) == 0);
1187 result
= ((psw
& PSW_S
) == 0);
1190 result
= ((psw
& PSW_SAT
) != 0);
1193 result
= ((((psw
& PSW_S
) != 0) ^ ((psw
& PSW_OV
) != 0)) == 0);
1196 result
= (((((psw
& PSW_S
) != 0) ^ ((psw
& PSW_OV
) != 0))
1197 || ((psw
& PSW_Z
) != 0)) == 0);
1201 State
.regs
[OP
[1]] = result
;
1202 trace_output (OP_EX1
);
1205 /* satadd reg,reg */
1209 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
, sat
;
1211 trace_input ("satadd", OP_REG_REG
, 0);
1212 /* Compute the result. */
1213 op0
= State
.regs
[OP
[0]];
1214 op1
= State
.regs
[OP
[1]];
1217 /* Compute the condition codes. */
1219 s
= (result
& 0x80000000);
1220 cy
= (result
< op0
|| result
< op1
);
1221 ov
= ((op0
& 0x80000000) == (op1
& 0x80000000)
1222 && (op0
& 0x80000000) != (result
& 0x80000000));
1225 /* Store the result and condition codes. */
1226 State
.regs
[OP
[1]] = result
;
1227 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
1228 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1229 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0)
1230 | (sat
? PSW_SAT
: 0));
1232 /* Handle saturated results. */
1234 State
.regs
[OP
[1]] = 0x80000000;
1236 State
.regs
[OP
[1]] = 0x7fffffff;
1237 trace_output (OP_REG_REG
);
1240 /* satadd sign_extend(imm5), reg */
1244 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
, sat
;
1248 trace_input ("satadd", OP_IMM_REG
, 0);
1250 /* Compute the result. */
1251 temp
= SEXT5 (OP
[0]);
1253 op1
= State
.regs
[OP
[1]];
1256 /* Compute the condition codes. */
1258 s
= (result
& 0x80000000);
1259 cy
= (result
< op0
|| result
< op1
);
1260 ov
= ((op0
& 0x80000000) == (op1
& 0x80000000)
1261 && (op0
& 0x80000000) != (result
& 0x80000000));
1264 /* Store the result and condition codes. */
1265 State
.regs
[OP
[1]] = result
;
1266 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
1267 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1268 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0)
1269 | (sat
? PSW_SAT
: 0));
1271 /* Handle saturated results. */
1273 State
.regs
[OP
[1]] = 0x80000000;
1275 State
.regs
[OP
[1]] = 0x7fffffff;
1276 trace_output (OP_IMM_REG
);
1279 /* satsub reg1, reg2 */
1283 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
, sat
;
1285 trace_input ("satsub", OP_REG_REG
, 0);
1287 /* Compute the result. */
1288 op0
= State
.regs
[OP
[0]];
1289 op1
= State
.regs
[OP
[1]];
1292 /* Compute the condition codes. */
1294 s
= (result
& 0x80000000);
1296 ov
= ((op1
& 0x80000000) != (op0
& 0x80000000)
1297 && (op1
& 0x80000000) != (result
& 0x80000000));
1300 /* Store the result and condition codes. */
1301 State
.regs
[OP
[1]] = result
;
1302 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
1303 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1304 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0)
1305 | (sat
? PSW_SAT
: 0));
1307 /* Handle saturated results. */
1309 State
.regs
[OP
[1]] = 0x80000000;
1311 State
.regs
[OP
[1]] = 0x7fffffff;
1312 trace_output (OP_REG_REG
);
1315 /* satsubi sign_extend(imm16), reg */
1319 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
, sat
;
1322 trace_input ("satsubi", OP_IMM_REG
, 0);
1324 /* Compute the result. */
1325 temp
= SEXT16 (OP
[0]);
1327 op1
= State
.regs
[OP
[1]];
1330 /* Compute the condition codes. */
1332 s
= (result
& 0x80000000);
1334 ov
= ((op1
& 0x80000000) != (op0
& 0x80000000)
1335 && (op1
& 0x80000000) != (result
& 0x80000000));
1338 /* Store the result and condition codes. */
1339 State
.regs
[OP
[1]] = result
;
1340 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
1341 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1342 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0)
1343 | (sat
? PSW_SAT
: 0));
1345 /* Handle saturated results. */
1347 State
.regs
[OP
[1]] = 0x80000000;
1349 State
.regs
[OP
[1]] = 0x7fffffff;
1350 trace_output (OP_IMM_REG
);
1353 /* satsubr reg,reg */
1357 unsigned int op0
, op1
, result
, z
, s
, cy
, ov
, sat
;
1359 trace_input ("satsubr", OP_REG_REG
, 0);
1361 /* Compute the result. */
1362 op0
= State
.regs
[OP
[0]];
1363 op1
= State
.regs
[OP
[1]];
1366 /* Compute the condition codes. */
1368 s
= (result
& 0x80000000);
1369 cy
= (result
< op0
);
1370 ov
= ((op1
& 0x80000000) != (op0
& 0x80000000)
1371 && (op1
& 0x80000000) != (result
& 0x80000000));
1374 /* Store the result and condition codes. */
1375 State
.regs
[OP
[1]] = result
;
1376 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_CY
| PSW_OV
);
1377 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1378 | (cy
? PSW_CY
: 0) | (ov
? PSW_OV
: 0)
1379 | (sat
? PSW_SAT
: 0));
1381 /* Handle saturated results. */
1383 State
.regs
[OP
[1]] = 0x80000000;
1385 State
.regs
[OP
[1]] = 0x7fffffff;
1386 trace_output (OP_REG_REG
);
1393 unsigned int op0
, op1
, result
, z
, s
;
1395 trace_input ("tst", OP_REG_REG_CMP
, 0);
1397 /* Compute the result. */
1398 op0
= State
.regs
[OP
[0]];
1399 op1
= State
.regs
[OP
[1]];
1402 /* Compute the condition codes. */
1404 s
= (result
& 0x80000000);
1406 /* Store the condition codes. */
1407 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
);
1408 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0));
1409 trace_output (OP_REG_REG_CMP
);
1416 trace_input ("mov", OP_REG_REG_MOVE
, 0);
1417 State
.regs
[OP
[1]] = State
.regs
[OP
[0]];
1418 trace_output (OP_REG_REG_MOVE
);
1421 /* mov sign_extend(imm5), reg */
1425 int value
= SEXT5 (OP
[0]);
1427 trace_input ("mov", OP_IMM_REG_MOVE
, 0);
1428 State
.regs
[OP
[1]] = value
;
1429 trace_output (OP_IMM_REG_MOVE
);
1432 /* movea sign_extend(imm16), reg, reg */
1437 int value
= SEXT16 (OP
[0]);
1439 trace_input ("movea", OP_IMM_REG_REG
, 0);
1440 State
.regs
[OP
[2]] = State
.regs
[OP
[1]] + value
;
1441 trace_output (OP_IMM_REG_REG
);
1444 /* movhi imm16, reg, reg */
1448 uint32 value
= (OP
[0] & 0xffff) << 16;
1450 trace_input ("movhi", OP_UIMM_REG_REG
, 16);
1451 State
.regs
[OP
[2]] = State
.regs
[OP
[1]] + value
;
1452 trace_output (OP_UIMM_REG_REG
);
1455 /* sar zero_extend(imm5),reg1 */
1459 unsigned int op0
, op1
, result
, z
, s
, cy
;
1461 trace_input ("sar", OP_IMM_REG
, 0);
1463 op1
= State
.regs
[OP
[1]];
1464 result
= (signed)op1
>> op0
;
1466 /* Compute the condition codes. */
1468 s
= (result
& 0x80000000);
1469 cy
= (op1
& (1 << (op0
- 1)));
1471 /* Store the result and condition codes. */
1472 State
.regs
[OP
[1]] = result
;
1473 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
| PSW_CY
);
1474 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1475 | (cy
? PSW_CY
: 0));
1476 trace_output (OP_IMM_REG
);
1479 /* sar reg1, reg2 */
1483 unsigned int op0
, op1
, result
, z
, s
, cy
;
1485 trace_input ("sar", OP_REG_REG
, 0);
1486 op0
= State
.regs
[OP
[0]] & 0x1f;
1487 op1
= State
.regs
[OP
[1]];
1488 result
= (signed)op1
>> op0
;
1490 /* Compute the condition codes. */
1492 s
= (result
& 0x80000000);
1493 cy
= (op1
& (1 << (op0
- 1)));
1495 /* Store the result and condition codes. */
1496 State
.regs
[OP
[1]] = result
;
1497 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
| PSW_CY
);
1498 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1499 | (cy
? PSW_CY
: 0));
1500 trace_output (OP_REG_REG
);
1503 /* shl zero_extend(imm5),reg1 */
1507 unsigned int op0
, op1
, result
, z
, s
, cy
;
1509 trace_input ("shl", OP_IMM_REG
, 0);
1511 op1
= State
.regs
[OP
[1]];
1512 result
= op1
<< op0
;
1514 /* Compute the condition codes. */
1516 s
= (result
& 0x80000000);
1517 cy
= (op1
& (1 << (32 - op0
)));
1519 /* Store the result and condition codes. */
1520 State
.regs
[OP
[1]] = result
;
1521 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
| PSW_CY
);
1522 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1523 | (cy
? PSW_CY
: 0));
1524 trace_output (OP_IMM_REG
);
1527 /* shl reg1, reg2 */
1531 unsigned int op0
, op1
, result
, z
, s
, cy
;
1533 trace_input ("shl", OP_REG_REG
, 0);
1534 op0
= State
.regs
[OP
[0]] & 0x1f;
1535 op1
= State
.regs
[OP
[1]];
1536 result
= op1
<< op0
;
1538 /* Compute the condition codes. */
1540 s
= (result
& 0x80000000);
1541 cy
= (op1
& (1 << (32 - op0
)));
1543 /* Store the result and condition codes. */
1544 State
.regs
[OP
[1]] = result
;
1545 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
| PSW_CY
);
1546 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1547 | (cy
? PSW_CY
: 0));
1548 trace_output (OP_REG_REG
);
1551 /* shr zero_extend(imm5),reg1 */
1555 unsigned int op0
, op1
, result
, z
, s
, cy
;
1557 trace_input ("shr", OP_IMM_REG
, 0);
1559 op1
= State
.regs
[OP
[1]];
1560 result
= op1
>> op0
;
1562 /* Compute the condition codes. */
1564 s
= (result
& 0x80000000);
1565 cy
= (op1
& (1 << (op0
- 1)));
1567 /* Store the result and condition codes. */
1568 State
.regs
[OP
[1]] = result
;
1569 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
| PSW_CY
);
1570 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1571 | (cy
? PSW_CY
: 0));
1572 trace_output (OP_IMM_REG
);
1575 /* shr reg1, reg2 */
1579 unsigned int op0
, op1
, result
, z
, s
, cy
;
1581 trace_input ("shr", OP_REG_REG
, 0);
1582 op0
= State
.regs
[OP
[0]] & 0x1f;
1583 op1
= State
.regs
[OP
[1]];
1584 result
= op1
>> op0
;
1586 /* Compute the condition codes. */
1588 s
= (result
& 0x80000000);
1589 cy
= (op1
& (1 << (op0
- 1)));
1591 /* Store the result and condition codes. */
1592 State
.regs
[OP
[1]] = result
;
1593 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
| PSW_CY
);
1594 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0)
1595 | (cy
? PSW_CY
: 0));
1596 trace_output (OP_REG_REG
);
1603 unsigned int op0
, op1
, result
, z
, s
;
1605 trace_input ("or", OP_REG_REG
, 0);
1607 /* Compute the result. */
1608 op0
= State
.regs
[OP
[0]];
1609 op1
= State
.regs
[OP
[1]];
1612 /* Compute the condition codes. */
1614 s
= (result
& 0x80000000);
1616 /* Store the result and condition codes. */
1617 State
.regs
[OP
[1]] = result
;
1618 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
);
1619 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0));
1620 trace_output (OP_REG_REG
);
1623 /* ori zero_extend(imm16), reg, reg */
1627 unsigned int op0
, op1
, result
, z
, s
;
1629 trace_input ("ori", OP_UIMM_REG_REG
, 0);
1630 op0
= OP
[0] & 0xffff;
1631 op1
= State
.regs
[OP
[1]];
1634 /* Compute the condition codes. */
1636 s
= (result
& 0x80000000);
1638 /* Store the result and condition codes. */
1639 State
.regs
[OP
[2]] = result
;
1640 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
);
1641 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0));
1642 trace_output (OP_UIMM_REG_REG
);
1649 unsigned int op0
, op1
, result
, z
, s
;
1651 trace_input ("and", OP_REG_REG
, 0);
1653 /* Compute the result. */
1654 op0
= State
.regs
[OP
[0]];
1655 op1
= State
.regs
[OP
[1]];
1658 /* Compute the condition codes. */
1660 s
= (result
& 0x80000000);
1662 /* Store the result and condition codes. */
1663 State
.regs
[OP
[1]] = result
;
1664 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
);
1665 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0));
1666 trace_output (OP_REG_REG
);
1669 /* andi zero_extend(imm16), reg, reg */
1673 unsigned int op0
, op1
, result
, z
;
1675 trace_input ("andi", OP_UIMM_REG_REG
, 0);
1676 op0
= OP
[0] & 0xffff;
1677 op1
= State
.regs
[OP
[1]];
1680 /* Compute the condition codes. */
1683 /* Store the result and condition codes. */
1684 State
.regs
[OP
[2]] = result
;
1685 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
);
1686 State
.sregs
[5] |= (z
? PSW_Z
: 0);
1687 trace_output (OP_UIMM_REG_REG
);
1694 unsigned int op0
, op1
, result
, z
, s
;
1696 trace_input ("xor", OP_REG_REG
, 0);
1698 /* Compute the result. */
1699 op0
= State
.regs
[OP
[0]];
1700 op1
= State
.regs
[OP
[1]];
1703 /* Compute the condition codes. */
1705 s
= (result
& 0x80000000);
1707 /* Store the result and condition codes. */
1708 State
.regs
[OP
[1]] = result
;
1709 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
);
1710 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0));
1711 trace_output (OP_REG_REG
);
1714 /* xori zero_extend(imm16), reg, reg */
1718 unsigned int op0
, op1
, result
, z
, s
;
1720 trace_input ("xori", OP_UIMM_REG_REG
, 0);
1721 op0
= OP
[0] & 0xffff;
1722 op1
= State
.regs
[OP
[1]];
1725 /* Compute the condition codes. */
1727 s
= (result
& 0x80000000);
1729 /* Store the result and condition codes. */
1730 State
.regs
[OP
[2]] = result
;
1731 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
);
1732 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0));
1733 trace_output (OP_UIMM_REG_REG
);
1736 /* not reg1, reg2 */
1740 unsigned int op0
, result
, z
, s
;
1742 trace_input ("not", OP_REG_REG_MOVE
, 0);
1743 /* Compute the result. */
1744 op0
= State
.regs
[OP
[0]];
1747 /* Compute the condition codes. */
1749 s
= (result
& 0x80000000);
1751 /* Store the result and condition codes. */
1752 State
.regs
[OP
[1]] = result
;
1753 State
.sregs
[5] &= ~(PSW_Z
| PSW_S
| PSW_OV
);
1754 State
.sregs
[5] |= ((z
? PSW_Z
: 0) | (s
? PSW_S
: 0));
1755 trace_output (OP_REG_REG_MOVE
);
1762 unsigned int op0
, op1
, op2
;
1765 trace_input ("set1", OP_BIT
, 0);
1766 op0
= State
.regs
[OP
[0]];
1768 temp
= SEXT16 (OP
[2]);
1770 temp
= get_byte (State
.mem
+ op0
+ op2
);
1771 State
.sregs
[5] &= ~PSW_Z
;
1772 if ((temp
& (1 << op1
)) == 0)
1773 State
.sregs
[5] |= PSW_Z
;
1775 put_byte (State
.mem
+ op0
+ op2
, temp
);
1776 trace_output (OP_BIT
);
1783 unsigned int op0
, op1
, op2
;
1786 trace_input ("not1", OP_BIT
, 0);
1787 op0
= State
.regs
[OP
[0]];
1789 temp
= SEXT16 (OP
[2]);
1791 temp
= get_byte (State
.mem
+ op0
+ op2
);
1792 State
.sregs
[5] &= ~PSW_Z
;
1793 if ((temp
& (1 << op1
)) == 0)
1794 State
.sregs
[5] |= PSW_Z
;
1796 put_byte (State
.mem
+ op0
+ op2
, temp
);
1797 trace_output (OP_BIT
);
1804 unsigned int op0
, op1
, op2
;
1807 trace_input ("clr1", OP_BIT
, 0);
1808 op0
= State
.regs
[OP
[0]];
1810 temp
= SEXT16 (OP
[2]);
1812 temp
= get_byte (State
.mem
+ op0
+ op2
);
1813 State
.sregs
[5] &= ~PSW_Z
;
1814 if ((temp
& (1 << op1
)) == 0)
1815 State
.sregs
[5] |= PSW_Z
;
1816 temp
&= ~(1 << op1
);
1817 put_byte (State
.mem
+ op0
+ op2
, temp
);
1818 trace_output (OP_BIT
);
1825 unsigned int op0
, op1
, op2
;
1828 trace_input ("tst1", OP_BIT
, 0);
1829 op0
= State
.regs
[OP
[0]];
1831 temp
= SEXT16 (OP
[2]);
1833 temp
= get_byte (State
.mem
+ op0
+ op2
);
1834 State
.sregs
[5] &= ~PSW_Z
;
1835 if ((temp
& (1 << op1
)) == 0)
1836 State
.sregs
[5] |= PSW_Z
;
1837 trace_output (OP_BIT
);
1844 trace_input ("di", OP_NONE
, 0);
1845 State
.sregs
[5] |= PSW_ID
;
1846 trace_output (OP_NONE
);
1853 trace_input ("ei", OP_NONE
, 0);
1854 State
.sregs
[5] &= ~PSW_ID
;
1855 trace_output (OP_NONE
);
1858 /* halt, not supported */
1862 trace_input ("halt", OP_NONE
, 0);
1863 State
.exception
= SIGQUIT
;
1864 trace_output (OP_NONE
);
1867 /* reti, not supported */
1871 trace_input ("reti", OP_NONE
, 0);
1872 trace_output (OP_NONE
);
1876 /* trap, not supportd */
1882 trace_input ("trap", OP_TRAP
, 0);
1883 trace_output (OP_TRAP
);
1885 /* Trap 0 is used for simulating low-level I/O */
1889 int save_errno
= errno
;
1892 /* Registers passed to trap 0 */
1894 #define FUNC State.regs[6] /* function number, return value */
1895 #define PARM1 State.regs[7] /* optional parm 1 */
1896 #define PARM2 State.regs[8] /* optional parm 2 */
1897 #define PARM3 State.regs[9] /* optional parm 3 */
1899 /* Registers set by trap 0 */
1901 #define RETVAL State.regs[10] /* return value */
1902 #define RETERR State.regs[11] /* return error code */
1904 /* Turn a pointer in a register into a pointer into real memory. */
1906 #define MEMPTR(x) ((char *)((x) + State.mem))
1911 #if !defined(__GO32__) && !defined(_WIN32)
1916 RETVAL
= execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
),
1917 (char **)MEMPTR (PARM3
));
1920 RETVAL
= execve (MEMPTR (PARM1
), (char **) MEMPTR (PARM2
), NULL
);
1929 RETVAL
= pipe (host_fd
);
1930 SW (buf
, host_fd
[0]);
1931 buf
+= sizeof(uint16
);
1932 SW (buf
, host_fd
[1]);
1940 RETVAL
= wait (&status
);
1948 RETVAL
= v850_callback
->read (v850_callback
, PARM1
, MEMPTR (PARM2
),
1953 RETVAL
= (int)v850_callback
->write_stdout (v850_callback
,
1954 MEMPTR (PARM2
), PARM3
);
1956 RETVAL
= (int)v850_callback
->write (v850_callback
, PARM1
,
1957 MEMPTR (PARM2
), PARM3
);
1960 RETVAL
= v850_callback
->lseek (v850_callback
, PARM1
, PARM2
, PARM3
);
1963 RETVAL
= v850_callback
->close (v850_callback
, PARM1
);
1966 RETVAL
= v850_callback
->open (v850_callback
, MEMPTR (PARM1
), PARM2
);
1969 /* EXIT - caller can look in PARM1 to work out the
1971 if (PARM1
== 0xdead || PARM1
== 0x1)
1972 State
.exception
= SIGABRT
;
1974 State
.exception
= SIGQUIT
;
1978 case SYS_stat
: /* added at hmsi */
1979 /* stat system call */
1981 struct stat host_stat
;
1984 RETVAL
= stat (MEMPTR (PARM1
), &host_stat
);
1988 /* The hard-coded offsets and sizes were determined by using
1989 * the D10V compiler on a test program that used struct stat.
1991 SW (buf
, host_stat
.st_dev
);
1992 SW (buf
+2, host_stat
.st_ino
);
1993 SW (buf
+4, host_stat
.st_mode
);
1994 SW (buf
+6, host_stat
.st_nlink
);
1995 SW (buf
+8, host_stat
.st_uid
);
1996 SW (buf
+10, host_stat
.st_gid
);
1997 SW (buf
+12, host_stat
.st_rdev
);
1998 SLW (buf
+16, host_stat
.st_size
);
1999 SLW (buf
+20, host_stat
.st_atime
);
2000 SLW (buf
+28, host_stat
.st_mtime
);
2001 SLW (buf
+36, host_stat
.st_ctime
);
2007 RETVAL
= chown (MEMPTR (PARM1
), PARM2
, PARM3
);
2010 RETVAL
= chmod (MEMPTR (PARM1
), PARM2
);
2013 /* Cast the second argument to void *, to avoid type mismatch
2014 if a prototype is present. */
2015 RETVAL
= utime (MEMPTR (PARM1
), (void *) MEMPTR (PARM2
));
2023 else if (OP
[0] == 1 )
2025 char *fstr
= State
.regs
[2] + State
.mem
;
2036 trace_input ("ldsr", OP_LDSR
, 0);
2037 op0
= State
.regs
[OP
[0]];
2038 State
.sregs
[OP
[1]] = op0
;
2039 trace_output (OP_LDSR
);
2042 /* stsr, not supported */
2048 trace_input ("stsr", OP_STSR
, 0);
2049 op0
= State
.sregs
[OP
[1]];
2050 State
.regs
[OP
[0]] = op0
;
2051 trace_output (OP_STSR
);