-/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
+/* This file is part of SIS (SPARC instruction simulator)
+
+ Copyright (C) 1995-2021 Free Software Foundation, Inc.
+ Contributed by Jiri Gaisler, European Space Agency
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "config.h"
+/* This must come before any other includes. */
+#include "defs.h"
+
#include "sis.h"
#include <math.h>
#include <stdio.h>
#endif
static uint32
-sub_cc(psr, operand1, operand2, result)
- uint32 psr;
- int32 operand1;
- int32 operand2;
- int32 result;
+sub_cc(uint32 psr, int32 operand1, int32 operand2, int32 result)
{
psr = ((psr & ~PSR_N) | ((result >> 8) & PSR_N));
if (result)
}
uint32
-add_cc(psr, operand1, operand2, result)
- uint32 psr;
- int32 operand1;
- int32 operand2;
- int32 result;
+add_cc(uint32 psr, int32 operand1, int32 operand2, int32 result)
{
psr = ((psr & ~PSR_N) | ((result >> 8) & PSR_N));
if (result)
}
static void
-log_cc(result, sregs)
- int32 result;
- struct pstate *sregs;
+log_cc(int32 result, struct pstate *sregs)
{
sregs->psr &= ~(PSR_CC); /* Zero CC bits */
sregs->psr = (sregs->psr | ((result >> 8) & PSR_N));
}
int
-dispatch_instruction(sregs)
- struct pstate *sregs;
+dispatch_instruction(struct pstate *sregs)
{
uint32 cwp, op, op2, op3, asi, rd, cond, rs1,
static int
-fpexec(op3, rd, rs1, rs2, sregs)
- uint32 op3, rd, rs1, rs2;
- struct pstate *sregs;
+fpexec(uint32 op3, uint32 rd, uint32 rs1, uint32 rs2, struct pstate *sregs)
{
uint32 opf, tem, accex;
int32 fcc;
/* SPARC is big-endian - swap double floats if host is little-endian */
/* This is ugly - I know ... */
- /* FIXME: should use (CURRENT_HOST_BYTE_ORDER == CURRENT_TARGET_BYTE_ORDER)
+ /* FIXME: should use (HOST_BYTE_ORDER == CURRENT_TARGET_BYTE_ORDER)
but what about machines where float values are different endianness
from integer values? */
}
static int
-chk_asi(sregs, asi, op3)
- struct pstate *sregs;
- uint32 *asi, op3;
-
+chk_asi(struct pstate *sregs, uint32 *asi, uint32 op3)
{
if (!(sregs->psr & PSR_S)) {
sregs->trap = TRAP_PRIVI;
}
int
-execute_trap(sregs)
- struct pstate *sregs;
+execute_trap(struct pstate *sregs)
{
int32 cwp;
extern struct irqcell irqarr[16];
int
-check_interrupts(sregs)
- struct pstate *sregs;
+check_interrupts(struct pstate *sregs)
{
#ifdef ERRINJ
if (errtt) {
}
void
-init_regs(sregs)
- struct pstate *sregs;
+init_regs(struct pstate *sregs)
{
sregs->pc = 0;
sregs->npc = 4;