Commit bd66c316 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Index: ChangeLog

from  Benoît Perrot  <benoit@lrde.epita.fr>
        Use coprocessor to raise exception.

        * src/vm/cp0.hh:
        (raise_overflow) Raise an arithmetic overflow exception.
        * src/vm/cpu.cc:
        Call raise_overflow when an arithmetic overflow occurs.
parent 63785fc1
2004-04-25 Benot Perrot <benoit@lrde.epita.fr>
Use coprocessor to raise exception.
* src/vm/cp0.hh:
(raise_overflow) Raise an arithmetic overflow exception.
* src/vm/cpu.cc:
Call raise_overflow when an arithmetic overflow occurs.
2004-04-25 Benot Perrot <benoit@lrde.epita.fr>
* src/mipsy-tasks.hh,
......
......@@ -2,26 +2,24 @@
(Created-By-Prcs-Version 1 3 2)
(Project-Description "")
(Project-Version mipsy 0 88)
(Parent-Version mipsy 0 87)
(Project-Version mipsy 0 89)
(Parent-Version mipsy 0 88)
(Version-Log
"Index: ChangeLog
from Benot Perrot <benoit@lrde.epita.fr>
Use coprocessor to raise exception.
* src/vm/cp0.hh:
(raise_overflow) Raise an arithmetic overflow exception.
* src/vm/cpu.cc:
Call raise_overflow when an arithmetic overflow occurs.
* src/mipsy-tasks.hh,
* src/vm/vm-tasks.hh,
* src/shell/shell-tasks.hh:
Add short options.
* src/task/task_register.hh, src/task/task_register.cc:
Support concatenated short options.
* NEWS, doc/mipsy.texi:
Document this.
")
(New-Version-Log
"")
(Checkin-Time "Sun, 25 Apr 2004 16:59:39 +0200")
(Checkin-Time "Sun, 25 Apr 2004 18:22:46 +0200")
(Checkin-Login benoit)
(Files
......@@ -29,7 +27,7 @@ from Beno
;; ./
(AUTHORS (mipsy/0_AUTHORS 1.2 644))
(COPYING (mipsy/1_COPYING 1.1 644))
(ChangeLog (mipsy/2_ChangeLog 1.82 604))
(ChangeLog (mipsy/2_ChangeLog 1.83 604))
(INSTALL (mipsy/b/12_INSTALL 1.1 604))
(Makefile.am (mipsy/3_Makefile.a 1.9 604))
(NEWS (mipsy/b/25_NEWS 1.10 604))
......@@ -121,9 +119,9 @@ from Beno
;; ./src/vm/
(src/vm/Makefile.am (mipsy/b/0_Makefile.a 1.5 604))
(src/vm/cp0.hh (mipsy/b/16_cp0.hh 1.1 644))
(src/vm/cp0.hh (mipsy/b/16_cp0.hh 1.2 644))
(src/vm/cpu.hh (mipsy/b/1_cpu.hh 1.19 604))
(src/vm/cpu.cc (mipsy/b/5_virtual_ma 1.26 604))
(src/vm/cpu.cc (mipsy/b/5_virtual_ma 1.27 604))
(src/vm/memory.hh (mipsy/b/2_memory.hh 1.10 604))
(src/vm/mmu.hh (mipsy/c/15_mmu.hh 1.3 604))
(src/vm/segment.hh (mipsy/b/3_segment.hh 1.5 644))
......
......@@ -69,6 +69,26 @@ namespace vm
desave = 31 ///< Debug exception SAVE
};
public:
/// Cause exception codes
enum exception_type
{
interrupt = 0, ///< Interrupt
tlb_modified = 1, ///< TLB modified
tlb_load = 2, ///< TLB load
tlb_store = 3, ///< TLB store
addr_load = 4, ///< Address error on load
addr_store = 5, ///< Address error on store
bus_inst = 6, ///< Bus error on instruction fetch
bus_data = 7, ///< Bus error on data load or store
syscall = 8, ///< System call
breakpoint = 9, ///< Breakpoint
reserved_inst = 10, ///< Reserved instruction
cop_unusable = 11, ///< Coprocessor unusable
overflow = 12, ///< Arithmetic overflow
trap = 13, ///< Trap
floating_point = 15 ///< Floating point exception
};
/** \name Constructor and destructor
\{ */
......@@ -112,7 +132,19 @@ namespace vm
}
/** \} */
/** \name Exception handling
\{ */
public:
/// Raise an arithmetic overflow exception
void raise_overflow()
{
registers[cause] = overflow;
std::cerr << "Runtime Exception: Overflow" << std::endl;
exit_set(exit_runtime);
}
/** \} */
protected:
/// Dedicated registers (32 bits)
register_type registers[32];
......
......@@ -136,10 +136,7 @@ namespace vm
// FIXME: might be accelerated by testing only the sign bit.
if ((a < 0 && b < 0 && c > 0) ||
(a > 0 && b > 0 && c < 0))
{
std::cerr << "Runtime Exception: Overflow" << std::endl;
exit_set(exit_runtime);
}
cp0_.raise_overflow();
}
void
Cpu::visit(const inst::Addi& addi)
......@@ -153,10 +150,7 @@ namespace vm
// FIXME: might be accelerated by testing only the sign bit.
if ((a < 0 && b < 0 && c > 0) ||
(a > 0 && b > 0 && c < 0))
{
std::cerr << "Runtime Exception: Overflow" << std::endl;
exit_set(exit_runtime);
}
cp0_.raise_overflow();
}
void
Cpu::visit(const inst::Addu& addu)
......@@ -182,10 +176,7 @@ namespace vm
set_register(sub.get_dest (), c);
if ((a < b && c > 0) || (a > b && c < 0))
{
std::cerr << "Runtime Exception: Overflow" << std::endl;
exit_set(exit_runtime);
}
cp0_.raise_overflow();
}
void
Cpu::visit(const inst::Subu& subu)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment