Binutils with MCST patches
Go to file
Mike Frysinger 891e7fb179 sim: change to 64bit time keeping to avoid 32bit overflows
The sim-events code jumps through some hoops to avoid using 64bit math
to manage the current time.  One fundamental assumption here is that by
constantly scheduling the sim poll event a short time into the future,
the 64bit difference will always fall into a signed 32bit value.  This
does work most of the time, except for when processing the sim poll event
itself.

Normally, sim_events_process() will dequeue the sim poll event, update
the current time (time_from_event) according to the next pending event,
process the sim poll event (which will then requeue the sim poll event),
and then continue on.

The problem here of course is that the current time is updated in that
small window before the sim poll event gets a chance to reschedule itself.
So if the 64bit difference between the current time and the next event
does not fit into the signed 32bit value, time_from_event overflows, and
the internal assert at the end of update_time_from_event() triggers.

Since attempts at tweaking sim_events_process() logic introduced other
subtle bugs (due to tangled assumptions between most pieces of the sim
time keeping code), change the time_from_event to a real 64bit value.
Tests on my system between a 32bit ELF and a 64bit ELF show no practical
difference (it's all lost in the system noise).  Basically, I booted a
Linux kernel to userspace and then paniced it; this gave me a constant
sample size of about 18 million insns.

This was noticed when simulating Blackfin Das U-Boot.  The simulated core
timer is given the max unsigned timeout value possible on a 32bit processor
(0xffffffff).  This timeout value is used directly to schedule a hw event
in the sim future (the IRQ firing).  Once the sim poll event is kicked off,
the next pending event is the core timer event which is more than 2^31
ticks in the future, and the sim aborts with:
sim-events.c:435: assertion failed - current_time == sim_events_time (sd)

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-14 04:58:12 +00:00
bfd daily update 2011-02-13 23:00:04 +00:00
binutils Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 21:00:14 +00:00
config Sync toplevel and config/ from GCC. 2011-02-12 14:40:09 +00:00
cpu Fix build with -DDEBUG=7 2010-10-08 14:00:50 +00:00
elfcpp
etc PR other/46202: implement install-strip. 2010-11-20 19:37:58 +00:00
gas Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 21:00:14 +00:00
gdb *** empty log message *** 2011-02-14 00:00:02 +00:00
gold 2011-02-11 Sriraman Tallam <tmsriram@google.com> 2011-02-12 03:19:24 +00:00
gprof Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 21:00:14 +00:00
include gas/opcodes: blackfin: move dsp mac func defines to common header 2011-02-12 19:36:31 +00:00
intl
ld Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 21:00:14 +00:00
libdecnumber merge from gcc 2011-01-03 21:05:58 +00:00
libiberty libiberty: documentation markup and order fixes. 2011-02-03 07:23:59 +00:00
opcodes Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 21:00:14 +00:00
readline
sim sim: change to 64bit time keeping to avoid 32bit overflows 2011-02-14 04:58:12 +00:00
texinfo
.cvsignore
.gitignore start a gitignore 2010-11-17 19:34:59 +00:00
ChangeLog Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 21:00:14 +00:00
compile
config-ml.in Merge from gcc top-level. 2010-11-19 22:06:27 +00:00
config.guess
config.rpath Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 21:00:14 +00:00
config.sub
configure Sync toplevel and config/ from GCC. 2011-02-12 14:40:09 +00:00
configure.ac Sync toplevel and config/ from GCC. 2011-02-12 14:40:09 +00:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS 2010-12-18 Jeff Johnston <jjohnstn@redhat.com> 2010-12-17 22:10:05 +00:00
COPYING.NEWLIB 2010-12-02 Jeff Johnston <jjohnstn@redhat.com> 2010-12-02 20:05:11 +00:00
depcomp
djunpack.bat
install-sh
libtool.m4 Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 21:00:14 +00:00
lt~obsolete.m4
ltgcc.m4
ltmain.sh Backport from Libtool: Fix relink mode to use absolute path if hardcode_minus_L. 2011-01-13 18:52:53 +00:00
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS Import move-if-change script from gnulib. 2011-02-12 15:47:02 +00:00
Makefile.def Sync toplevel and config/ from GCC. 2011-02-12 14:40:09 +00:00
Makefile.in Sync toplevel and config/ from GCC. 2011-02-12 14:40:09 +00:00
Makefile.tpl Sync toplevel and config/ from GCC. 2011-02-12 14:40:09 +00:00
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change Import move-if-change script from gnulib. 2011-02-12 15:47:02 +00:00
README
README-maintainer-mode
setup.com
src-release 2010-12-10 Tristan Gingold <gingold@adacore.com> 2010-12-10 09:10:49 +00:00
symlink-tree
ylwrap

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.