AlphaCPU.cpp File Reference

Detailed Description

Contains the code for the emulated DecChip 21264CB EV68 Alpha processor.

AlphaCPU.cpp,v 1.79 2008/03/26 19:06:49 iamcamiel Exp

X-1.79 Camiel Vanderhoeven 26-MAR-2008 Fix compiler warnings.

X-1.78 Camiel Vanderhoeven 19-MAR-2008 IDB versions compileable again.

X-1.77 Camiel Vanderhoeven 15-MAR-2008 Remove confusing outer for-loop in CAlphaCPU::run().

X-1.76 Camiel Vanderhoeven 14-MAR-2008 Formatting.

X-1.75 Camiel Vanderhoeven 14-MAR-2008 1. More meaningful exceptions replace throwing (int) 1. 2. U64 macro replaces X64 macro.

X-1.74 Camiel Vanderhoeven 13-MAR-2008 Create init(), start_threads() and stop_threads() functions.

X-1.73 Camiel Vanderhoeven 11-MAR-2008 Don't printf calibration loop.

X-1.72 Camiel Vanderhoeven 05-MAR-2008 Multi-threading version.

X-1.71 Camiel Vanderhoeven 04-MAR-2008 Support some basic MP features. (CPUID read from C-Chip MISC register, inter-processor interrupts)

X-1.70 Camiel Vanderhoeven 29-FEB-2008 Comments.

X-1.69 Brian Wheeler 29-FEB-2008 Add BREAKPOINT INSTRUCTION command to IDB.

X-1.68 Brian Wheeler 27-FEB-2008 Avoid compiler warnings.

X-1.67 Camiel Vanderhoeven 08-FEB-2008 Show originating device name on memory errors.

X-1.66 Camiel Vanderhoeven 05-FEB-2008 Only use new floating-point code when HAVE_NEW_FP has been defined.

X-1.65 Camiel Vanderhoeven 01-FEB-2008 Avoid unnecessary shift-operations to calculate constant values.

X-1.64 Camiel Vanderhoeven 30-JAN-2008 Always use set_pc or add_pc to change the program counter.

X-1.63 Camiel Vanderhoeven 30-JAN-2008 Remember number of instructions left in current memory page, so that the translation-buffer doens't need to be consulted on every instruction fetch when the Icache is disabled.

X-1.62 Camiel Vanderhoeven 29-JAN-2008 Comments.

X-1.61 Camiel Vanderhoeven 29-JAN-2008 Undid last change, remember separate last found translation-buffer entries for read and wrote operations. This should help with memory copy operations.

X-1.60 Camiel Vanderhoeven 27-JAN-2008 Have GO_PAL throw an exception, so we don't continue doing what we were doing before the exception was taken.

X-1.59 Camiel Vanderhoeven 26-JAN-2008 Made IDB compile again.

X-1.58 Camiel Vanderhoeven 25-JAN-2008 Added option to disable the icache.

X-1.57 Camiel Vanderhoeven 22-JAN-2008 Nicer initialization of "state" structure.

X-1.56 Camiel Vanderhoeven 22-JAN-2008 Implemented missing /V integer instructions.

X-1.55 Camiel Vanderhoeven 21-JAN-2008 Moved some macro's to cpu_defs.h; implement new floating-point code.

X-1.54 Camiel Vanderhoeven 19-JAN-2008 Run CPU in a separate thread if CPU_THREADS is defined. NOTA BENE: This is very experimental, and has several problems.

X-1.53 Camiel Vanderhoeven 18-JAN-2008 Replaced sext_64 inlines with sext_u64_<bits> inlines for performance reasons (thanks to David Hittner for spotting this!); Process device interrupts after a 100-cpu-cycle delay.

X-1.52 David Hittner 16-JAN-2008 Added ADDL/V instruction, added MIPS estimate (define MIPS_ESTIMATE)

X-1.51 Camiel Vanderhoeven 08-JAN-2008 Removed last references to IDE disk read SRM replacement.

X-1.50 Camiel Vanderhoeven 30-DEC-2007 Print file id on initialization.

X-1.49 Camiel Vanderhoeven 28-DEC-2007 Keep the compiler happy.

X-1.48 Camiel Vanderhoeven 17-DEC-2007 SaveState file format 2.1

X-1.47 Camiel Vanderhoeven 10-DEC-2007 Use configurator.

X-1.46 Camiel Vanderhoeven 2-DEC-2007 Changed the way translation buffers work, the way interrupts work.

X-1.45 Brian Wheeler 1-DEC-2007 Added support for instruction counting, underlined lines in listings, corrected some unsigned/signed issues.

X-1.44 Camiel Vanderhoeven 16-NOV-2007 Avoid more compiler warnings.

X-1.43 Camiel Vanderhoeven 16-NOV-2007 Avoid compiler warning about default without any cases.

X-1.42 Camiel Vanderhoeven 08-NOV-2007 Instruction set complete now.

X-1.41 Camiel Vanderhoeven 06-NOV-2007 Performance improvements to ICACHE: last result is kept; cache lines are larger (512 DWORDS in stead of 16 DWORDS), cache size is configurable (both number of cache lines and size of each cache line), memcpy is used to move memory into the ICACHE. CAVEAT: ICACHE can only be filled from memory (not from I/O).

X-1.40 Camiel Vanderhoeven 02-NOV-2007 Added integer /V instructions.

X-1.39 Camiel Vanderhoeven 02-NOV-2007 Added missing floating point instructions.

X-1.38 Eduardo Marcelo Ferrat 31-OCT-2007 EXC_SUM contained the wrong register (3 in stead of 1) on a DTBM exception. Added instructions for CVTDG, CVTGD, MULG, CVTGF.

X-1.37 Camiel Vanderhoeven 18-APR-2007 Faster lockstep mechanism (send info 50 cpu cycles at a time)

X-1.36 Camiel Vanderhoeven 11-APR-2007 Moved all data that should be saved to a state file to a structure "state".

X-1.35 Camiel Vanderhoeven 10-APR-2007 New mechanism for SRM replacements. Where these need to be executed, CSystem::LoadROM() puts a special opcode (a CALL_PAL instruction with an otherwise illegal operand of 0x01234xx) in memory. CAlphaCPU::DoClock() recognizes these opcodes and performs the SRM action.

X-1.34 Camiel Vanderhoeven 10-APR-2007 Unintentional version number increase.

X-1.33 Camiel Vanderhoeven 30-MAR-2007 Formatting.

X-1.32 Camiel Vanderhoeven 29-MAR-2007 Added AST to the list of conditions that cause the processor to go to the interrupt PAL vector (680).

X-1.31 Brian Wheeler 28-MAR-2007 Fixed missing ) after if !defined(SRM_NO_SPEEDUPS

X-1.30 Camiel Vanderhoeven 26-MAR-2007 a) Possibility to disable SRM-code replacements with the defines SRM_NO_IDE, SRM_NO_SRL, and SRM_NO_SPEEDUPS b) Possibility to send SRM-code replacement debugging messages to the console, with the defines DEBUG_SRM_IDE and DEBUG_SRM_SRL c) Added software-interrupts to the list of conditions that can cause the processot to go to the interrupt PAL vector (680)

X-1.29 Camiel Vanderhoeven 14-MAR-2007 Formatting.

X-1.28 Camiel Vanderhoeven 14-MAR-2007 Fixed typo in "case 0x22: OP(CPYSE,F12_f3);"

X-1.27 Camiel Vanderhoeven 13-MAR-2007 Added some floating-point opcodes, added es_float.h inclusion

X-1.26 Camiel Vanderhoeven 12-MAR-2007 a) Changed call to CTranslationBuffer::convert_address (arguments list changed) b) Set values for EXC_SUM and MM_STAT on various exceptions

X-1.25 Camiel Vanderhoeven 9-MAR-2007 In the listing-process, addresses were executed twice

X-1.24 Camiel Vanderhoeven 8-MAR-2007 a) Changed call to CTranslationBuffer::write_pte (arguments list changed) b) Backed-out X-1.23 as real problem was solved. (X-1.3 in cpu_bwx.h)

X-1.23 Camiel Vanderhoeven 7-MAR-2007 HACK to stop APB.EXE from crashing when passing bootflags

X-1.22 Camiel Vanderhoeven 3-MAR-2007 Wrote code to be executed in stead of SRM console code for writing to the serial port, and reading from IDE disks. Mechanism is based on recognition of the PC value. Should be replaced with a better mechanism in the future.

X-1.21 Camiel Vanderhoeven 2-MAR-2007 Initialize debug_string to "".

X-1.20 Camiel Vanderhoeven 2-MAR-2007 Fixed problem in Save and RestoreState; argument f conflicted with class member f.

X-1.19 Camiel Vanderhoeven 28-FEB-2007 Added support for the lockstep-mechanism.

X-1.18 Camiel Vanderhoeven 27-FEB-2007 Removed an unreachable "return 0;" line from DoClock

X-1.17 Camiel Vanderhoeven 22-FEB-2007 E_FAULT returned from translation buffer now causes DFAULT exception

X-1.16 Camiel Vanderhoven 22-FEB-2007 a) Changed call to CTranslationBuffer::convert_address (arguments list changed) b) Fixed HW_MTPR and HW_MFPR opcodes

X-1.15 Camiel Vanderhoeven 19-FEB-2007 Fixed preprocessor macro concatenation bug (used ## both before and after the literal; changed this to only before).

X-1.14 Camiel Vanderhoeven 18-FEB-2007 Put all actual code behind the processor opcodes in cpu_xxx.h include files, and replaced them with OP(...,...) macro's in this file.

X-1.13 Camiel Vanderhoeven 16-FEB-2007 a) Added CAlphaCPU::listing. b) Clocking changes (due to changes in CSystem): CAlphaCPU::DoClock now returns a value, and the CPU is registered as a fast clocked device.

X-1.12 Brian Wheeler 13-FEB-2007 Different algorithm used for UMULH (previous algorithm suffered from portability issues).

X-1.11 Camiel Vanderhoeven 13-FEB-2007 a) Bugfix in the UMULH instruction. b) Bugfix in the HW_MTPR VA_CTL instruction. Now updates va_ctl_va_mode instead of i_ctl_va_mode.

X-1.10 Camiel Vanderhoeven 12-FEB-2007 a) Moved debugging macro's to cpu_debug.h b) Cleaned up SEXT and REG macro's (a lot neater now) c) Moved CAlphaCPU::get_r and CAlphaCPU::get_prbr to AlphaCPU.h as inline functions d) Use SEXT macro in a some places where exotic constructions were used previously

X-1.9 Camiel Vanderhoeven 12-FEB-2007 a) Added X64_BYTE, X64_WORD, X64_LONG and X64_QUAD, and used these instead of the corresponding values. b) Added ier to the variables that are saved to the state file.

X-1.8 Camiel Vanderhoeven 9-FEB-2007 a) Moved debugging flags (booleans) to CSystem.cpp. b) Removed loggin of last_write_loc and last_write_val

X-1.7 Camiel Vanderhoeven 7-FEB-2007 Made various dubugging-related statements dependent on the definition of IDB (interactive debugger)

X-1.6 Camiel Vanderhoeven 3-FEB-2007 Inline function printable moved to StdAfx.h

X-1.5 Brian Wheeler 3-FEB-2007 Formatting.

X-1.4 Brian Wheeler 3-FEB-2007 More scanf and printf statements made compatible with Linux/GCC/glibc.

X-1.3 Brian Wheeler 3-FEB-2007 Scanf and printf statements made compatible with Linux/GCC/glibc.

X-1.2 Brian Wheeler 3-FEB-2007 Includes are now case-correct (necessary on Linux)

X-1.1 Camiel Vanderhoeven 19-JAN-2007 Initial version in CVS.

Definition in file AlphaCPU.cpp.

#include "StdAfx.h"
#include "AlphaCPU.h"
#include "TraceEngine.h"
#include "lockstep.h"
#include "cpu_memory.h"
#include "cpu_control.h"
#include "cpu_arith.h"
#include "cpu_logical.h"
#include "cpu_bwx.h"
#include "cpu_fp_memory.h"
#include "cpu_fp_branch.h"
#include "cpu_fp_operate.h"
#include "cpu_misc.h"
#include "cpu_vax.h"
#include "cpu_mvi.h"
#include "cpu_pal.h"
#include "cpu_debug.h"
#include "es40_float.h"

Go to the source code of this file.


Translation Buffer related functions

#define GH_0_MATCH   U64(0x000007ffffffe000)
#define GH_0_PHYS   U64(0x00000fffffffe000)
#define GH_0_KEEP   U64(0x0000000000001fff)
#define GH_1_MATCH   U64(0x000007ffffff0000)
#define GH_1_PHYS   U64(0x00000fffffff0000)
#define GH_1_KEEP   U64(0x000000000000ffff)
#define GH_2_MATCH   U64(0x000007fffff80000)
#define GH_2_PHYS   U64(0x00000ffffff80000)
#define GH_2_KEEP   U64(0x000000000007ffff)
#define GH_3_MATCH   U64(0x000007ffffc00000)
#define GH_3_PHYS   U64(0x00000fffffc00000)
#define GH_3_KEEP   U64(0x00000000003fffff)


void handle_debug_string (char *s)
 Do whatever needs to be done to a debug-string.


char dbg_string [1000]
static u32 cpu_magic1 = 0x2126468C
static u32 cpu_magic2 = 0xC8646212
const char * PAL_NAME []
const char * IPR_NAME []

Define Documentation

#define GH_0_KEEP   U64(0x0000000000001fff)

Definition at line 1840 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_0_MATCH   U64(0x000007ffffffe000)

Definition at line 1838 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_0_PHYS   U64(0x00000fffffffe000)

Definition at line 1839 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_1_KEEP   U64(0x000000000000ffff)

Definition at line 1844 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_1_MATCH   U64(0x000007ffffff0000)

Definition at line 1842 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_1_PHYS   U64(0x00000fffffff0000)

Definition at line 1843 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_2_KEEP   U64(0x000000000007ffff)

Definition at line 1847 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_2_MATCH   U64(0x000007fffff80000)

Definition at line 1845 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_2_PHYS   U64(0x00000ffffff80000)

Definition at line 1846 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_3_KEEP   U64(0x00000000003fffff)

Definition at line 1850 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_3_MATCH   U64(0x000007ffffc00000)

Definition at line 1848 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

#define GH_3_PHYS   U64(0x00000fffffc00000)

Definition at line 1849 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::add_tb().

Function Documentation

void handle_debug_string ( char *  s  ) 

Do whatever needs to be done to a debug-string.

Used in IDB-mode to handle the disassembly- string. In es40_idb, it is written to the standard output.

s Pointer to the debug string.

Definition at line 474 of file AlphaCPU.cpp.

References dbg_strptr.

Variable Documentation

u32 cpu_magic1 = 0x2126468C [static]

Definition at line 1336 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::RestoreState(), and CAlphaCPU::SaveState().

u32 cpu_magic2 = 0xC8646212 [static]

Definition at line 1337 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::RestoreState(), and CAlphaCPU::SaveState().

char dbg_string[1000]

Definition at line 461 of file AlphaCPU.cpp.

Referenced by CAlphaCPU::execute().

const char* IPR_NAME[]

Definition at line 2118 of file AlphaCPU.cpp.

const char* PAL_NAME[]

Definition at line 2081 of file AlphaCPU.cpp. Logo
Project space on