Commit Graph

72 Commits

Author SHA1 Message Date
Bryce Denney
5d9fa0844e - rename "_long" to "dword" in eip structure in cpu64.
- add get_erx() method to bx_gen_reg_t which returns the erx field of the
  structure (which is has a different name in cpu and cpu64).  Providing
  an accessor is one strategy for avoiding igly "#ifdef BX_SUPPORT_X86_64"
  statements in the rest of the code.
- cpu64/init.cc: the "eflags" before get_flag and set_flag is no longer
  correct. removed.
- modified files: load32bitOShack.cc logio.cc cpu/cpu.h cpu64/apic.cc
  cpu64/cpu.h cpu64/init.cc cpu64/proc_ctrl.cc debug/dbg_main.cc
2002-09-12 18:52:14 +00:00
Bryce Denney
5fc31bcfda - this revision changes the way eflags are accessed throughout the cpu and
cpu64 directories.  Instead of using the macros introduced in cpu.h rev 1.37
  such as GetEFlagsDFLogical and SetEFlagsDF and ClearEFlagsDF, I made inline
  methods on the BX_CPU_C object that access the eflags fields.  The problem
  with the macros is that they cannot be used outside the BX_CPU_C object.  The
  macros have now been removed, and all references to eflags now use these new
  accessors.
- I debated whether to put the accessors as members of the BX_CPU_C object
  or members of the bx_flags_reg_t struct.  I chose to make them members
  of BX_CPU_C for two reasons: 1. the lazy flags are implemented as
  members of BX_CPU_C, and 2. the eflags are referenced in many many places
  and it is more compact without having to put eflags in front of each.  (The
  real problem with compactness is having to write BX_CPU_THIS_PTR in front of
  everything, but that's another story.)
- Kevin pointed out a major bug in my set accessor code.  What a difference a
  little tilde can make!  That is fixed now.
- modified: load32bitOShack.cc debug/dbg_main.cc
  and in both cpu and cpu64 directories:
    cpu.cc cpu.h ctrl_xfer_pro.cc debugstuff.cc exception.cc flag_ctrl.cc
    flag_ctrl_pro.cc init.cc io.cc io_pro.cc proc_ctrl.cc soft_int.cc
    string.cc vm8086.cc
2002-09-12 18:10:46 +00:00
Bryce Denney
0fdbbae45b - integrate Peter Tattam's x86-64 emulation code into the main branch!
This adds a whole new directory cpu64 with the new emulation code.
  Very few changes were necessary outside cpu64.  To try it, configure
  with --enable-x86-64 and make.
- also this adds Peter Tattam's external debugger interface.
- modified files: Makefile.in bochs.h config.h.in configure.in
  load32bitOShack.cc logio.cc cpu/Makefile.in cpu/cpu.cc debug/dbg_main.cc
- added files: cpu/extdb.cc cpu/extdb.h and cpu64/*
2002-09-12 07:16:37 +00:00
Bryce Denney
450070850b - the debugger was broken by recent changes in the cpu flags. To provide
a consistent way of accessing these flags that works both inside and
  outside the BX_CPU class, I added inline accessor methods for each
  flag: assert_FLAG(), clear_FLAG(), set_FLAG(value), and get_FLAG ()
  that returns its value.  I use assert to mean "set the value to one"
  to avoid confusion, since there's also a set method that takes a value.
- the eflags access macros (e.g. GetEFlagsDFLogical, ClearEFlagsTF) are
  now defined in terms of the inline accessors.  In most cases it will
  result in the same code anyway.  The major advantage of the accesors
  is that they can be used from inside or outside the BX_CPU object, while
  the macros can only be used from inside.
- since almost all eflags were stored in val32 now, I went ahead and
  removed the if_, rf, and vm fields.  Now the val32 bit is the
  "official" value for these flags, and they have accessors just like
  everything else.
- init.cc: move the registration of registers until after they have been
  initialized so that the initial value of each parameter is correct.

Modified files:
  debug/dbg_main.cc cpu/cpu.h cpu/debugstuff.cc cpu/flag_ctrl.cc
  cpu/flag_ctrl_pro.cc cpu/init.cc
2002-09-11 03:55:22 +00:00
Gregory Alexander
4f6039f533 Macroize BX_TLB_QUICK_INVALIDATE code.
Kevin Lawton says he doesn't get a performance benefit.

I'm not sure if I do.  Either way, the difference isn't
very large.

This code may get removed if it turns out to be useless.
2002-09-06 19:21:55 +00:00
Bryce Denney
d28b9cec9f - when I added bx_dbg_symbolic_address_16bit, I forgot to put a stub
in the "#if !BX_HAVE_HASH_MAP" section.  Now there is one.
2002-09-06 17:41:56 +00:00
Bryce Denney
80a3900b8b - apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
  gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
  gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc

----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep  6 12:13:28 EDT 2002

Description:

Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.)  This is the first step toward
making something resembling a wxWindows debugger.

First, variables which are going to be visible in the CI must be
registered as parameters.  For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.

To deal with this, I introduced the concept of a shadow parameter.  A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value.  Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods.  Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.

To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.

The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class).  I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value.  At the moment, in the
Debug:Show CPU dialog, changing the values has no effect.  However
this is trivial to add when it's time (just call CommitChanges!).  It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.

The Refresh() method must be called periodically or else the dialog
will show the initial values forever.  At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().

Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
  implement shadow parameter class for Boolean, called bx_shadow_bool_c.
  more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
  its display.  For now, the refresh event causes the CI to check every
  parameter it is watching and change the display value.  Later, it may
  be worth the trouble to keep track of which parameters have actually
  changed.  Code in the simulator thread calls SIM->refresh_ci(), which
  creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
  the config interface.  When it arrives in the wxWindows gui thread,
  it calls RefreshDialogs(), which calls the Refresh() method on any
  dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
  is printed.  Otherwise, the refresh would wait until the next
  SIM->periodic(), which might be thousands of cycles.  This way,
  when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
  which tells whether it has any need for refresh events.  If no
  dialogs are showing that need refresh events, then no event is sent
  between threads.
- add a few defaults to the param classes that affect the settings of
  newly created parameters.  When declaring a lot of params with
  similar settings it's more compact to set the default for new params
  rather than to change each one separately.  default_text_format is
  the printf format string for displaying numbers.  default_base is
  the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
  boxes such as "Debug:Show CPU".  The new Refresh() method queries
  all the parameters for their current value and changes the value in
  the wxWindows control.  The ParamDialog class still needs a little
  work; for example, if it's modal it should have Cancel/Ok buttons,
  but if it's going to be modeless it should maybe have Apply (commit
  any changes) and Close.
2002-09-06 16:43:26 +00:00
Gregory Alexander
afdccad36c Oops, had to fix a bunch of parentheses.
Why | has precedence under == (or is it =)
I still don't understand.
2002-09-06 16:29:49 +00:00
Gregory Alexander
1c3ae99300 Speed-up for TLB invalidates as proposed by Peter Tattam.
I had been planning on this same thing in a similar form
for the I$, so this made a lot of sense, and was easy to
implement.
2002-09-06 14:58:56 +00:00
Bryce Denney
b76eb56a8e - fix signal handling for wxWindows with text debugger. There are still
problems with control-C handling if you enable readline, because readline()
  installs its own signal handlers every time you call it.  I'm having
  good luck with "--with-wx --enable-debugger --disable-readline" now.
2002-09-05 19:40:17 +00:00
Kevin Lawton
f0c9896964 Now, when you compile with --enable-guest2host-tlb, non-paged
mode uses the notion of the guest-to-host TLB.  This has the
benefit of allowing more uniform and streamlined acceleration
code in access.cc which does not have to check if CR0.PG
is set, eliminating a few instructions per guest access.
Shaved just a little off execution time, as expected.

Also, access_linear now breaks accesses which span two pages,
into two calls the the physical memory routines, when paging
is off, just like it always has for paging on.  Besides
being more uniform, this allows the physical memory access
routines to known the complete data item is contained
within a single physical page, and stop reapplying the
A20ADDR() macro to pointers as it increments them.
Perhaps things can be optimized a little more now there too...
I renamed the routines to {read,write}PhysicalPage() as
a reminder that these routines now operate on data
solely within one page.

I also added a little code so that the paging module is
notified when the A20 line is tweaked, so it can dump
whatever mappings it wants to.
2002-09-05 02:31:24 +00:00
Bryce Denney
44ec9a0fc8 - update Makefile dependencies on nearly everything 2002-08-27 22:43:57 +00:00
Bryce Denney
fa63941b96 - attempt to fix compile when loader and debugger are both enabled.
This isn't the biggest problem though...the biggest problem is that
  loader.cc and bx_loader.cc haven't been in the source for 2+ years.
2002-08-27 21:32:03 +00:00
Bryce Denney
a7e9c74a0e - bx_devices.reset now requires a type arg: BX_RESET_HARDWARE 2002-08-27 20:09:00 +00:00
Volker Ruppert
09d99d1be9 - bx_dbg_main(): removed duplicate stuff already done by bx_init_hardware() 2002-08-05 16:35:08 +00:00
Volker Ruppert
efd02e9c19 - the new reset() function must be called by the debugger, too 2002-08-02 05:41:04 +00:00
Bryce Denney
8bdb84f197 - symbol lookup for addresses after the last known symbol were printed
as no symbol.  Now they will be relative to the last symbol.
- when anything was looked up in a segment with a nonzero base address,
  it would print "non-zero base" and abort the lookup.  I disabled this
  behavior so that it would look up the symbol based on the EIP despite
  the base.  This change makes it possible to trace user processes, in
  which the base is 0xc0000000.
- symbol lookup also used to fail in 16-bit code.  Since the address
  translations rules for 16-bit code are simple enough, I just compute
  the 20-bit linear address and look up the symbol with it.  Now I
  can load a symbol table of the ROMBIOS and it works.
2002-08-01 21:10:55 +00:00
Christophe Bothamy
749c920c61 - moved "SIM->set_ini_done(1)" after device initialization.
(fixes a core dumped when the debugger is enabled)
2002-07-08 11:49:47 +00:00
Bryce Denney
30aaf4088e - commit patch.wxwindows.gz in the main branch. Now you can try out
the wxwindows interface by just "configure --with-wx; make"

  Modified Files:
    Makefile.in bochs.h config.h.in configure configure.in
    load32bitOShack.cc logio.cc main.cc cpu/cpu.cc cpu/cpu.h
    debug/dbg_main.cc gui/Makefile.in gui/control.cc gui/gui.cc
    gui/siminterface.cc gui/siminterface.h gui/x.cc iodev/cdrom.cc
    iodev/keyboard.cc memory/misc_mem.cc
  Added Files:
    README-wxWindows wxbochs.rc gui/wx.cc gui/wxmain.cc
    gui/wxmain.h gui/bitmaps/cdromd.xpm
    gui/bitmaps/configbutton.xpm gui/bitmaps/copy.xpm
    gui/bitmaps/floppya.xpm gui/bitmaps/floppyb.xpm
    gui/bitmaps/mouse.xpm gui/bitmaps/paste.xpm
    gui/bitmaps/power.xpm gui/bitmaps/reset.xpm
    gui/bitmaps/snapshot.xpm
  Removed Files:
    patches/patch.wxwindows.gz
2002-04-18 00:22:20 +00:00
instinc
77ae7958f8 displays the address of the caught watchpoint, feature request #435271 2002-04-01 04:44:15 +00:00
Bryce Denney
a54fa93583 - clean up disassembly output for SMP debugging 2002-03-20 04:09:26 +00:00
Bryce Denney
2c5a8dafed - apply patch.smp-hlt-deadlock which avoids a deadlock in SMP simulation
(with debugger enabled) when all SMP machines are halted.
2002-03-20 03:49:19 +00:00
Bryce Denney
180f62a303 - commit patch.smp-debug-wli, based on a patch from
William Lee Irwin III <wli@holomorphy.com>
2002-03-20 02:49:07 +00:00
Bryce Denney
de51eda5d1 - apply patch.triple-fault-recover 2002-03-12 09:16:41 +00:00
Gregory Alexander
29ba221c3e Make trace output more meaningful by printing each instruction immediately
BEFORE it is executed.  Print the registers at this time, BEFORE the
instruction, since they are the values BEFORE the instruction is executed.

The important result of this is that in TRACE output, both the instruction
causing an exception and the first instruction of the exception handler
are BOTH printed.

I'm working on getting this behavior in the debugger user-interface.

 Modified Files:
 	cpu/cpu.cc debug/dbg_main.cc
2002-02-15 22:58:06 +00:00
instinc
3bd36d7220 added the trace-reg-on and trace-reg-off commands 2001-11-28 18:40:02 +00:00
instinc
2be059ee4f added the trace-reg-on and trace-reg-off command 2001-11-28 18:39:19 +00:00
instinc
170eed5b66 added the trace-reg-on and trace-reg-off command
updated the register trace to bypass the lazy flags behaviour
2001-11-28 18:38:32 +00:00
instinc
0a87115340 added trace-reg-on and trace-reg-off commands 2001-11-28 18:37:12 +00:00
Bryce Denney
93913d3606 - fix output of info gdt for TSSes 2001-11-11 04:55:14 +00:00
Bryce Denney
c99f9aa8ef - use @CPP_SUFFIX@ substitution to get the dependencies right for nmake too 2001-10-07 20:19:04 +00:00
Bryce Denney
8a21b1a9d6 - apply patches/patch.add-makefile-deps. I have added dependencies
which were generated with gcc -MM to the end of each Makefile.in
  so that make understands which files depend on which.  Basically,
  everything depends on bochs.h, which depends on everything, which
  is not ideal.
2001-10-07 00:33:21 +00:00
Bryce Denney
1dea7b1d3e - I changed the args to bx_parse_cmdline in main.cc, so I had to update this as
well.
2001-10-06 23:14:42 +00:00
Bryce Denney
78a6fe2f27 - disassemble first instruction at f000:fff0
- print time with disassembly of the instruction to be executed
2001-10-06 00:01:12 +00:00
Bryce Denney
a9afc2336d - fix bug that caused the instruction to be executed to be NOT printed
when tracing was on.
2001-10-05 21:03:53 +00:00
Bryce Denney
f3da589ced - debug needs debug.h, so include the current directory in -I$(srcdir)/. 2001-10-04 17:51:09 +00:00
instinc
80d5bc27bd added time_ticks() to the instruction trace 2001-10-04 15:34:33 +00:00
instinc
de156bd8d6 added flags output with the register tracing enabled, was nice to have IF status etc. 2001-10-03 21:12:59 +00:00
instinc
9ebcb7651c Added the ability to trace registers value as you trace the code 2001-10-03 19:53:09 +00:00
Bryce Denney
daf2a9fb55 - add RCS Id to header of every file. This makes it easier to know what's
going on when someone sends in a modified file.
2001-10-03 13:10:38 +00:00
Bryce Denney
c2e09b1889 - oops, it didn't compile when you had debugger on bug ne2k off. Now it does. 2001-10-01 04:07:29 +00:00
Bryce Denney
a07d62fd24 - add "info ne2k" command to the debugger, which prints all the registers
of the NE2000 model.
2001-09-29 19:16:34 +00:00
Bryce Denney
f59e68968c - add call to SIM->set_init_done to match the one in main 2001-09-28 06:01:08 +00:00
Bryce Denney
3075cb34ed - remove comment that I was using when debugging control-C 2001-09-27 23:50:48 +00:00
Bryce Denney
198f783f8b - my speed boost changes to main.cc and cpu.cc on June 5 were an improvement
in performance, but I did not check the debugger carefully enough while
  testing them.  Part of the performance gain in main.cc revision 1.33 and
  cpu.cc revision 1.9 was to allow bochs to stay in the cpu loop forever
  in a single processor simulation.  (In a multiprocessor simulation it must
  quit the loop periodically to give the other procs a chance to simulate
  too.  Cooperative multiprocessing?)  In the process, I restored calls
  to BX_TICK in the cpu loop for 1-proc simulation only, and removed them
  from the outer loop.  (See main.cc, since it was done right.)  However
  I never made the equivalent change in the debugger code, so in the
  debugger, there were ticks coming from the cpu loop and then an
  equivalent number of ticks coming from the debugger code just outside
  the cpu loop.  The result was, of course, that simulation time went
  at 2x the correct rate.  This simulation time speedup was made even
  worse because the continue loop in the debugger would increment ticks
  by one quantum (5 at the time) no matter how many instructions had
  actually been executed.  So in trace mode in particular, the way it was
  implemented before today, cpu loop would run only one instruction at
  a time and the simulation time would get incremented 1+5=6 times!  One
  tick from the cpu loop, then 5 erroneous ticks from the continue loop.
  Anyway, much of this nonsense should be fixed now.  For uniprocessor
  simulations, only the cpu loop does ticks (for best performance).  For
  multiprocessor simulations, the cpu loop exits after one quantum and
  the code that calls the cpu loop gets to increment ticks instead.
2001-09-27 23:08:30 +00:00
Bryce Denney
9a1364b1f9 - apply patches/patch.consistent2b. Description:
> This patch fixes a number of debugger problems.
>   - with trace-on, simulation time would pass 5x faster than usual, so
>     interrupts and other timed events would happen at different times
>   - with trace-on, breakpoints were ignored
>   - with trace-on, control-C would not stop the processor and return to the
>     debugger.
>
> This patch changes the execution quantum for the debugger to 1, which means
> that cpu_loop is asked to do one instruction at a time.  This may cause
> bochs with the debugger to be slower than before.
>
> I haven't tested without the debugger yet, so I don't know if the timing
> of events matches or not.
2001-09-27 14:19:38 +00:00
Bryce Denney
69ca4e2a9d - change "long long" to Bit64u, several times
- clean up declarations of "int i" in bx_dbg_watch
2001-09-24 00:42:00 +00:00
Bryce Denney
fd7e7ee86c - added debugger command "info fpu" which prints all FPU registers
in an output format similar to gdb (when you do info all-registers).
  Also, if you do "info all" you get the CPU registers and the FPU
  registers.
- added bx_cpu_c method called fpu_print_regs, which is implemented
  in wmFPUemu_glue.cc
2001-09-15 06:55:14 +00:00
Bryce Denney
f04e6fe346 - apply VPATH patch from Edouard G. Parmelan, posted to list on September 1 2001-09-14 04:19:08 +00:00
Bryce Denney
b62b7f4bde - use instrumentation macros for
BX_INSTR_START BX_INSTR_STOP BX_INSTR_RESET BX_INSTR_PRINT
  They used to be callback functions, a long time ago.
2001-06-28 19:46:34 +00:00