Commit Graph

2211 Commits

Author SHA1 Message Date
Bryce Denney
be659a09b3 - check in Stanislav Shwartsman's patch "bochs-mmx.patch-endian-support".
He writes: Detailed description: MMX instruction set support.
  Also supports BIG_ENDIAN systems. Tested on Solaris and HP1100.
- modified files:
    configure.in cpu/Makefile.in cpu/cpu.h cpu/fetchdecode.cc
    cpu/proc_ctrl.cc fpu/fpu_system.h fpu/wmFPUemu_glue.cc
- added files: cpu/i387.h cpu/mmx.cc
2002-09-09 16:11:25 +00:00
Christophe Bothamy
19ed21c9b0 - set default action to REPORT for panics. I think that's only used when reading
options.
- fixed setting the log options.
2002-09-09 07:19:23 +00:00
Volker Ruppert
813cc30712 - the win32 gui now uses the vga_charmap data for the vga text display if the
fontheight is >=14
- removed unnecessary GetDC() call in function create_vga_font()
2002-09-08 16:41:19 +00:00
Volker Ruppert
0ac366ada2 - the wx gui now uses the vga_charmap data for the vga text display 2002-09-08 09:23:45 +00:00
Volker Ruppert
d23d121674 - new function set_text_charmap() stores the vga charmap data in the array
vga_charmap
- the SDL gui uses the charmap data for the vga text display
  * TODO: implement this feature for other guis
- removed unused variables in sdl.cc and gui.cc
- fixed a warning in vga.cc
2002-09-08 07:56:10 +00:00
Kevin Lawton
0d7a5fdf3c I rehashed the way the EFLAGS register was stored internally.
All the EFLAGS bits used to be cached in separate fields.  I left
a few of them in separate fields for now - might remove them
at some point also.  When the arithmetic fields are known
(ie they're not in lazy mode), they are all cached in a
32-bit EFLAGS image, just like the x86 EFLAGS register expects.
All other eflags are store in the 32-bit register also, with
a few also mirrored in separate fields for now.

The reason I did this, was so that on x86 hosts, asm() statements
can be #ifdef'd in to do the calculation and get the native
eflags results very cheaply.  Just to test that it works, I
coded ADD_EdId() and ADD_EwIw() with some conditionally compiled
asm()s for accelerated eflags processing and it works.

-Kevin
2002-09-08 04:08:14 +00:00
Volker Ruppert
1332f37bce - do the longjmp() only when variable quit_context is not NULL 2002-09-07 14:27:50 +00:00
Volker Ruppert
71eda78391 - bx_init_hardware(): log actions must be updated when bochs starts with -q 2002-09-07 09:57:54 +00:00
Kevin Lawton
51c93e12a1 The paging unit gets notified of all CR0/CR3/CR4 updates so
it can decide how to proceed.  Some of those bits are necessary
to make TLB invalidation decisions.  INVLPG doesn't cause
a whole TLB flush anymore, just one page.  Some of the
current CPU behaviours model the P6, especially on CR0
reloads.  Earlier processors kept some pre-change pre-fetched
instructions until a branch.  We could probably model that
by setting a flag, and letting the revalidate_prefetch_q
function cause serialization.

The TLB flush code only invalidates entries which are not
already invalidated for the case where the TLB invalidation
ID trick is not in use.
2002-09-07 05:21:28 +00:00
Kevin Lawton
ee6bd143e2 One more .cvsignore file. 2002-09-06 22:26:17 +00:00
Kevin Lawton
61186a2b37 Added ".cvsignore" files, to ignore a few extra file names which
are not being ignored by default, like Makefile and other
generated files.
2002-09-06 22:24:32 +00:00
Kevin Lawton
491035fcb2 I extended the guest-to-host TLB acceleration across the
Read-Modify-Write instructions.  The first read phase stores
the host pointer in the "pages" field if a direct use pointer
is available.  The Write phase first checks if a pointer was
issued and uses it for a direct write if available.

I chose the "pages" field since it needs to be checked by the
write_RMW_virtual variants anyways and thus needs to be
cached anyways.

Mostly the mods where to access.cc, but I did also macro-ize
the calls to write_RMW_virtual...() in files which use it
and cpu.h.  Right now, the macro is just a straight pass-through.
I tried expanding it to a quick initial check for the pointer
availability to do the write in-place, with a function call
as a fall-back.  That didn't seemed to matter at all.

Booting is not helped by this really.  The upper bound of
the gain is 5 or 6%, and that's only if you have a loop that
looks like:

label:
  add [eax], ebx   ;; mega read-modify-write instruction
  jmp label        ;; intensive loop.
2002-09-06 21:54:58 +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
f0d1e765b5 - there were two calls to wxMutexGuiLeave()...bad! 2002-09-06 16:59:54 +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
Bryce Denney
c1f363c7b5 - not using the config button in wxwindows 2002-09-06 15:00:54 +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
70d0a6b844 - now that wxmain.h class definition includes a few dialogs from wxdialog.h,
wxdialog must come first.
2002-09-06 14:40:22 +00:00
Bryce Denney
47d7669685 - remove a huge chunk of obsolete code 2002-09-06 04:43:03 +00:00
Bryce Denney
781b06e791 - remove obsolete testing code 2002-09-06 04:41:39 +00:00
Bryce Denney
85b3dfe60f - fix minor problems with static member function declarations:
- bx_gen_reg cannot be declared with BX_SMF or it can't read gen_reg
    when static member functions are turned on.
  - use "BX_CPU_C_PREFIX" instead of "BX_CPU_C::" for get_segment_base.
- the SMF (static member function) tricks are just plain wierd. The only way to
  really be sure that you're not breaking something is to try compiling it with
  SMF on and with SMF off.  e.g. "configure && make" and
  "configure --enable-processors=2 && make".
2002-09-05 20:16:40 +00:00
Volker Ruppert
b978b19405 - adding strdup() fixes the 'const' problem with gcc 2.95.3 2002-09-05 20:16:19 +00:00
Bryce Denney
9a045c7340 - since wxWindows+debugger+readline is a combination that currently doesn't
work (control-C kills process instead of returning to debugger prompt), give
  a configure-time error if they are enabled together.  If we can fix the
  signal problem in readline, this check can be removed.
2002-09-05 19:59:20 +00:00
Stanislav Shwartsman
2d2651a0f3 Added some useful debug/information methods for BX_CPU class 2002-09-05 19:46:20 +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
Stanislav Shwartsman
611d983900 Added get_REGISTER functions for all registers 2002-09-05 19:12:02 +00:00
Bryce Denney
e41cfeb329 - put "log filename" onto the LogOptions dialog instead of EditOther
- remove config button from toolbar for wxWindows, since that's what all
  the menus are for!
2002-09-05 17:27:50 +00:00
Bryce Denney
27b57724a6 - fix unused variable warning 2002-09-05 16:50:03 +00:00
Bryce Denney
7a2bb1f5a6 - force wxWindows to put all log messages to stderr. (Sometimes it is
tempted to bring up dialog boxes to display the debug messages.)
2002-09-05 16:41:54 +00:00
Bryce Denney
4a559e26d9 - skip over some fprintfs to stderr when using wxWindows 2002-09-05 16:40:18 +00:00
Bryce Denney
fce114ed19 - eliminate printfs in wxwindows code--use wxLogDebug instead 2002-09-05 16:27:06 +00:00
Bryce Denney
53d71821c1 - I already checked in something better than this 2002-09-05 16:02:43 +00:00
Bryce Denney
7cef3cc3a4 - clean up memory usage after bx_gui_c::get_clipboard_text for win32,
X windows, wxWindows.  Each platform has its own way of returning
  a variable length string, and its own rules about how you're supposed
  to dispose of the string.  Now all platforms do the same thing: they
  allocate a Bit8u buffer with C++ "new" and copy the clipboard data in,
  then release the clipboard data in the platform-specific correct way.
  The Bit8u buffer is sent to the keyboard code, which frees it with
  delete [] when finished.
- modified: gui/wxmain.cc gui/wxmain.h
2002-09-05 16:01:34 +00:00
Bryce Denney
eb12552eef - in the panic dialog box, change the "Die" button to "Kill Sim".
It wasn't clear if die meant to kill the simulation or the whole app.
2002-09-05 15:58:39 +00:00
Bryce Denney
17624e7549 - clean up memory usage after bx_gui_c::get_clipboard_text for win32,
X windows, wxWindows.  Each platform has its own way of returning
  a variable length string, and its own rules about how you're supposed
  to dispose of the string.  Now all platforms do the same thing: they
  allocate a Bit8u buffer with C++ "new" and copy the clipboard data in,
  then release the clipboard data in the platform-specific correct way.
  The Bit8u buffer is sent to the keyboard code, which frees it with
  delete [] when finished.
- modified: gui/wx.cc gui/x.cc gui/win32.cc iodev/keyboard.cc
2002-09-05 15:57:37 +00:00
Bryce Denney
5feb140d70 - restore signal handling to default when bochs thread dies 2002-09-05 15:51:03 +00:00
Bryce Denney
2c9fcbb147 - somehow I lost one important line in my last checkin that defines WX_CONFIG 2002-09-05 15:49:48 +00:00
Bryce Denney
ce2f799033 - fix bug in key mapping. I typed BX_KEY_MINUS for two different keys. 2002-09-05 15:13:34 +00:00
Bryce Denney
892eaab88c - in wxwindows compile, only include the wxwindows cflags on the few
files that need them.  This is more in line with the other gui libraries,
  and the compile line is easier to read.
- modified: Makefile.in configure.in configure gui/Makefile.in
2002-09-05 15:12:13 +00:00
Bryce Denney
28801ce9ff - implement clipboard functions for wxWindows
- enable keymapping for wxWindows, by inserting bx_keymap.loadKeymap(NULL)
  call in wx.cc
2002-09-05 13:38:44 +00:00
Christophe Bothamy
1fb02cacf1 - updated with rombios-new-ata.c rev 1.4 :
- fixed stupid "#if #elif" bug in ata paramaters
  - added debug/screen message if device detection fails.
2002-09-05 08:20:06 +00:00
Christophe Bothamy
e6f8c1ba46 - fixed stupid "#if #elif" bug in ata paramaters
- added debug/screen message if device detection fails.
2002-09-05 08:18:30 +00:00
Bryce Denney
b9bfa8ed7f - fix signal handling in wxWindows. The problem was that a signal gets
delivered to both the GUI and simulator thread, so they both call
  bx_signal_handler.  This can lead to deadlock as multiple threads enter
  BX_PANIC and try to show a dialog box at once.  To solve the problem, I made
  a function isSimThread() which can be called from anywhere.  If the
  bx_signal_handler is called from any thread OTHER THAN the simulation thread,
  it returns without doing anything.  As a result, only one thread is allowed
  to enter the signal handler code, and now control-C works correctly.
2002-09-05 07:48:39 +00:00
Bryce Denney
b79630a14e - Volker introduced the -q command line switch in August 2002, which tells
Bochs to immediately read the bochsrc and start simulating immediately (as
  opposed to going into the configuration interface first).  Now -q does
  the right thing in the wxWindows interface.  It behaves as if you selected
  Read Configuration and then Simulate:Start.
- modified: main.cc gui/siminterface.cc gui/siminterface.h gui/wxmain.cc
2002-09-05 07:01:30 +00:00
Bryce Denney
578cc09f55 - keypad5 is apparantly called GDK_KP_Begin on my keyboard 2002-09-05 06:08:47 +00:00
Kevin Lawton
f29f9ef021 Fixed Big-endian case of --enable-guest2host-tlb. I macro'ized the
direct reads/writes from native variables to the x86 (guest)
memory image.  Look at the end of bochs.h.  Don't know if that's
the right place to put them, but here you can extend these
macros to platform-specific asm() code if you like, or just
use the generic C code I supplied.  Some platforms have special
instructions for byte-order swapping etc.  Also, you can't
make any assumptions about the alignment of the pointers
passed.
2002-09-05 04:56:11 +00:00
Kevin Lawton
83eb7d4199 Updated comments with info on the new TLB permissions storage
and strategy, so that others can understand it.
2002-09-05 03:09:59 +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