This change allows to build Windows binaries without dependencies on
toolchain-specific libraries (like `libc++.dll`).
It allows to perform version updates by copying of single `bochs.exe`,
without the need for searching and distribution of linked DLLs.
---------
Co-authored-by: Volker Ruppert <Volker.Ruppert@t-online.de>
by Michele Giacomone
Detailed description:
-Observed issues
Due to some limitations only dates between 1980 and 2038 can be
used in a reliable way.
Also, bochs incorrectly assumes a linear correspondence between
the data returned by the <time.h> functions localtime() and
mktime(), and isn't setting the latter properly.
Bochs keeps its internal time value dependent to these functions
after setup, assuming that their internal settings won't change
on the go - which is not the case.
In my OS, and in my timezone, this leads to incorrect startup values
for 5 months each year and unreliable values if the simulation is
kept going for a long time. (a feedback between localtime() and
mktime() is created which keeps shifting back the time)
Also, the RTC simulation is not realistic since the clock fixes
itself across DST changes, without updating any DST related flag,
a behavior that no guest OS expects.
-Proposed fix
This is implemented in such way that no bochs' previous behavior
is changed, a part from the broken ones, with legacy in mind
== the user can keep using bochs exactly as before knowing nothing
of this patch
+Make the internal s.timeval variable a Bit64s, so it can fit all
values that the cmos can correctly represent, reported below:
MIN setting -62167219200 => 0000/01/01 SAT 0:00:00
MAX BCD setting 253402300799 => 9999/12/31 FRI 23:59:59
MAX BIN setting 745690751999 => 25599/12/31 FRI 23:59:59
And then fix each reference to these so it can handle such values
And make bochs correctly wrap around for under/overflows, so that
only the most significant bits of the century are lost.
+Do the same thing to the bochs time0 parameter, so all the above
values can be chosen at startup (despite being now legal values,
1 and 2 will still be treated as "local" and "utc"). Note that
normally only BCD settings are valid since bochs' CMOS defaults
to such operating mode - the only way to use the binary range
is by loading a cmos memory map.
+Make the internal s.timeval variable independent from external
factors. This means providing a small set of time handling
functions, contained in "iodev/utctime.h", which must work in
any environment in which bochs compiles, accessing no external
resource. This also means that after startup, s.timeval will only
be changed internally, and no call to the OS time functions will
be made.
+Make the internal s.timeval variable timezone independent, to
have a linear correlation between its values and valid CMOS
settings. To make it easier, s.timeval is gonna be treated as
if the current timezone was UTC: so,
- if the user selects UTC as time0, s.timeval will become current
time(NULL)
- if the user selects localtime, s.timeval will be computed as
the value which will display the same broken down time as
localtime(&now)
- if the user inputs a time formatted string the proper s.timeval
to displayed will be easily calculated,
- if the user inputs a starting time value, s.timeval will be
computed as the value which will display the same broken down
time as localtime(&user_input) to ensure the same operation as
before.
A "tz=utc" is displayed when bochs prints out the current time
value, to warn users about the difference in meaning between the
internally kept time value and the value they can set through
the "time0=" parameter. This might be changed to communicate
instead the time value they can input to get the same setting,
but performing such calculation (except for the startup time)
suffers from all the mktime()/localtime() problems listed above
so I did not do it.
The range of "time0" is automatically adjusted so all users in
all time zones can set any legal value despite "time0=" having a
local meaning.
A thorough explanation of what I did and why can be found in the
"iodev/utctime.h" library header.
---------
Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
Co-authored-by: Volker Ruppert <Volker.Ruppert@t-online.de>
First step into implementing UINTR - User Level Interrupts ISA extension
To be continued
---------
Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
C99 removed implicit function declarations from the language. All
functions must be declared before they can be called. There are a
few places in the configure script where the exit function is called
without including <stdlib.h>. Instead, return from the main
function, avoiding the exit declaration issue.
It has been compiled and tested on Linux, with MinGW/MSYS and MSVC nmake.
TODO: Check whether or not the config interface choice "win32config" can be
a plugin, too. Possibly add a new plugin type for config interfaces.
- In case of cross compiling of the win32 gui, use the environment variable
WINDRES for the name of the resource compiler.
- Added example shortcut script for cross compiling on Linux for Windows.
- Renamed vpc-img.* files to vpc.* and removed hack for image mode name conversion.
- Added suffix "_img" to all disk image mode plugin base names. This is important
for the future implementation of a plugin enumeration at Bochs startup.
- Common hdimage code, lowlevel cdrom code and the classes for the Bochs "own"
image modes (e.g. flat, sparse, growing") are now a part of the Bochs core.
- All classes for image modes present in separate files are now built as
plugins with the same self register mechanism as network, sound and usb
modules. Defined new plugin type PLUGTYPE_HDIMAGE.
- Temporarily disabled the base image format detection of the undoable/volatile
modes for the "external" modes in the plugins case.
- TODO: Bochs should know about all of the available plugins and their
capabilities right after startup, but before the configuration stage.
The latest release is from 2001 and it will not work on modern Linux systems.
Parts of the SVGALib code have been moved to the Linux kernel and the X11 and
SDL libraries are using it as a video driver.
The ethertap driver has been declared obsolete a long time ago and it has been
removed in Linux kernel version 3.x. The successor service TUN/TAP is supported
by Bochs. The source file and the BX_NETMOD_TAP symbol appearance may be removed
before next release.
- Added case for "*-msys" to the existing "*.mingw*" cases.
- Fixed $JADE value in case the program is not installed.
- Fixed RedirectIOToConsole() function for MSYS with 64-bit gcc 9.2.
- The pthread library is not needed at all by the Windows ports.
- Link the ALSA and SDL sound modules only with required library.
- Fixed curses cross-compilation issue found by Debian.
- slirp/cksum.cc: NOTE for Debian.
- Get rid of VER_STRING since it's the same as VERSION
- Add new defines VER_MAJOR, VER_MINOR, VER_PATCH and VER_SVN and use them for
the version number on Windows.
- TODO: Add the capability to detect installed version to the Windows installer.