[Qemu-devel] qemu cpu-exec.c vl.h hw/openpic.c hw/ppc.c hw/p...
CVSROOT:/sources/qemu Module name:qemu Changes by: Jocelyn Mayer j_mayer 07/03/30 09:38:04 Modified files: . : cpu-exec.c vl.h hw : openpic.c ppc.c ppc_chrp.c ppc_prep.c target-ppc : cpu.h helper.c Log message: New model for PowerPC CPU hardware interrupt events: move all PowerPC specific code into target-ppc/helper.c to avoid polluting the common code in cpu-exec.c. This makes implementation of new features (ie embedded PowerPC timers, critical interrupts, ...) easier. This also avoid hardcoding the IRQ callback in the OpenPIC controller, making it more easily reusable and allowing cascading. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/cpu-exec.c?cvsroot=qemur1=1.95r2=1.96 http://cvs.savannah.gnu.org/viewcvs/qemu/vl.h?cvsroot=qemur1=1.196r2=1.197 http://cvs.savannah.gnu.org/viewcvs/qemu/hw/openpic.c?cvsroot=qemur1=1.9r2=1.10 http://cvs.savannah.gnu.org/viewcvs/qemu/hw/ppc.c?cvsroot=qemur1=1.11r2=1.12 http://cvs.savannah.gnu.org/viewcvs/qemu/hw/ppc_chrp.c?cvsroot=qemur1=1.28r2=1.29 http://cvs.savannah.gnu.org/viewcvs/qemu/hw/ppc_prep.c?cvsroot=qemur1=1.31r2=1.32 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/cpu.h?cvsroot=qemur1=1.32r2=1.33 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/helper.c?cvsroot=qemur1=1.35r2=1.36
[Qemu-devel] qemu/target-ppc cpu.h translate_init.c
CVSROOT:/sources/qemu Module name:qemu Changes by: Jocelyn Mayer j_mayer 07/03/30 10:07:33 Modified files: target-ppc : cpu.h translate_init.c Log message: Fix / update PowerPC BookE definitions. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/cpu.h?cvsroot=qemur1=1.33r2=1.34 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/translate_init.c?cvsroot=qemur1=1.7r2=1.8
[Qemu-devel] qemu/target-ppc op.c op_helper.c op_helper.h tr...
CVSROOT:/sources/qemu Module name:qemu Changes by: Jocelyn Mayer j_mayer 07/03/30 10:22:46 Modified files: target-ppc : op.c op_helper.c op_helper.h translate.c Log message: Fix rfi instruction: do not depend on current execution mode but on the execution mode that will be effective after the return. Add rfci, rfdi and rfmci for BookE PowerPC. Extend mfdcr / mtdcr and implement mfdrcx / mtdcrx. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op.c?cvsroot=qemur1=1.30r2=1.31 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_helper.c?cvsroot=qemur1=1.23r2=1.24 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_helper.h?cvsroot=qemur1=1.7r2=1.8 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/translate.c?cvsroot=qemur1=1.52r2=1.53
Re: [Qemu-devel] Re: PC traces from QEMU
On Thu, Mar 29, 2007 at 06:28:14PM -0700, Shashidhar Mysore wrote: Hi Stuart, Thanks for the reply, but since I'm a little new to qemu, can you please elaborate on how to insert the op_dump_pc function to extract the PC values? Well, here's a patch that does it: Index: target-i386/exec.h === RCS file: /sources/qemu/qemu/target-i386/exec.h,v retrieving revision 1.31 diff -u -r1.31 exec.h --- target-i386/exec.h 24 Sep 2006 18:40:46 - 1.31 +++ target-i386/exec.h 30 Mar 2007 11:02:08 - @@ -146,6 +146,8 @@ extern CCTable cc_table[]; +void helper_dump_pc(target_ulong PC); + void load_seg(int seg_reg, int selector); void helper_ljmp_protected_T0_T1(int next_eip); void helper_lcall_real_T0_T1(int shift, int next_eip); Index: target-i386/helper.c === RCS file: /sources/qemu/qemu/target-i386/helper.c,v retrieving revision 1.74 diff -u -r1.74 helper.c --- target-i386/helper.c1 Feb 2007 22:12:19 - 1.74 +++ target-i386/helper.c30 Mar 2007 11:02:09 - @@ -30,6 +30,16 @@ } while (0) #endif +void helper_dump_pc(target_ulong pc) +{ +if (logfile) +#ifdef TARGET_X86_64 +fprintf(logfile, PC = %016 PRIx64 \n, pc); +#else +fprintf(logfile, PC = %08x\n, pc); +#endif +} + const uint8_t parity_table[256] = { CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0, 0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P, Index: target-i386/op.c === RCS file: /sources/qemu/qemu/target-i386/op.c,v retrieving revision 1.47 diff -u -r1.47 op.c --- target-i386/op.c1 Feb 2007 22:11:07 - 1.47 +++ target-i386/op.c30 Mar 2007 11:02:09 - @@ -132,6 +132,11 @@ #endif +void OPPROTO op_dump_pc(void) +{ +helper_dump_pc(PARAM1); +} + /* operations with flags */ /* update flags with T0 and T1 (add/sub case) */ Index: target-i386/translate.c === RCS file: /sources/qemu/qemu/target-i386/translate.c,v retrieving revision 1.62 diff -u -r1.62 translate.c --- target-i386/translate.c 16 Jan 2007 19:28:58 - 1.62 +++ target-i386/translate.c 30 Mar 2007 11:02:10 - @@ -3155,6 +3155,7 @@ int rex_w, rex_r; s-pc = pc_start; +gen_op_dump_pc(s-pc); prefixes = 0; aflag = s-code32; dflag = s-code32; It's probably not the best way to do this, but it worked well enough for my purposes. (target-z80 -- where there is only one address space! :-) -- Stuart Brady
[Qemu-devel] Bugs found
3 more bugs that need attention... a) serious: Image files, even those created by the version of qemu-img.exe that comes with QEMU 0.90, are unreadable by QEMU 0.90, QEMU 0.82 works fine with them. b) less serious: Out of environment space error when starting. c) serious: audio: Failed to create voice 'es1370.adc error when starting.
Re: [Qemu-devel] Bugs found
On 3/30/07, James Jacobs [EMAIL PROTECTED] wrote: 3 more bugs that need attention... a) serious: Image files, even those created by the version of qemu-img.exe that comes with QEMU 0.90, are unreadable by QEMU 0.90, QEMU 0.82 works fine with them. b) less serious: Out of environment space error when starting. c) serious: audio: Failed to create voice 'es1370.adc error when starting. 3 more bugs that need attention... some info missing here... host type, guest type, command lines, and most important type of images you're creating. from your email, you're using released versions, not cvs snapshot, right ? personally: I do not see (a) on windows host, I do not know which guest gives you (b) and I do not use audio, so I cannot confirm (c)... -- Christian
Re: [Qemu-devel] no meta key?
On Thu, Mar 29, 2007 at 07:43:01PM -0600, C.W. Betts wrote: When I was trying to get the PowerPC qemu to go into open Firmware mode, The mode you're looking for doesn't exist :-) Open Hack'ware implements a bunch of PROM operations that let the OS query it, et cetera, but the Forth interpreter is completely missing. Therefore, so is the Forth console. -- Daniel Jacobowitz CodeSourcery
[Qemu-devel] Re: 3 bugs found
3 more bugs that need attention... a) serious: Image files, even those created by the version of qemu-img.exe that comes with QEMU 0.90, are unreadable by QEMU 0.90, QEMU 0.82 works fine with them. b) less serious: Out of environment space error when starting. c) serious: audio: Failed to create voice 'es1370.adc error when starting. 3 more bugs that need attention... some info missing here... host type, guest type, command lines, and most important type of images you're creating. Host type is Win98SE. Guest types are Debian Linux 3.1 and Knoppix. Not specifying a type of image to qemu-img (using default, whichever filesystem that is - it doesn't say). Using the start.bat file included with the QEMU package (except changing cd-rom and hard disk image filenames as appropriate). I haven't adjusted any audio settings, I'm using whatever the defaults are. from your email, you're using released versions, not cvs snapshot, right ? Yes.
Re: [Qemu-devel] Re: 3 bugs found
On 3/30/07, James Jacobs [EMAIL PROTECTED] wrote: Host type is Win98SE. Guest types are Debian Linux 3.1 and Knoppix. Not specifying a type of image to qemu-img (using default, whichever filesystem that is - it doesn't say). no experience whatsoever on win98se host. I usually use it as guest. :) Using the start.bat file included with the QEMU package (except changing cd-rom and hard disk image filenames as appropriate). I haven't adjusted any audio settings, I'm using whatever the defaults are. which package ? from your email, you're using released versions, not cvs snapshot, right ? Yes. not many solutions here. Could be 32 bits related issues, because in my case I usually use it in XP host, and I do compile my own binaries... I find strange even knoppix does not work with raw images. Have you tried fdisk inside the guest ? and what dmesg | grep hda gives you ? -- Christian
[Qemu-devel] [SPARC] Looking for SuperSPARC User's Guide
I've been searching high and low for the SuperSPARC User's Guide. At one time it was published as Sun part number 801-4272-01 and TI part number 2647726-9761. A previous TI version was apparently published as SPKU005 (and possibly 2647726-9721, although that could be a typo). Sun and TI don't seem to have it any more. Has anyone here been able to track down a copy? Ironically, this message will probably simply add to the few extant references to this document on the Internet, all of which are searching in vain. (I found the SuperSPARC II Addendum, but it just documents the differences between the SuperSPARC I and II. It doesn't provide a full description of the processor.)
[Qemu-devel] qemu vl.h
CVSROOT:/sources/qemu Module name:qemu Changes by: Thiemo Seufer ths 07/03/30 16:41:55 Modified files: . : vl.h Log message: Fix build failure. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/vl.h?cvsroot=qemur1=1.197r2=1.198
[Qemu-devel] qemu cpu-exec.c dyngen-exec.h hw/mips_int.c tar...
CVSROOT:/sources/qemu Module name:qemu Changes by: Thiemo Seufer ths 07/03/30 16:44:54 Modified files: . : cpu-exec.c dyngen-exec.h hw : mips_int.c target-mips: cpu.h helper.c op.c op_helper.c translate.c Log message: Sanitize mips exception handling. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/cpu-exec.c?cvsroot=qemur1=1.96r2=1.97 http://cvs.savannah.gnu.org/viewcvs/qemu/dyngen-exec.h?cvsroot=qemur1=1.32r2=1.33 http://cvs.savannah.gnu.org/viewcvs/qemu/hw/mips_int.c?cvsroot=qemur1=1.2r2=1.3 http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/cpu.h?cvsroot=qemur1=1.25r2=1.26 http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/helper.c?cvsroot=qemur1=1.27r2=1.28 http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/op.c?cvsroot=qemur1=1.28r2=1.29 http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/op_helper.c?cvsroot=qemur1=1.32r2=1.33 http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/translate.c?cvsroot=qemur1=1.41r2=1.42
[Qemu-devel] [PATCH] add a simple 24mhz clock for the versatile
This patch implements a simple 24mhz clock for the versatile board such that functions in the linux kernel can make use of these stamps. An example user of this is the printk time stamps when using the time parameter on the kernel boot line. signed-off-by: [EMAIL PROTECTED] Cheers, Jason. Index: qemu/hw/arm_sysctl.c === --- qemu.orig/hw/arm_sysctl.c +++ qemu/hw/arm_sysctl.c @@ -71,8 +71,10 @@ static uint32_t arm_sysctl_read(void *op case 0x58: /* BOOTCS */ return 0; case 0x5c: /* 24MHz */ -/* ??? not implemented. */ -return 0; +{ +uint64_t now = qemu_get_clock(vm_clock); +return (uint32_t)(now*.024); +} case 0x60: /* MISC */ return 0; case 0x84: /* PROCID0 */
[Qemu-devel] [SPARC][PATCH] Generate cp_disabled trap for Cpop instructions
Hi all, Both of the SPARC CPU currently emulated in QEMU do not have a coprocessor. In such case executing a Cpop1 or a Cpop2 instruction should generate a cp_disabled trap, but the current implementation generates a illegal_instruction instead. The patch below fixes that. Bye, Aurelien Index: target-sparc/cpu.h === RCS file: /sources/qemu/qemu/target-sparc/cpu.h,v retrieving revision 1.30 diff -u -d -p -r1.30 cpu.h --- target-sparc/cpu.h 25 Mar 2007 07:55:52 - 1.30 +++ target-sparc/cpu.h 30 Mar 2007 17:09:46 - @@ -40,6 +40,7 @@ #define TT_TOVF 0x0a #define TT_EXTINT 0x10 #define TT_DIV_ZERO 0x2a +#define TT_NCP_INSN 0x24 #define TT_TRAP 0x80 #else #define TT_TFAULT 0x08 Index: target-sparc/translate.c === RCS file: /sources/qemu/qemu/target-sparc/translate.c,v retrieving revision 1.38 diff -u -d -p -r1.38 translate.c --- target-sparc/translate.c25 Mar 2007 07:55:52 - 1.38 +++ target-sparc/translate.c30 Mar 2007 17:09:47 - @@ -1736,7 +1739,7 @@ static void disas_sparc_insn(DisasContex gen_op_sra(); gen_movl_T0_reg(rd); #endif - } else if (xop 0x38) { + } else if (xop 0x36) { rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { /* immediate */ @@ -2142,6 +2145,10 @@ static void disas_sparc_insn(DisasContex goto illegal_insn; } } + } else if (xop == 0x36 || xop == 0x37) { /* CPop1 CPop2 */ + save_state(dc); + gen_op_exception(TT_NCP_INSN); + dc-is_br = 1; #ifdef TARGET_SPARC64 } else if (xop == 0x39) { /* V9 return */ rs1 = GET_FIELD(insn, 13, 17); -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [EMAIL PROTECTED] | [EMAIL PROTECTED] `-people.debian.org/~aurel32 | www.aurel32.net
Re: [Qemu-devel] [PATCH] add a simple 24mhz clock for the versatile
+ uint64_t now = qemu_get_clock(vm_clock); + return (uint32_t)(now*.024); We should be able to do this without resorting to floating point arithmetic. Paul
[Qemu-devel] qemu/target-mips helper.c
CVSROOT:/sources/qemu Module name:qemu Changes by: Thiemo Seufer ths 07/03/30 17:48:00 Modified files: target-mips: helper.c Log message: Squash logic bugs while they are fresh... CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/helper.c?cvsroot=qemur1=1.28r2=1.29
Re: [Qemu-devel] [PATCH] add a simple 24mhz clock for the versatile
If you're ok you can shift it left 4 bits, then add half that result then shift right 10 bits. Of course, you'll only get 23.4Mhz that way :-) jonathan On 3/30/07, Paul Brook [EMAIL PROTECTED] wrote: + uint64_t now = qemu_get_clock(vm_clock); + return (uint32_t)(now*.024); We should be able to do this without resorting to floating point arithmetic. Paul -- -- Jonathan Kalbfeld +1 323 620 6682
[Qemu-devel] [PATCH] Update qemu-binfmt-conf.sh
The patch updates the comments, makes modprobe conditional, adds a mount needed at least for Debian, and tries to add m68k. I have no m68k executable available, perhaps somebody can check the header bytes and the cpu type for this platform? Maybe the cpu list for mips must be completed, too. Stefan Index: qemu-binfmt-conf.sh === RCS file: /sources/qemu/qemu/qemu-binfmt-conf.sh,v retrieving revision 1.4 diff -u -b -B -r1.4 qemu-binfmt-conf.sh --- qemu-binfmt-conf.sh 6 Dec 2005 21:43:35 - 1.4 +++ qemu-binfmt-conf.sh 30 Mar 2007 18:22:59 - @@ -1,8 +1,13 @@ #!/bin/sh -# enable automatic i386/ARM/SPARC/PPC program execution by the kernel +# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel # load the binfmt_misc module -/sbin/modprobe binfmt_misc +if [ ! -d /proc/sys/fs/binfmt_misc ]; then + /sbin/modprobe binfmt_misc +fi +if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then + mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc +fi # probe cpu type cpu=`uname -m` @@ -10,6 +15,12 @@ i386|i486|i586|i686|i86pc|BePC) cpu=i386 ;; + m68k) +cpu=m68k + ;; + mips) +cpu=mips + ;; Power Macintosh|ppc|ppc64) cpu=ppc ;; @@ -33,6 +44,10 @@ if [ $cpu != ppc ] ; then echo ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-ppc:' /proc/sys/fs/binfmt_misc/register fi +if [ $cpu != m68k ] ; then +echo 'Please check cpu value and header information for m68k!' +echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-m68k:' /proc/sys/fs/binfmt_misc/register +fi if [ $cpu != mips ] ; then echo ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips:' /proc/sys/fs/binfmt_misc/register echo ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsel:' /proc/sys/fs/binfmt_misc/register
[Qemu-devel] qemu/target-mips cpu.h
CVSROOT:/sources/qemu Module name:qemu Changes by: Thiemo Seufer ths 07/03/30 18:42:21 Modified files: target-mips: cpu.h Log message: Fix typo, suggested by Ben Taylor. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/cpu.h?cvsroot=qemur1=1.26r2=1.27
[Qemu-devel] [PATCH] Fix spelling for qemu-doc.texi and monitor.c
This patch fixes the usage of medium and media in the documentation and in QEMU messages. one CDROM = medium (not media) two or more CDROMs = media (not medias) Please correct me if I was wrong - I'm not a native speaker but tried my best and looked at AskOxford. Stefan Index: qemu-doc.texi === RCS file: /sources/qemu/qemu/qemu-doc.texi,v retrieving revision 1.136 diff -u -b -B -r1.136 qemu-doc.texi --- qemu-doc.texi 19 Mar 2007 15:17:08 - 1.136 +++ qemu-doc.texi 30 Mar 2007 18:34:18 - @@ -789,7 +789,7 @@ @itemize @minus @item -Remove or insert removable medias images +Remove or insert removable media images (such as CD-ROM or floppies) @item @@ -842,10 +842,10 @@ Quit the emulator. @item eject [-f] device -Eject a removable media (use -f to force it). +Eject a removable medium (use -f to force it). @item change device filename -Change a removable media. +Change a removable medium. @item screendump filename Save screen into PPM image @var{filename}. @@ -1140,7 +1140,7 @@ alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is supported as an alias to the first CDROM drive. -Currently there is no specific code to handle removable medias, so it +Currently there is no specific code to handle removable media, so it is better to use the @code{change} or @code{eject} monitor commands to change or eject media. @item Hard disks @@ -1158,7 +1158,7 @@ @file{/dev/cdrom} is an alias to the first CDROM. -Currently there is no specific code to handle removable medias, so it +Currently there is no specific code to handle removable media, so it is better to use the @code{change} or @code{eject} monitor commands to change or eject media. Index: monitor.c === RCS file: /sources/qemu/qemu/monitor.c,v retrieving revision 1.68 diff -u -b -B -r1.68 monitor.c --- monitor.c 19 Mar 2007 15:17:08 - 1.68 +++ monitor.c 30 Mar 2007 18:45:12 - @@ -1215,9 +1215,9 @@ { q|quit, , do_quit, , quit the emulator }, { eject, -fB, do_eject, - [-f] device, eject a removable media (use -f to force it) }, + [-f] device, eject a removable medium (use -f to force it) }, { change, BF, do_change, - device filename, change a removable media }, + device filename, change a removable medium }, { screendump, F, do_screen_dump, filename, save screen into PPM image 'filename' }, { log, s, do_log,
[Qemu-devel] qemu/target-mips TODO
CVSROOT:/sources/qemu Module name:qemu Changes by: Thiemo Seufer ths 07/03/30 18:56:19 Modified files: target-mips: TODO Log message: Update mips TODO. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/TODO?cvsroot=qemur1=1.6r2=1.7
[Qemu-devel] qemu monitor.c qemu-doc.texi
CVSROOT:/sources/qemu Module name:qemu Changes by: Thiemo Seufer ths 07/03/30 18:58:01 Modified files: . : monitor.c qemu-doc.texi Log message: Spelling fixes, by Stefan Weil. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/monitor.c?cvsroot=qemur1=1.68r2=1.69 http://cvs.savannah.gnu.org/viewcvs/qemu/qemu-doc.texi?cvsroot=qemur1=1.136r2=1.137
[Qemu-devel] PATCH: Solaris kqemu.c
This patch further isolates the functions needed for kqemu.c by Solaris. The original include has the unintended side effect of screwing up the mips targets on Solaris 9/x86 because there are some defines that get included via sys/modctl.h that change how the CPU structure in the mips-target/cpu.h file is processed. (Bascially, the PC variable name gets changed to 14, which completely botches the compile). Kudos to Juergen Keil for another smart fix. qemu-kqemu.c-diff Description: Binary data
[Qemu-devel] qemu kqemu.c
CVSROOT:/sources/qemu Module name:qemu Changes by: Thiemo Seufer ths 07/03/30 19:20:50 Modified files: . : kqemu.c Log message: Switch include for Solaris to avoid namespace issues. By Juergen Keil. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/kqemu.c?cvsroot=qemur1=1.16r2=1.17
RE: [Qemu-devel] [PATCH] add a simple 24mhz clock for the versatile
uint64_t now = qemu_get_clock(vm_clock); return (uint32_t)((now*3)/125); The optimizer should fix this up with no floating point ops. Jason. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Kalbfeld Sent: Friday, March 30, 2007 12:50 PM To: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH] add a simple 24mhz clock for the versatile If you're ok you can shift it left 4 bits, then add half that result then shift right 10 bits. Of course, you'll only get 23.4Mhz that way :-) jonathan On 3/30/07, Paul Brook [EMAIL PROTECTED] wrote: + uint64_t now = qemu_get_clock(vm_clock); + return (uint32_t)(now*.024); We should be able to do this without resorting to floating point arithmetic. Paul -- -- Jonathan Kalbfeld +1 323 620 6682
Re: [Qemu-devel] [PATCH] add a simple 24mhz clock for the versatile
On 31/03/07, Wessel, Jason [EMAIL PROTECTED] wrote: uint64_t now = qemu_get_clock(vm_clock); return (uint32_t)((now*3)/125); The optimizer should fix this up with no floating point ops. Adding to the bikeshed discussion (www.bikeshed.com) this is still not correct as vm_clock is to be used with ticks_per_sec. return muldiv64(qemu_get_clock(vm_clock), 2400, ticks_per_sec); Regards, Andrzej