aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2011-03-15sim: bfin: skip acc/ASTAT updates for movesMike Frysinger2-6/+10
No point in moving unchanged acc values to the acc regs, and avoid updating the acc ASTAT bits when only reading. This fixes incorrect changing of the ASTAT bits when they're only being read. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-15sim: bfin: handle AN (negative overflows) in dsp mult insnsMike Frysinger2-8/+40
The current dsp mult handler does not take care of overflows which turn values negative (and thus set AN in ASTAT). So implement it. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-15sim: bfin: handle V overflows in dsp mult insnsMike Frysinger2-7/+15
The current dsp mult handler does not take care of overflows and updating the V ASTAT bit. So implement it. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-15sim: bfin: decode ASTAT on failureMike Frysinger2-34/+79
When testing ASTAT regs, specific bit differences carry a lot more meaning than when checking the value of a data register. So automatically decode the bits of the two values and print things out so that people don't have to manually do it themselves every time. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-15sim: bfin: handle saturation with fract multiplicationsMike Frysinger2-0/+6
The saturation behavior with fract modes differs from non-fract modes. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-15sim: common: trim trailing whitespaceMike Frysinger42-292/+300
2011-03-14sim: bfin: forgot to cvs add the changelogMike Frysinger1-0/+29
2011-03-06sim: bfin: new portMike Frysinger108-0/+30271
This can boot Das U-Boot and a Linux kernel. It also supports Linux userspace FLAT and FDPIC (dynamic and static) ELFs. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-25 * callback.c (fdbad): Return EBADF rather than EINVAL for badKevin Buettner2-1/+6
file descriptors.
2011-02-14sim: punt zfree()Mike Frysinger46-125/+185
The sim keeps track of which allocations are zero-ed internally (via zalloc) and then calls a helper "zfree" function rather than "free". But this "zfree" function simply calls "free" itself. Since I can see no point in this and it is simply useless overhead, punt it. The only real change is in hw-alloc.c where we remove the zalloc_p tracking, and sim-utils.c where zfree is delete. The rest of the changes are a simple `sed` from "zfree" to "free". Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-14sim: change to 64bit time keeping to avoid 32bit overflowsMike Frysinger2-1/+5
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-01-12sim: enable hw_tree_delete in sim_hw_uninstallMike Frysinger2-1/+5
I can't find any history for why the call to hw_tree_delete is commented out, and the VCS history shows that this goes back to the original import in 2009. I did find some vague reference to it from 2000 (pretty close to the original import of code), but no actual details. Without this call, every new instance of the sim results in all old previously allocated resources being leaked. With some devices, this isn't just memory, it's things like open file descriptors or mmaps. So if there are pending issues with this, I'd rather we get the sims sorted out rather than continuing to leak this stuff. Especially since the "let's wait for the sims to fix themselves" hasn't actually happened in the last 10+ years. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-12sim: check asprintf return valuesMike Frysinger5-6/+29
These are the last sources of build warnings (asprintf usage) that I see. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-11sim: allow memory maps to default to mapped filesMike Frysinger2-10/+38
I find it annoying when using --memory-mapfile that I also need to look up and manually specify the file size to the following --memory-region option. So make a length of 0 in the following --memory-region trigger an auto-sizing of the map to the length of the file being mapped. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-11http://sourceware.org/ml/gdb-patches/2010-11/msg00112.htmlAndrew Burgess14-10/+45
gdb/ChangeLog * remote-sim.c (gdbsim_store_register): Update API to sim_store_register to check more error conditions. include/gdb/ChangeLog * remote-sim.h (sim_store_register): Update the API documentation for this function. sim/erc32/ChangeLog sim/h8300/ChangeLog sim/m32c/ChangeLog sim/mn10300/ChangeLog sim/ppc/ChangeLog sim/rx/ChangeLog sim/v850/ChangeLog * ???.c (sim_store_register): Update return value to match new API.
2011-01-10sim: fix handling of 2nd arg to SIM_AC_OPTION_HARDWAREMike Frysinger2-3/+9
The 2nd arg to SIM_AC_OPTION_HARDWARE is described as "a space separated list of devices that override the defaults" while the 3rd arg is "a space separated list of extra target specific devices". But the macro doesn't seem to treat the 2nd arg this way. Instead, it will always add the default list of devices, and only add the extra target specific devices if the 2nd arg is not specified. So rework the logic slightly to handle the 2nd arg as documented. This shouldn't affect any targets in the tree as no one passes in a non- empty value as the 2nd arg. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-10sim: add noreturn markings to more hw abort/halt funcsMike Frysinger3-4/+9
These functions either call abort() themselves, or call functions which are already marked noreturn. Either way, they don't return, so mark them as such so calling code can assume this. This fixes some uninitialized warnings due to code paths that end in an abort function. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-05 * testutils.inc: Correct comment syntax fallout fromHans-Peter Nilsson5-8/+12
copyright update. * utils-dsp.inc, utils-fpu.inc, utils-mdmx.inc: Ditto.
2011-01-05 * mips32-dsp.s: Update copyright year.Hans-Peter Nilsson2-1/+5
2011-01-05sim: ignore generated hw-config.hMike Frysinger2-0/+5
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-05sim: tweak load buffer type to avoid signed warningsMike Frysinger2-1/+5
The sim_load_file func creates a buffer with arbitrary data in it (reads it via the bfd). It then passes it on to a sim_write_fn which expects a unsigned char buffer. Since sim_load_file itself doesn't care about the contents, tweak the type to avoid signed mismatch warnings from gcc: common/sim-load.c: In function ‘sim_load_file’: common/sim-load.c:143: warning: pointer targets in passing argument 3 of ‘do_write’ differ in signedness common/sim-load.c:143: note: expected ‘const unsigned char *’ but argument is of type ‘char *’ Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-05Copyright year update in sim/ppc/psim.texinfoJoel Brobecker2-2/+6
sim/ppc/ChangeLog: * psim.texinfo: Copyright year update.
2011-01-05Update the copyright year for most remaining files in GDBJoel Brobecker2-1/+5
2011-01-01run copyright.sh for 2011.Joel Brobecker343-350/+464
2010-12-29sim: HW_NALLOC: new alloc helperMike Frysinger2-0/+5
We have malloc (uninitialized buffer), zalloc (zeroed buffer), and nzalloc (zeroed array). But we don't have a way to allocate an uninitialized array. Add a HW_NALLOC to fill this gap. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-12-29sim: HW_NZALLOC: fix arg handlingMike Frysinger2-1/+5
The HW_NZALLOC macro has all caps args for some reason (unlike the other alloc helpers), and ends up not using the "ME" argument since its copy and paste source uses "me". Make all the args lowercase to match the style of all the other args and make it use the correct "me". Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-12-23sim: start a gitignoreMike Frysinger2-0/+11
2010-12-15sim: add --map-info optionMike Frysinger2-1/+50
There are options for listing the current device/hw tree and memory regions, but no way to find out at run time all the current mappings. So add a new --map-info option akin to the --memory-info option which displays all the current mappings. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-12-14(decode_opcode): RXO_branchrel is relative to the opcode's PC, notDJ Delorie2-2/+4
the address following the opcode.
2010-12-14* rx.c (decode_opcode): For "MVFC PC,", use the address of theDJ Delorie2-0/+13
opcode, not the address following the opcode.
2010-12-04* Makefile.in: Use CC_FOR_BUILD to build opc2c.Masaki Muranaka2-3/+12
2010-11-23sim: profile: fix building with --disable-sim-profileMike Frysinger2-0/+16
When the sim is configured with profile support disabled, the build fails: ./../common/sim-profile.c: In function 'profile_option_handler': ./../common/sim-profile.c:337:6: warning: implicit declaration of function 'PROFILE_PC_FREQ' ./../common/sim-profile.c:337:6: error: lvalue required as left operand of assignment ./../common/sim-profile.c:351:6: warning: implicit declaration of function 'PROFILE_PC_NR_BUCKETS' ./../common/sim-profile.c:351:6: error: lvalue required as left operand of assignment ./../common/sim-profile.c:381:6: warning: implicit declaration of function 'PROFILE_PC_SHIFT' ./../common/sim-profile.c:381:6: error: lvalue required as left operand of assignment ./../common/sim-profile.c:405:8: warning: implicit declaration of function 'PROFILE_PC_START' ./../common/sim-profile.c:405:8: error: lvalue required as left operand of assignment ./../common/sim-profile.c:406:8: warning: implicit declaration of function 'PROFILE_PC_END' ./../common/sim-profile.c:406:8: error: lvalue required as left operand of assignment ./../common/sim-profile.c: In function 'profile_uninstall': ./../common/sim-profile.c:1299:7: warning: implicit declaration of function 'PROFILE_INSN_COUNT' ./../common/sim-profile.c:1299:37: warning: comparison between pointer and integer ./../common/sim-profile.c:1300:2: warning: passing argument 1 of 'zfree' makes pointer from integer without a cast ../common/sim-utils.h:30:6: note: expected 'void *' but argument is of type 'int' make[2]: *** [sim-profile.o] Error 1 So add some stubs similar to how some of the other subsystems are stubbed out so things build correctly. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-23sim: cast away hw/device differencesMike Frysinger2-0/+8
When building with device and hw support, the sim-core code generates a lot of build time warnings such as: ./../common/sim-core.c: In function 'sim_core_map_attach': ./../common/sim-core.c:198:7: warning: passing argument 1 of 'device_error' from incompatible pointer type ../common/sim-core.h:347:6: note: expected 'struct device *' but argument is of type 'struct hw *' ./../common/sim-core.c:235:7: warning: passing argument 1 of 'device_error' from incompatible pointer type ../common/sim-core.h:347:6: note: expected 'struct device *' but argument is of type 'struct hw *' In reality, these two structures get cast back and forth in the core code already and so are "compatible". So tweak the three functions that generate all of these warnings to include the casts automatically. I know this isn't exactly clean, but the current device/hw ifdef approach is full of landmines itself and I'm not entirely sure how to unscrew it. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-16sim: dv-sockser: add a write buffer variantMike Frysinger3-4/+18
Rather than having to bang out chunks of data one byte at a time over the socket interface, add a write variant that accepts an arbitrarily long buffer. This speeds things up considerably when we have many chars to send out at once. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-12* rx.c (lsb_count): New.DJ Delorie2-7/+94
(divu_cycles): New. (div_cycles): New. (decode_opcode): Fix cycle count math for div, divu, suntil, and swhile.
2010-10-09Regenerate for bool -> bool_ changeAlan Modra4-59/+67
2010-10-06 * callback.c (os_lseek): Call wrap on lseek result.Hans-Peter Nilsson2-1/+5
2010-10-06 * traps.c (cris_break_13_handler): Pass lseekHans-Peter Nilsson2-0/+13
offset parameter as sign-extended.
2010-10-06 * sim/cris/c/seek3.c, sim/cris/c/seek4.c: New tests.Hans-Peter Nilsson3-0/+97
2010-09-30 * mem.c (rx_mem_ptr): When invalidating the decode cache, accountKevin Buettner2-3/+15
for the fact that the instruction decoder never uses swapped addresses.
2010-09-29 * rx.c (decode_opcode: RXO_int): Only break out of the emulationNick Clifton2-1/+8
loop if rx_syscall() does not return a RX_STEPPED result.
2010-09-24 * rx.c (decode_opcode): Add cycle information for RXO_smovu.Kevin Buettner2-0/+8
2010-09-24Fix typo in ChangeLog entry.Kevin Buettner1-1/+1
2010-09-23 * cpu.h (reset_decoder): Declare.Kevin Buettner4-0/+15
* load.c (rx_load): Call `reset_decoder'. * rx.c (reset_decoder): New function.
2010-09-23 * rx.c (decode_opcode): Declare `rx' as unsigned.Kevin Buettner2-1/+3
2010-09-23 * fpu.c, gdb-if.c, load.c, misc.c, syscalls.c (config.h): Include.Kevin Buettner6-0/+9
2010-08-24 * sim/cris/asm/nonvcv32.ms: Neutralize changed &&-in-macro gas syntax.Hans-Peter Nilsson2-4/+8
2010-07-29[include/opcode]DJ Delorie7-204/+240
* rx.h (RX_Operand_Type): Add TwoReg. (RX_Opcode_ID): Remove ediv and ediv2. [opcodes] * rx-decode.opc (SRR): New. (rx_decode_opcode): Use it for movbi and movbir. Decode NOP2 (mov r0,r0) and NOP3 (max r0,r0) special cases. * rx-decode.c: Regenerate. [sim/rx] * rx.c (decode_cache_base): New. (id_names): Remove ediv and edivu. (optype_names): Add TwoReg. (maybe_get_mem_page): New. (rx_get_byte): Call it. (get_op): Add TwoReg support. (put_op): Likewise. (PD, PS, PS2, GD, GS, GS2, DSZ, SSZ, S2SZ, US1, US2, OM): "opcode" is a pointer now. (DO_RETURN): New. We use longjmp to return an exception result. (decode_opcode): Make opcode a pointer to the decode cache. Save decoded opcode information and re-use. Call DO_RETURN instead of return throughout. Remove ediv and edivu. * mem.c (ptdc): New. Adds decode cache. (rx_mem_ptr): Support it. (rx_mem_decode_cache): New. * mem.h (enum mem_ptr_action): add MPA_DECODE_CACHE. (rx_mem_decode_cache): Declare. * gdb-if.c (sim_resume): Add decode_opcode's setjmp logic here... * main.c (main): ...and here. Use a fast loop if neither trace nor disassemble is given. * cpu.h (RX_MAKE_STEPPED, RX_MAKE_HIT_BREAK, RX_MAKE_EXITED, RX_MAKE_STOPPED, RX_EXITED, RX_STOPPED): Adjust so that 0 is not a valid code for anything.
2010-07-28Sort *alphabetically* this timeDJ Delorie1-1/+1
2010-07-28[sim/rx]DJ Delorie12-748/+2359
* README.txt: New. * config.h (CYCLE_ACCURATE, CYCLE_STATS): New. * configure.in (--enable-cycle-accurate, --enable-cycle-stats): New. Default to enabled. * configure: Regenerate. * cpu.h (regs_type): Add cycle tracking info. (reset_pipeline_stats): Declare. (halt_pipeline_stats): Declare. (pipeline_stats): Declare. * main.c (done): Call pipeline_stats(). * mem.h (rx_mem_ptr): Moved to here ... * mem.c (mem_ptr): ... from here. Rename throughout. (mem_put_byte): Move LEDs to Port A. Add Port B to control cycle statistics. Move UART to SCI4. (mem_put_hi): Add TPU 1-2. TPU 1 and 2 count CPU cycles. * reg.c (init_regs): Set Rt reg to -1 (no reg). * rx.c: Add cycle counting and statistics throughout. (rx_get_byte): Optimize for speed. (decode_opcode): Likewise. (reset_pipeline_stats): New. (halt_pipeline_stats): New. (pipeline_stats): New. * trace.c (sim_disasm_one): Print cycle count. [include/opcode] * rx.h (RX_Opcode_ID): Add nop2 and nop3 for statistics.