aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>1999-04-26 18:34:20 +0000
committerStan Shebs <shebs@codesourcery.com>1999-04-26 18:34:20 +0000
commit7a292a7adf506b866905b06b3024c0fd411c4583 (patch)
tree5b208bb48269b8a82d5c3a5f19c87b45a62a22f4 /sim/ppc
parent1996fae84682e8ddd146215dd2959ad1ec924c09 (diff)
downloadbinutils-7a292a7adf506b866905b06b3024c0fd411c4583.zip
binutils-7a292a7adf506b866905b06b3024c0fd411c4583.tar.gz
binutils-7a292a7adf506b866905b06b3024c0fd411c4583.tar.bz2
import gdb-19990422 snapshot
Diffstat (limited to 'sim/ppc')
-rw-r--r--sim/ppc/ChangeLog18
-rw-r--r--sim/ppc/dc-complex4
-rw-r--r--sim/ppc/igen.c5
-rw-r--r--sim/ppc/interrupts.c6
-rw-r--r--sim/ppc/interrupts.h2
-rw-r--r--sim/ppc/ppc-instructions16
-rw-r--r--sim/ppc/psim.c11
-rw-r--r--sim/ppc/sim_calls.c10
8 files changed, 41 insertions, 31 deletions
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index 49cf8ce..93312f0 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,21 @@
+1999-04-02 Keith Seitz <keiths@cygnus.com>
+
+ * sim_calls.c (POLL_QUIT_INTERVAL): Define. Used to tweak
+ the frequency at which the poll_quit callback is called.
+ (poll_quit_count): New global.
+ (sim_io_poll_quit): Only call the poll_quit callback
+ after the specified POLL_QUIT_INTERVAL.
+
+1999-02-22 Jim Lemke <jlemke@cygnus.com>
+
+ * dc-complex: Force expansion on all bits of field BO.
+ Previously, the least-significant (prediction) bit was ignored.
+ * ppc-instructions (conditional branches): Implement mpc860c0 option.
+ * igen.c (gen_semantics_[ch]): Setup for mpc860c0 option.
+ * psim.c (is_num, psim_options): Added parsing for mpc860c0 option.
+ * interrupts.h: Added "mpc860c0_instruction_program_interrupt".
+ * interrupts.c (program_interrupt): Added handling for above interrupt.
+
1999-02-01 Jim Blandy <jimb@zwingli.cygnus.com>
Make the simulator compatible with the MPC750. It would be nicer
diff --git a/sim/ppc/dc-complex b/sim/ppc/dc-complex
index 13361ec..34a5861 100644
--- a/sim/ppc/dc-complex
+++ b/sim/ppc/dc-complex
@@ -20,9 +20,9 @@
array,normal: 0: 5: 0: 5:
array,normal: 21:31:32:-1:OE,LR,AA,Rc,LK:
##
-## Branch Conditional instruction - Expand BO{0:4} only, ignore BO{5}
+## Branch Conditional instruction - Expand BO{0:4}
##
-array,expand-forced: 6: 9: 6: 9:BO: 0xfc000000:0x40000000
+array,expand-forced: 6:10: 6:10:BO: 0xfc000000:0x40000000
##
## Expand RA on equality with 0 in Add instructions were if(RA==0) appears.
##
diff --git a/sim/ppc/igen.c b/sim/ppc/igen.c
index dc87087..94dcf51 100644
--- a/sim/ppc/igen.c
+++ b/sim/ppc/igen.c
@@ -181,14 +181,12 @@ gen_semantics_h(insn_table *table,
SEMANTIC_FUNCTION_FORMAL);
lf_printf(file, "\n");
if ((code & generate_calls)) {
- lf_printf(file, "#ifdef WITH_OPTION_MPC860C0\n");
lf_printf(file, "extern int option_mpc860c0;\n");
lf_printf(file, "#define PAGE_SIZE 0x1000\n");
lf_printf(file, "\n");
lf_printf(file, "EXTERN_SEMANTICS(void)\n");
lf_printf(file, "semantic_init(device* root);\n");
lf_printf(file, "\n");
- lf_printf(file, "#endif // WITH_OPTION_MPC860C0\n");
if (generate_expanded_instructions)
insn_table_traverse_tree(table,
file, NULL,
@@ -222,7 +220,6 @@ gen_semantics_c(insn_table *table,
lf_printf(file, "#include \"semantics.h\"\n");
lf_printf(file, "#include \"support.h\"\n");
lf_printf(file, "\n");
- lf_printf(file, "#ifdef WITH_OPTION_MPC860C0\n");
lf_printf(file, "int option_mpc860c0 = 0;\n");
lf_printf(file, "\n");
lf_printf(file, "EXTERN_SEMANTICS(void)\n");
@@ -231,9 +228,9 @@ gen_semantics_c(insn_table *table,
lf_printf(file, " option_mpc860c0 = 0;\n");
lf_printf(file, " if (tree_find_property(root, \"/options/mpc860c0\"))\n");
lf_printf(file, " option_mpc860c0 = tree_find_integer_property(root, \"/options/mpc860c0\");\n");
+ lf_printf(file, " option_mpc860c0 *= 4; /* convert word count to byte count */\n");
lf_printf(file, "}\n");
lf_printf(file, "\n");
- lf_printf(file, "#endif // WITH_OPTION_MPC860C0\n");
if (generate_expanded_instructions)
insn_table_traverse_tree(table,
file, cache_rules,
diff --git a/sim/ppc/interrupts.c b/sim/ppc/interrupts.c
index 7a13f76..deab7e9 100644
--- a/sim/ppc/interrupts.c
+++ b/sim/ppc/interrupts.c
@@ -315,12 +315,10 @@ program_interrupt(cpu *processor,
cpu_error(processor, cia, "program interrupt - %s",
"illegal instruction (optional instruction not supported)");
break;
-#ifdef WITH_OPTION_MPC860C0
case mpc860c0_instruction_program_interrupt:
cpu_error(processor, cia, "program interrupt - %s",
"problematic branch detected, see MPC860 C0 errata");
break;
-#endif // WITH_OPTION_MPC860C0
default:
error("internal error - program_interrupt - reason %d not implemented", reason);
}
@@ -342,13 +340,11 @@ program_interrupt(cpu *processor,
case trap_program_interrupt:
srr1_set = srr1_trap;
break;
-#ifdef WITH_OPTION_MPC860C0
case mpc860c0_instruction_program_interrupt:
srr1_set = 0;
- error(processor, cia, "program interrupt - %s",
+ cpu_error(processor, cia, "program interrupt - %s",
"problematic branch detected, see MPC860 C0 errata");
break;
-#endif // WITH_OPTION_MPC860C0
default:
srr1_set = 0;
error("internal error - program_interrupt - reason %d not implemented", reason);
diff --git a/sim/ppc/interrupts.h b/sim/ppc/interrupts.h
index 6e87b77..93447a8 100644
--- a/sim/ppc/interrupts.h
+++ b/sim/ppc/interrupts.h
@@ -94,9 +94,7 @@ typedef enum {
privileged_instruction_program_interrupt,
trap_program_interrupt,
optional_instruction_program_interrupt, /* subset of illegal instruction */
-#ifdef WITH_OPTION_MPC860C0
mpc860c0_instruction_program_interrupt, /* fwd br, taken but not predicted, near EO page */
-#endif // WITH_OPTION_MPC860C0
nr_program_interrupt_reasons
} program_interrupt_reasons;
diff --git a/sim/ppc/ppc-instructions b/sim/ppc/ppc-instructions
index 6ebe081..cfbac64 100644
--- a/sim/ppc/ppc-instructions
+++ b/sim/ppc/ppc-instructions
@@ -1440,7 +1440,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
*603: PPC_UNIT_BPU, PPC_UNIT_BPU, 1, 1, 0
*603e:PPC_UNIT_BPU, PPC_UNIT_BPU, 1, 1, 0
*604: PPC_UNIT_BPU, PPC_UNIT_BPU, 1, 1, 0
- /* WITH_OPTION_MPC860C0
+ /* option_mpc860c0:
No problem here because this branch is predicted taken (unconditional). */
if (AA) NIA = IEA(EXTS(LI_0b00));
else NIA = IEA(CIA + EXTS(LI_0b00));
@@ -1469,9 +1469,8 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
else
succeed = 0;
if (LK) LR = (spreg)IEA(CIA + 4);
- #ifdef WITH_OPTION_MPC860C0
- if (option_mpc860c0 && (BO{0} && BO{2} || !BO{4})) {
- /* This branch is predicted as not-taken.
+ if (option_mpc860c0 && (!BO{0} || !BO{2}) && !BO{4}) {
+ /* This branch is predicted as "normal".
If this is a forward branch and it is near the end of a page,
we've detected a problematic branch. */
if (succeed && NIA > CIA) {
@@ -1479,7 +1478,6 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
program_interrupt(processor, cia, mpc860c0_instruction_program_interrupt);
}
}
- #endif // WITH_OPTION_MPC860C0
if (CURRENT_MODEL_ISSUE > 0)
model_branches(cpu_model(processor), succeed, BO);
if (! BO{0}) {
@@ -1513,8 +1511,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
else
succeed = 0;
if (LK) LR = (spreg)IEA(CIA + 4);
- #ifdef WITH_OPTION_MPC860C0
- if (option_mpc860c0 && (BO{0} && BO{2} || !BO{4})) {
+ if (option_mpc860c0 && (!BO{0} || !BO{2}) && !BO{4}) {
/* This branch is predicted as not-taken.
If this is a forward branch and it is near the end of a page,
we've detected a problematic branch. */
@@ -1523,7 +1520,6 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
program_interrupt(processor, cia, mpc860c0_instruction_program_interrupt);
}
}
- #endif // WITH_OPTION_MPC860C0
if (CURRENT_MODEL_ISSUE > 0) {
model_branches(cpu_model(processor), succeed, BO);
if (! BO{0})
@@ -1546,8 +1542,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
else
succeed = 0;
if (LK) LR = (spreg)IEA(CIA + 4);
- #ifdef WITH_OPTION_MPC860C0
- if (option_mpc860c0 && (BO{0} && BO{2} || !BO{4})) {
+ if (option_mpc860c0 && (!BO{0} || !BO{2}) && !BO{4}) {
/* This branch is predicted as not-taken.
If this is a forward branch and it is near the end of a page,
we've detected a problematic branch. */
@@ -1556,7 +1551,6 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
program_interrupt(processor, cia, mpc860c0_instruction_program_interrupt);
}
}
- #endif // WITH_OPTION_MPC860C0
if (CURRENT_MODEL_ISSUE > 0) {
model_branches(cpu_model(processor), succeed, BO);
if (! BO{0})
diff --git a/sim/ppc/psim.c b/sim/ppc/psim.c
index 81e54b0..20d843b 100644
--- a/sim/ppc/psim.c
+++ b/sim/ppc/psim.c
@@ -220,7 +220,7 @@ psim_usage(int verbose)
}
/* Test "string" for containing a string of digits that form a number
-between "min" and "max". The return value is the number of "err". */
+between "min" and "max". The return value is the number or "err". */
static
int is_num( char *string, int min, int max, int err)
{
@@ -316,7 +316,6 @@ psim_options(device *root,
break;
case 'o':
param = find_arg("Missing <dev-spec> option for -o\n", &argp, argv);
-#ifdef WITH_OPTION_MPC860C0
if (memcmp(param, "mpc860c0", 8) == 0)
{
if (param[8] == '\0')
@@ -328,7 +327,6 @@ psim_options(device *root,
else error("Invalid mpc860c0 option for -o\n");
}
else
-#endif // WITH_OPTION_MPC860C0
current = tree_parse(current, "%s", param);
break;
case 'r':
@@ -354,9 +352,10 @@ psim_options(device *root,
NULL, 0,
device_ioctl_set_trace);
-#ifdef WITH_OPTION_MPC860C0
- semantic_init(root);
-#endif // WITH_OPTION_MPC860C0
+ {
+ void semantic_init(device* root);
+ semantic_init(root);
+ }
/* return where the options end */
return argv + argp;
diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c
index bb84539..15df3c5 100644
--- a/sim/ppc/sim_calls.c
+++ b/sim/ppc/sim_calls.c
@@ -45,6 +45,13 @@
#include "callback.h"
#include "remote-sim.h"
+/* Define the rate at which the simulator should poll the host
+ for a quit. */
+#ifndef POLL_QUIT_INTERVAL
+#define POLL_QUIT_INTERVAL 0x20
+#endif
+
+static int poll_quit_count = POLL_QUIT_INTERVAL;
/* Structures used by the simulator, for gdb just have static structures */
@@ -324,8 +331,9 @@ sim_do_command (SIM_DESC sd, char *cmd)
void
sim_io_poll_quit (void)
{
- if (callbacks->poll_quit != NULL)
+ if (callbacks->poll_quit != NULL && poll_quit_count-- < 0)
{
+ poll_quit_count = POLL_QUIT_INTERVAL;
if (callbacks->poll_quit (callbacks))
psim_stop (simulator);
}