--- qemu-0.9.0.orig/debian/control +++ qemu-0.9.0/debian/control @@ -0,0 +1,37 @@ +Source: qemu +Section: misc +Priority: optional +Maintainer: MOTU Developers +XSBC-Original-Maintainer: Debian QEMU Team +Uploaders: Guilherme de S. Pastore , + Guillem Jover , Elrond , + Josh Triplett +Build-Depends: debhelper (>= 5), quilt (>= 0.40), binutils (>= 2.16-1), nasm, + gcc-3.4, libx11-dev, libsdl1.2-dev (>> 1.2.1), libncurses5-dev, zlib1g-dev, + texi2html, sharutils, libfreebsd-dev [kfreebsd-i386 kfreebsd-amd64], + libasound2-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], + libgpmg1-dev [amd64 i386 powerpc alpha sparc arm armeb armel s390], +Standards-Version: 3.7.2 + +Package: qemu +Architecture: amd64 i386 powerpc alpha sparc arm armeb armel s390 kfreebsd-i386 kfreebsd-amd64 +Depends: ${shlibs:Depends}, vgabios (>= 0.5a-1), bochsbios (>= 2.2.1-1) +Recommends: debootstrap, sharutils, vde2, proll, openhackware +Suggests: sudo +XB-Tag: hardware::emulation, interface::x11, role::program, scope::utility, uitoolkit::sdl, x11::application +Description: fast processor emulator + QEMU is a fast processor emulator: currently the package supports + arm, powerpc, sparc and x86 emulation. By using dynamic translation + it achieves reasonable speed while being easy to port on new host + CPUs. QEMU has two operating modes: + . + * User mode emulation: QEMU can launch Linux processes compiled for + one CPU on another CPU. + * Full system emulation: QEMU emulates a full system, including a + processor and various peripherals. It enables easier testing and + debugging of system code. It can also be used to provide virtual + hosting of several virtual PC on a single server. + . + As QEMU requires no host kernel patches to run, it is very safe and + easy to use. + --- qemu-0.9.0.orig/debian/qemu.doc-base +++ qemu-0.9.0/debian/qemu.doc-base @@ -0,0 +1,12 @@ +Document: qemu-doc +Title: QEMU User Manual +Author: Fabrice Bellard +Abstract: The QEMU user manual intends to make the user understand what + qemu is/does, and to guide them through the first steps of getting + the emulator to work, documenting parameters and commands, among other + useful things. +Section: Apps/Emulators + +Format: HTML +Index: /usr/share/doc/qemu/qemu-doc.html +Files: /usr/share/doc/qemu/qemu-doc.html --- qemu-0.9.0.orig/debian/changelog +++ qemu-0.9.0/debian/changelog @@ -0,0 +1,765 @@ +qemu (0.9.0-1ubuntu1) gutsy; urgency=low + + * merged from Debian/experimental + * Merge from debian unstable, remaining changes: + - Remove 34_syscalls_types.patch from debian/patches/series: add an + unnecessary kernel header breaking compilation of linux-user/syscall.c. + - Move proll and openhackware from Depends to Recommends. + - set Maintainer field to MOTU + + -- Michael Vogt Wed, 2 May 2007 11:55:16 +0200 + +qemu (0.9.0-1) experimental; urgency=low + + [ Guillem Jover ] + * New upstream release. (Closes: #409989) + - Support for relative paths in backing files for disk images. + (Closes: #390446) + - debian/patches/01_doc_typos.patch: Removed, merged upstream. + - debian/patches/38_syscall_arm_statfs64.patch: Likewise. + - debian/patches/51_serial_small_divider.patch: Likewise. + - debian/patches/67_ppc_ftbfs.patch: Likewise. + - debian/patches/21_net_soopts.patch: Synced. + - debian/patches/30_syscall_ipc.patch: Likewise. + - debian/patches/31_syscalls.patch: Likewise. + - debian/patches/35_syscall_sockaddr.patch: Likewise. + - debian/patches/39_syscall_fadvise64.patch: Likewise. + - debian/patches/42_arm_tls.patch: Likewise. + - debian/patches/55_unmux_socketcall.patch: Likewise. + - debian/patches/80_ui_curses.patch: Likewise. + * Update the copyright information. + * The ACPI initialization code has been moved to bochsbios. + - debian/patches/acpi-dsdt.hex: Removed. + - debian/rules: Do not install acpi-dsdt.hex. + * Add more files to the list of roms removed from the tarball needed to + be touched so that upstream 'make install' does not fail. + * Added armeb and armel to Architecture fields and libgpmg1-dev + Build-Depends. + * Recommend vde2 instead of the transitional vde package. (Closes: #407251) + * Fix typo in qemu-img output. (Closes: #408542) + - debian/patches/01_typo_qemu-img.patch: New file. + Thanks to Adam Buchbinder . + * Symlink qemu-user(1) to qemu-m68k(1). + * Reduce redundancy in qemu-user(1) synopsis. + * Fix rounding in sparc floating point to integer conversions. + - debian/patches/40_sparc_fp_to_int.patch: New file. + Thanks to Aurelien Jarno . + + -- Guillem Jover Thu, 8 Feb 2007 01:01:29 +0200 + +qemu (0.8.2+dfsg-0ubuntu1) feisty; urgency=low + + * Bump package version number to +dfsg-0ubuntu1 to get rid of binary blobs + that were left in the orig tarball with 0.8.2-0ubuntu1. + * Merge from debian unstable, remaining changes: + - 90_no_linux_compiler_h.patch: remove unnecessary kernel header + breaking compilation of linux-usb.c. + - Remove 34_syscalls_types.patch from debian/patches/series: add an + unnecessary kernel header breaking compilation of linux-user/syscall.c. + - Move proll and openhackware from Depends to Recommends. + + -- Jeremie Corbier Mon, 22 Jan 2007 17:27:33 -0800 + +qemu (0.8.2-5) unstable; urgency=low + + [ Guillem Jover ] + * Added a missing part to the ARM NPTL support patch, initially lost. + - debian/patches/42_arm_tls.patch: Updated. + + -- Guillem Jover Tue, 16 Jan 2007 11:44:00 +0200 + +qemu (0.8.2-4ubuntu1) feisty; urgency=low + + * Merge from debian unstable, remaining changes: + - 90_no_linux_compiler_h.patch: remove unnecessary kernel header + breaking compilation of linux-usb.c. + - Remove 34_syscalls_types.patch from debian/patches/series: add an + unnecessary kernel header breaking compilation of linux-user/syscall.c. + - Move proll and openhackware from Depends to Recommends. + + -- Jeremie Corbier Fri, 22 Dec 2006 12:06:33 -0800 + +qemu (0.8.2-4) unstable; urgency=medium + + [ Guillem Jover ] + * Disable using iasl for now until it's ported to big-endian systems and + include a locally built acpi-dsdt.hex file. + + -- Guillem Jover Sun, 3 Dec 2006 21:10:23 +0200 + +qemu (0.8.2-3) unstable; urgency=low + + [ Guillem Jover ] + * Hopefully really fix powerpc FTBFS. + + -- Guillem Jover Sun, 5 Nov 2006 17:09:53 +0200 + +qemu (0.8.2-2) unstable; urgency=low + + [ Guillem Jover ] + * Update Tag field to match new debtags vocabulary. + * Clean properly. (Closes: #390166) + - Remove the acpi generated files and the docs. + - Revert the docs regeneration forcing logic. + Thanks to Anderson Lizardo . + * On install use DESTDIR instead of specifying all paths. (Closes: #396139) + Thanks to Anderson Lizardo . + * Port to GNU/kFreeBSD. (Closes: #327622) + - Disable ALSA on non-linux systems. + - Add a Build-Depends on libfreebsd-dev on kfreebsd systems. + - Add kfreebsd-i386 and kfreebsd-amd64 to the Architecture field. + - debian/patches/65_kfreebsd.patch: New file. + Thanks Petr Salinger . + * In qemu-make-debian-root do not explicitely install in aptitude and + libsigc++-1.2-5c102, they are pulled now by default. And do not remove + aptitude afterwards. (Closes: #392481) + Thanks to Ted Percival . + * Add experimental ncurses ui support. (Closes: #369462) + - debian/patches/80_ui_curses.patch: New file. + Thanks to Andrzej Zaborowski . + * Add SO_PEERCRED and SO_SNDTIMEO support, and fix accept syscall when + being passed NULL pointers. + - debian/patches/21_net_sockopts.patch: Renamed to ... + - debian/patches/21_net_soopts.patch: ... here. Modify. + Thanks to Pablo Virolainen. + * Add a fadvise64 syscall stub. + - debian/patches/39_syscall_fadvise64.patch: New file. + Thanks to Pablo Virolainen. + * Add EABI unmuxed socket syscalls. + - debian/patches/55_unmux_socketcall.patch: New file. + Thanks to Riku Voipio. + * Add TLS sections to the ARM and x86 linker scripts so that qemu user + emulators can be linked statically. + - debian/patches/66_tls_ld.patch: New file. + * Move the documentation of the binary blob removals from the original + upstream tarball from README.Debian to debian/copyright. + * Reword the emphasis on "FAST!" from the package description. + * Fix FTBFS on powerpc by adding the missing fp_status variable to the + int32_to_float32 function calls. + - debian/patches/67_ppc_ftbfs.patch: New file. + + -- Guillem Jover Sun, 5 Nov 2006 08:48:27 +0200 + +qemu (0.8.2-1) unstable; urgency=low + + [ Guillem Jover ] + * New upstream release. (Closes: #379461, #385029, #388810) + - Add ACPI BIOS emulation support. (Closes: #372533) + - Fix mouse invisible wall when using Windows XP. (Closes: #384666) + - debian/patches/01_doc_typos.patch: Sync. + - debian/patches/03_machines_list_no_error.patch: Likewise. + - debian/patches/04_do_not_print_rtc_freq_if_ok.patch: Likewise. + - debian/patches/05_non-fatal_if_linux_hd_missing.patch: Likewise. + - debian/patches/06_exit_segfault.patch: Likewise. + - debian/patches/12_signal_powerpc_support.patch: Likewise. + - debian/patches/21_net_sockopt.patch: Likewise. + - debian/patches/22_net_tuntap_stall.patch: Likewise. + - debian/patches/30_syscall_ipc.patch: Likewise. + - debian/patches/31_syscalls.patch: Likewise. + - debian/patches/32_syscall_sysctl.patch: Likewise. + - debian/patches/33_syscall_ppc_clone.patch: Likewise. + - debian/patches/35_syscall_sockaddr.patch: Likewise. + - debian/patches/36_syscall_prctl.patch: Likewise. + - debian/patches/37_syscall_mount.patch: Likewise. + - debian/patches/41_arm_fpa_sigfpe.patch: Likewise. + - debian/patches/42_arm_tls.patch: Likewise. + - debian/patches/61_safe_64bit_int.patch: Likewise. + - debian/patches/63_sparc_build.patch: Likewise. + - debian/patches/50_missing_keycodes.patch: Removed, integrated upstream. + * Switch to quilt: + - debian/control: Add quilt (>= 0.40) to Build-Depends. + - debian/patches/series: New file. + - debian/patch.mk: Removed. + - debian/rules: Include '/usr/share/quilt/quilt.make' instead of + 'debian/patch.mk'. + * Build the ACPI Source Language files with iasl. + * Add a Tag field to the binary package, using data from debtags. + * Add 2006 to the debian/copyright years. + * Add a Recommends on vde. (Closes: #386780) + * Fix spelling error in package description (peripherials -> peripherals). + (Closes: #388700) + Thanks to Rakesh 'arky' Ambati . + * Fix ne2000_can_receive return code to 0 when the command is STOP. + (Closes: #386209) + - debian/patches/52_ne2000_return.patch: New file. + Thanks to Samuel Thibault . + * Document the binary blob removals from the original upstream tarball in + README.Debian. (Closes: #388740) + + -- Guillem Jover Mon, 25 Sep 2006 04:16:25 +0300 + +qemu (0.8.2-0ubuntu1) edgy; urgency=low + + * Merged with Debian unstable + * New Upstream release + * Dropped debian/patches/12_signal_powerpc_support.patch (broken for qemu + 0.8.2) + * Redid debian/patches/21_net_sockopt.patch + * Redid debian/patches/35_syscall_sockaddr.patch + * Redid debian/patches/42_arm_tls.patch + * Dropped debian/patches/50_missing_keycodes.patch (applied upstream) + * Redid debian/patches/61_safe_64bit_int.patch + * Dropped debian/patches/63_sparc_build.patch (applied upstream) + * Added new patch 65_no-linux_types_h.patch (unnecessary kernel header + breaking compilation of linux-user/syscall.c) + * Added new patch 66_no-linux_compiler_h.patch (unnecessary kernel header + breaking compilation of linux-usb.c) + + -- Rodrigo Parra Novo Fri, 4 Aug 2006 22:50:15 -0300 + +qemu (0.8.1-1) unstable; urgency=low + + [ Guillem Jover ] + * New upstream release. (Closes: #366955, #366637) + - debian/patches/01_doc_typos.patch: Sync. + - debian/patches/04_do_not_print_rtc_freq_if_ok.patch: Likewise. + - debian/patches/05_non-fatal_if_linux_hd_missing.patch: Likewise. + - debian/patches/12_signal_powerpc_support.patch: Likewise. + - debian/patches/21_net_sockopt.patch: Likewise. + - debian/patches/22_net_tuntap_stall.patch: Likewise. + - debian/patches/30_syscall_ipc.patch: Likewise. + - debian/patches/31_syscalls.patch: Likewise. + - debian/patches/32_syscall_sysctl.patch: Likewise. + - debian/patches/33_syscall_ppc_clone.patch: Likewise. + - debian/patches/35_syscall_sockaddr.patch: Likewise. + - debian/patches/36_syscall_prctl.patch: Likewise. + - debian/patches/37_syscall_mount.patch: Likewise. + - debian/patches/41_arm_fpa_sigfpe.patch: Likewise. + - debian/patches/42_arm_tls.patch: Likewise. + - debian/patches/43_arm_cpustate.patch: Likewise. + - debian/patches/50_missing_keycodes.patch: Likewise. + - debian/patches/51_serial_small_divider.patch: Likewise. + - debian/patches/61_safe_64bit_int.patch: Likewise. + - debian/patches/63_sparc_build.patch: Likewise. + - debian/patches/40_arm_nwfpe_cpsr.patch: Removed, integrated upstream. + * Make the patch system apply the patch on the first run. + - debian/patches/64_ppc_asm_constraints.patch: Add DPATCHLEVEL. + * Document how to use the images created with qemu-make-debian-root in the + man page. Thanks to Jacobo . (Closes: #343450) + * Add support for the -snapshot option to use the TMPDIR evironment + variable. (Closes: #353880) + - debian/patches/02_snapshot_use_tmpdir.patch: New file. + * Do not exit with an error when using '-M ?'. (Closes: #365209) + - debian/patches/03_machines_list_no_error.patch: New file. + * Added symlink for system-mipsel emulator man page. + * Build and clean the pc-bios directory. + * Avoid segfaulting by using _exit(2) instead of exit(3) in qemu user + emulators. (Closes: #338289) + - debian/patches/06_exit_segfault.patch: New file. + * Enable ALSA audio support and add libasound2-dev to the Build-Depends. + * Now using Standards-Version 3.7.2 (no changes needed). + + -- Guillem Jover Sun, 28 May 2006 20:51:10 +0300 + +qemu (0.8.0-3ubuntu1) dapper; urgency=low + + * moved proll and openhackware from Depends to Recommends. These are + needed for sparc emulation, so this may be broken in ubuntu. + + -- Reinhard Tartler Fri, 14 Apr 2006 20:30:04 +0200 + +qemu (0.8.0-3) unstable; urgency=low + + [ Josh Triplett ] + * Fix FTBFS on PowerPC caused by asm constraint problem. (Closes: #361727) + - debian/patches/64_ppc_asm_constraints.patch. + + [ Guillem Jover ] + * Clamp addrlen from host to target when using AF_UNIX. This fixes + socket problems when using EABI. + - debian/patches/35_syscall_sockaddr.patch: New file. + * Fix floating point comparison on ARM NWFPE, due to glue code missmatch. + (Closes: #356287) + - debian/patches/40_arm_nwfpe_cpsr.patch: New file. + - debian/patches/40_fpu_arm_sigfpe.patch: Rename to ... + - debian/patches/41_arm_fpa_sigfpe.patch: ... this. Resync. + Thanks to Ulrich Hecht. + * Fix POSIX threads creation on ARM hanging when initializing the cpu + structure being it cyclic. + - debian/patches/43_arm_cpustate.patch: New file. + * Add TLS support for ARM. Stolen from Scratchbox. + - debian/patches/42_arm_tls.patch: New file. + * Fix sysctl endian problem. + - debian/patches/32_syscall_sysctl.patch: Update. + Thanks to Timo Savola . + * Remove now default '--enable-slirp' build option. (Closes: #356284) + Thanks to Anderson Lizardo . + * Remove unused sharedir to 'make install'. (Closes: #356418) + Thanks to Anderson Lizardo . + * Fix package not cleaning properly. (Closes: #356279) + Thanks to Anderson Lizardo for the initial + patch. + * Add needed syscalls to make debootstrap work. (Closes: #356291) + - debian/patches/36_syscall_prctl.patch: New file. + - debian/patches/37_syscall_mount.patch: Likewise. + - debian/patches/38_syscall_arm_statfs64.patch: Likewise. + Thanks to Anderson Lizardo . + * Remove obsolete Build-Dependency xlibs-dev. + + -- Guillem Jover Thu, 13 Apr 2006 11:53:00 +0300 + +qemu (0.8.0-2) unstable; urgency=low + + [ Guillem Jover ] + * Switch away from cdbs to plain debhelper. + * Upgrade to debhelper compat level 5. + * Allow overriding CC compiler variable. (Closes: #345772) + * Do not redefine 64 bit types on 64 bit arches. + - debian/patches/61_safe_64bit_int.patch: New file. + * Allow linux_boot.bin to be built on any arch by switching to nasm, + and Build-Depending on it. + - debian/patches/62_linux_boot_nasm.patch: New file. + * The serial hw driver uses a small divider that gets zeroed when shifting + bits to the right. (Closes: #276276, #348098) + - debian/patches/51_serial_small_divider.patch: New file. + Thanks to Samuel Thibault . + * Escaped hyphens in qemu-user manpage, use italics for filenames and + parameters and bold for options. + * Partial build failure fix for Sparc. (Bugs: #317145, #336970) + Thanks to Jurij Smakov . + + -- Guillem Jover Mon, 20 Feb 2006 09:17:46 +0200 + +qemu (0.8.0-1) unstable; urgency=low + + [ Guillem Jover ] + * New upstream release. (Closes: #344339) + - Added support for Virtual FAT. (Closes: #313123) + - Emulate repeated keystrokes when holding a key. (Closes: #298864) + - debian/patches/01_doc_typos.patch: Sync. + - debian/patches/04_do_not_print_rtc_freq_if_ok.patch: Likewise. + - debian/patches/05_non-fatal_if_linux_hd_missing.patch: Likewise. + - debian/patches/12_signal_powerpc_support.patch: Likewise. + - debian/patches/21_net_sockopt.patch: Likewise. + - debian/patches/22_net_tuntap_stall.patch: Likewise. + - debian/patches/30_syscall_ipc.patch: Likewise. + - debian/patches/31_syscalls.patch: Likewise. + - debian/patches/32_syscall_sysctl.patch: Likewise. + - debian/patches/33_syscall_ppc_clone.patch: Likewise. + - debian/patches/40_fpu_arm_sigfpe.patch: Likewise. + - debian/patches/50_missing_keycodes.patch: Likewise. + * Added mips and mipsel to the lintian overrides for the user emulators + being shlib-with-non-pic-code. + * Added symlinks for mips, mipsel and system-arm emulator manpages. + + -- Guillem Jover Fri, 30 Dec 2005 05:44:53 +0200 + +qemu (0.7.2-2) unstable; urgency=low + + [ Josh Triplett ] + * Add support for signal handling on PowerPC. (Closes: #335509) + - debian/patches/12_signal_powerpc_support.patch: New file. + + [ Guillem Jover ] + * Add Josh Triplett to Uploaders and packaging team. + * Fix PowerPC build failure by reintroducing the ppc linker script and + adding the missing _SDA_BASE_ and _SDA2_BASE_ symbols. (Closes: #336983) + * Remove invalid patch making X11 fail at runtime. + - debian/patches/20_net_socket.patch: Remove. + - debian/patches/32_syscall_sysctl.patch: Sync. + Thanks to Daniel Gimpelevich . + * Avoid the patch system to try until it applies. + - debian/patches/05_non-fatal_if_linux_hd_missing.patch: Added patch level. + - debian/patches/12_signal_powerpc_support.patch: Likewise. + + -- Guillem Jover Wed, 21 Dec 2005 22:11:34 +0200 + +qemu (0.7.2-1) unstable; urgency=low + + [ Guillem Jover ] + * New upstream release. (Closes: #321232, #327168) + - debian/patches/12_signal_silent.patch: Integrated upstream, remove. + - debian/patches/50_ppc_ldscript.patch: Likewise. + - debian/patches/33_syscall_truncate64.patch: Likewise. + - debian/patches/01_doc_typos.patch: Resync with upstream. + - debian/patches/04_do_not_print_rtc_freq_if_ok.patch: Likewise. + - debian/patches/05_non-fatal_if_linux_hd_missing.patch: Likewise. + - debian/patches/10_signal_jobs.patch: Likewise. + - debian/patches/11_signal_sigaction.patch: Likewise. + - debian/patches/20_net_socket.patch: Likewise. + - debian/patches/21_net_sockopt.patch: Likewise. + - debian/patches/22_net_tuntap_stall.patch: Likewise. + - debian/patches/30_syscall_ipc.patch: Likewise. + - debian/patches/31_syscalls.patch: Likewise. + - debian/patches/32_syscall_sysctl.patch: Likewise. + - debian/patches/40_fpu_arm_sigfpe.patch: Likewise. + * Repackaged upstream source to deal with binaries w/o sources. + - pc-bios/video.x: New file removed. + * Create a new qemu-user(1) manpage and link all user emulator manpages + to it. (Closes: #335163) + * Add missing '-' and '=' keycodes for sendkey command. + - debian/patches/50_missing_keycodes.patch: New file. (Closes: #334071) + Thanks to Robert Millan . + * Add manpage link for qemu-system-mips. + * Make sysctl byte-swap the name values. + - debian/patches/32_syscall_sysctl.patch: Merge patch. (Closes: #334458) + Thanks to Josh Triplett . + * Change documentation menu section to "Apps/Emulators". (Closes: #335062) + Thanks to Frans Pop . + * On PowerPC, do not zero registers r7-r31 in do_fork and zero register r3. + Fixing segfaults on programs using the clone syscall. + - debian/patches/33_syscall_ppc_clone.patch: New file. (Closes: #335159) + Thanks to Josh Triplett + and Paul Brook . + * Tighten vgabios and bochsbios versioned Depends. + * Add video.x to the list of roms to touch to make qemu Makefile happy. + * Add lintian overrides for the user emulators being shlib-with-non-pic-code. + * Wrap lines in debian/control fields (knowingly breaking policy). + + [ Guilherme de S. Pastore ] + * debian/control: + - Updated my e-mail address. + * debian/copyright: + - Dropped AndrĂ© from team members list, not a single contribution ever. + + -- Guillem Jover Mon, 31 Oct 2005 05:01:45 +0200 + +qemu (0.7.0-4) unstable; urgency=low + + [ Guillem Jover ] + * Rebuild source with locally deborked dpkg-source. (Closes: #321019) + * Added the location of the Subversion repo used for the packages and + fixed the upstream URL in debian/copyright. + * Lower case title header in qemu-make-debian-root man page. + * Use dd instead of cat to generate the qemu debian root image. + (Closes: #315952) + + -- Guillem Jover Wed, 3 Aug 2005 05:53:30 +0300 + +qemu (0.7.0-3) unstable; urgency=low + + [ Guillem Jover ] + * Update watch file to version 3, use perlre and new upstream site. + * Now using Standards-Version 3.6.2 (no changes needed). + * Fix TUN/TAP network interface stalling the connection. (Closes: #290569) + Thanks to Vitaly Belostotsky . + * Link against librt, needed by the new clock_gettime syscall. + - debian/patches/31_syscalls.patch: Update. (Closes: #315388) + Thanks to Timo Savola for noticing. + * Force Build-Dependency on binutils >= 2.16-1 needed by the amd64 and + powerpc linker scripts. (Closes: #262655) + * Force usage of gcc-3.4. (Closes: #319527) + * Add missing Build-Dependency on zlib1g-dev. + Thanks to Reinhard Tartler . + * Include in syscall.c to avoid the broken headers in + linux-kernel-headers 2.6.12. + - debian/patches/34_syscalls_types.patch: New file. + Thanks to Octavian Cerna . + * Fix powerpc linker script. + - debian/patches/50_ppc_ldscript.patch: New file. + Thanks to Octavian Cerna . + + -- Guillem Jover Mon, 1 Aug 2005 02:48:09 +0300 + +qemu (0.7.0-2) unstable; urgency=low + + [ Guillem Jover ] + * Add alpha, sparc, arm and s390 to Architectures (and to the + libgpmg1-dev Build-Depends). + + * Forward SIGSTOP and SIGCONT sent to QEMU to the emulated application. + - debian/patches/10_signal_jobs.patch: New file. + Thanks to Ulrich Hecht. + * Return EINVAL on emulated sigaction when given invalid signal + parameters SIGKILL and SIGSTOP. + - debian/patches/11_signal_sigaction.patch: New fle. + Thanks to Valtteri Rahkonen. + * Do not print messsages for uncaught signal, thus fixing the case + were some applications want to kill their siblings. + - debian/patches/12_signal_silent.patch: New file. + Thanks to Valtteri Rahkonen + + * Fix Unix sockets by handling correctly AF_UNIX socket address + structure length. + - debian/patches/20_net_socket.patch: New file. + Thanks to Timo Savola. + * Implement SO_LINGER, SO_RCVTIMEO, SO_SNDTIMEO, SO_PEERNAME and + SO_PEERCRED getsockoptions. + - debian/patches/21_net_sockopt.patch: New file. + Thanks to Valtteri Rahkonen. + + * Implement SysV IPC message and semaphore syscalls. + - debian/patches/30_syscall_ipc.patch: New file. + Thanks to Valtteri Rahkonen. + * Implement acct, umount2, uselib, swapon, syslog, ftruncate64, + mincore, madvise, readahead and clock_gettime syscalls. + - debian/patches/31_syscalls.patch: New file. + Thanks to Ulrich Hecht. + * Implement sysctl CTL_KERN/KERN_VERSION + - debian/patches/32_syscall_sysctl.patch: New file. + Thanks to Timo Savola. + * Implement truncate64 syscall. + - debian/patches/33_syscall_truncate64.patch: New file. + Thanks to Valtteri Rahkonen. + + * Implement ARM floating point exeption emulation. + - debian/patches/40_fpu_arm_sigfpe.patch: New file. + Thanks to Ulrich Hecht. + + -- Guillem Jover Sun, 19 Jun 2005 15:05:37 +0300 + +qemu (0.7.0-1) experimental; urgency=low + + [ Guillem Jover ] + * New upstream release. (Closes: #308459, #308494) + * Do not require a disk image when booting a Linux kernel. (Closes: #260935) + Thanks to Jonas Smedegaard . + + [ Guilherme de S. Pastore ] + * Rewrote README.Debian for more clarity + * Add support for amd64 as a host architecture. (Closes: #262655) + - Add build-depend on libgpmg1-dev on amd64. + * Fixed qemu-make-debian-root so that it shows the name by which + it was called on the usage notice, not "%s". (Closes: #303507) + Thanks to Micah Anderson . + + [ Elrond ] + * Clean up more files, so they don't end up in the final .diff.gz + * Switch to external proll and openhackware: + - Instead of patching qemu's Makefile, trick it by giving it empty + files to install and remove them straight after install. + - Don't ship the roms in debian/roms any more! + - Instead add more symlinks. + - Update Depends: apropiately. + + -- Guillem Jover Fri, 27 May 2005 02:06:20 +0300 + +qemu (0.6.1+20050407-1) unstable; urgency=low + + [ Guillem Jover ] + * New upstream snapshot. + - Fix -user-net. (Closes: #295019) + - Fix win2k and winxp image booting. (Closes: #285170, #292707) + - Fix installation of outdated documentation. (Closes: #286931) + - Provide qemu-img instead of qemu-mkcow. (Closes: #290713) + - Remove debian/patches/05_fix_openpic_timer_test.patch, integrated + upstream. + - Remove debian/patches/02_selectable_sdl_keyboard.patch, superseded + by new keyboard implementation. (Closes: #284510, #299432) + - Remove debian/patches/01_mkcow_section_and_hyphens.patch. + - Conditionalize qemu -g option for some architectures. (Closes: #298988) + * Added new copyright year to debian/copyright. + * Added initial qemu-make-debian-root man page. (Closes: #286932) + * Fixed typos in qemu documentation. (Closes: #301933) + Thanks to A Costa . + * Added Elrond to Uploaders and packaging team. + * Use the default target list: + - Do not build qemu-fast anymore as it is deprecated upstream anyway. + (Closes: #278602, #281510) + - New targets armeb and system-x86_64. + * Updated ROM images under debian/roms/: + - OpenHackWare 0.4. + - Proll 18 with qemu specific patches. + * Remove uudecoded files from pc-bios/ on clean. + * Fix qemu-make-debian-root to behave correctly even if the needed + Recommends are not installed. + + [ Guilherme de S. Pastore ] + * Create a doc-base entry for the package (Closes: #290669) + * debian/control: + - Add debootstrap to the 'Recommends: ' line, as needed by + qemu-make-debian-root (Closes: #302848) + - Moved sharutils from dependency to recommendation, as it is only + needed by qemu-make-debian-root + * debian/docs: + - Do not include README.distrib in the binary package (Closes: #302853) + + [ Elrond ] + * Replace "libgpmg1-dev | not+linux-gnu" by "libgpmg1-dev [i386 powerpc]" + in Build-Depends. qemu should not need to build-depend on it anyway, the + real problem is described in Bug#267174. When it is solved, we can + remove our dependency. Until then please remember to add any arch, which + we will build on and that has gpm. This change hopefully calms: + + * Add versions to the dependencies on bochsbios and vgabios + (Closes: #288997): + - vgabios: Use the current version from testing/unstable (0.4c+20041014-1), + according to Frans Pop , this fixed those + "blank screen" problems. + - bochsbios: Use the current version from unstable (2.1.1+20041109-3), as + Guillem Jover fixed the networking in that version. + + -- Guillem Jover Thu, 7 Apr 2005 01:26:01 +0300 + +qemu (0.6.1-1) unstable; urgency=low + + [ Guillem Jover ] + * New upstream release. (Closes: #281626) + - Booting from drive b is not supported anymore. (Closes: #275679) + - Fix ne2k network interface that was not working in some situations. + (Closes: #281862) + - Remove debian/patches/06_build_gcc3.4.patch, fixed upstream. + - Remove debian/patches/04_lfs.patch, fixed upstream. + - Remove debian/patches/02_fix_powerpc_FTBFS.patch, fixed upstream. + - Remove debian/patches/00_escape_manpage_hyphens.patch, not needed. + - Sync debian/patches/03_use_external_bios.patch. + * Include uuencoded source for proll 18, some build fixes and its binary + proll.bin on debian/roms/. + * Suggests sudo to be used by the qemu-ifup script. + Thanks to Elrond . + * Make sudo in qemu-ifup explain what the password is for. (Closes: #281380) + * Add an option to select the method to convert keyevent to keycode + in the SDL keyboard handling code. Added support for Right Shift in the + generic handler. (Closes: #282658) + Thanks to Elrond . + * Do not set RTC frequency to 1024 or warn about this if it has already + the correct value. (Closes: #281403) + * Enabled sparc-softmmu support. + + -- Guillem Jover Sat, 27 Nov 2004 23:23:49 +0100 + +qemu (0.6.0.dfsg.2-1) unstable; urgency=low + + [ Guillem Jover ] + * Repackaged upstream source to remove external included files. + - pc-bios/ppc-rom.bin: Removed. + - pc-bios/OpenHackWare_0.3.tar.bz2: Likewise. + - pc-bios/vgabios.bin: Likewise. + - pc-bios/vgabios-cirrus.bin: Likewise. + - pc-bios/vgabios-cvs-2004-06-17.tgz: Likewise. + * Include uuencoded source for OpenHackWare 0.3.1 and its binary + ppc-rom.bin on debian/roms/. Add a Build-Depends on sharutils. + * Update tundev.c. Pass -tun-dev to qemu without the equal sign. + Thanks to Isaac Clerencia . + * Fix README.Debian to point to the renamed qemu-make-debian-root. + * Add Depends on sharutils needed by qemu-make-debian-root. + (Closes: #272130) + * Use and depend on vgabios package, which is in sync with bochsbios + that checks for rom bios checksums. (Closes: #281202) + * Enable LFS globally, thus fixing problems with qemu-mkcow when using + an existing large image. + (Closes: #279925) + * Fix openpic timer write test, catched from a warning about a constant + value larger than the type it was casted to. + * Fix build failure with gcc 3.4. Patch stolen from Gentoo BTS. + + -- Guillem Jover Mon, 15 Nov 2004 10:46:54 +0100 + +qemu (0.6.0.dfsg.1-1) unstable; urgency=high + + [ Guillem Jover ] + * Repackaged upstream source to deal with binaries w/o sources. + (Closes: #268780) + - pc-bios/bios.bin: Removed binary without source. Now using + bochsbios package. + - pc-bios/vgabios.bin: Rebuilt from vgabios cvs 2004-06-17 snapshot, + source included. + - pc-bios/vgabios-cirrus.bin: Likewise. + - pc-bios/ppc-rom.bin: Rebuilt on voltaire, source included. + - pc-bios/linux_boot.bin: Rebuilt from source. + * Move make-debian-root.sh to /usr/sbin/qemu-make-debian-root. + (Closes: #268705) + + -- Guillem Jover Mon, 13 Sep 2004 01:28:54 +0200 + +qemu (0.6.0-2) unstable; urgency=high + + [ Guilherme de S. Pastore ] + * Fixed dangling symlinks under /usr/share/man/man1. (Closes: #264764) + + [ Guillem Jover ] + * Fix FTBFS on powerpc. + - debian/patches/02_fix_powerpc_FTBFS.patch: New file. + + -- Guillem Jover Wed, 18 Aug 2004 15:50:43 +0200 + +qemu (0.6.0-1) unstable; urgency=medium + + * New maintainers. (Closes: #258900) + * New upstream release. (Closes: #258732) + - Installs ppc BIOS ROM file. (Closes: #257492) + - Builds with -fno-strict-aliasing. (Closes: #257123) + + [ Guilherme de S. Pastore ] + * debian/rules: + - Cleaned up. + - Ported to use CDBS. + * 00_escape_manpage_hyphens.patch: + - Correct a little typo and escape hyphens in upstream manpage. + * 01_mkcow_section_and_hyphens.patch: + - Fix section mismatch and escape hyphens in the qemu-mkcow manpage. + * Added simple /etc/qemu-ifup helper script. (Closes: #245281) + Thanks to Martin Michlmayr . + * Cleaned debian/watch. + * UTF-8'ed debian/changelog. + * Updated Standards-Version to 3.6.1.1. + * Removed outdated and unnecessary debian/qemu-i386.sgml. + - Removed build dependency on docbook-to-man. + * Removed "x86" part from the description (hey, qemu is not x86-only + in any way). Deserves a complete rewrite, shall be done soon. + + [ Guillem Jover ] + * Lower-case package short description. + * Added missing CPU emulations to the description. + * Cleaned and updated debian/copyright. + * Removed manually added libx11-6 dependency. + * Only Build-Depends on libgpmg1-dev on GNU/Linux systems. + * Cosmetic unification to debian/changelog. + * debian/rules: + - Remove generated files. + - Give exec perms to qemu-ifup. + + -- Guillem Jover Sun, 8 Aug 2004 17:24:08 +0200 + +qemu (0.5.5-2) unstable; urgency=low + + * Re-enable SDL disabled while I was bugchasing. (Closes: #255014) + * Yes, this is really 0.5.5. (Closes: #254655) + * Enable slirp networking. (Closes: #253573) + * Add Build-Depends on libgpmg1-dev (found by Bastian Blank, probably breaks + Hurd but that's a problem for another day). + + -- Paul Russell Thu, 24 Jun 2004 06:26:42 +0200 + +qemu (0.5.5-1) unstable; urgency=low + + * New upstream release. (Closes: #237556, #237556) + * Applied patch to add options to make_debian_root.sh. (Closes: #238787) + * Applied patch for other archs: hmmm... (Closes: #251420) + * Do umount -d in make_debian_root.sh. (Closes: #251775) + + -- Paul Russell Tue, 1 Jun 2004 03:50:05 +0200 + +qemu (0.5.4-1) unstable; urgency=low + + * New upstream release. (Closes: #246634) + * qemu-mkcow included in upstream. + * Added tundev program source in doc, to see if people find it useful. + + -- Paul Russell Mon, 3 May 2004 08:14:49 +0200 + +qemu (0.5.3-1) unstable; urgency=low + + * New upstream release. (Closes: #237556) + * Use aalib-config --static-libs. (Closes: #243325) + * Document Control-Shift to release mouse pointer. (Closes: #238074) + + -- Paul Russell Tue, 13 Apr 2004 02:58:49 +0200 + +qemu (0.5.2-4) unstable; urgency=low + + * Fix PPC install (Michel Daenzer patch). (Closes: #238431) + * Simplify deps (might be wrong, but it's neater). (Closes: #238430) + + -- Paul Russell Wed, 17 Mar 2004 01:35:47 +0100 + +qemu (0.5.2-3) unstable; urgency=low + + * Make compile on woody. (Closes: #238163) + * Include qemu-doc.html. (Closes: #238076) + * Wrote qemu-i386 man page. (Closes: #238077) + + -- Paul Russell Mon, 15 Mar 2004 23:56:25 +0100 + +qemu (0.5.2-2) unstable; urgency=low + + * Fix build problem so bios.bin etc. can be found. (Closes: #237553) + + -- Paul Russell Fri, 12 Mar 2004 05:43:00 +0100 + +qemu (0.5.2-1) unstable; urgency=low + + * Initial Release. (Closes: #187407) + + -- Paul Russell Wed, 3 Mar 2004 02:18:54 +0100 + --- qemu-0.9.0.orig/debian/docs +++ qemu-0.9.0/debian/docs @@ -0,0 +1,4 @@ +README +TODO +qemu-doc.html +debian/tundev.c --- qemu-0.9.0.orig/debian/copyright +++ qemu-0.9.0/debian/copyright @@ -0,0 +1,53 @@ +This package was debianized by Paul Russell on +Wed, 3 Mar 2004 02:18:54 +0100. + +Now maintained as a team by: + + Elrond + Guilherme de S. Pastore + Guillem Jover + Josh Triplett + Riku Voipio + +The upstream source was downloaded from: + + + + All the binary blobs without sources contained in the pc-bios/ directory + in the original upstream tarball have been removed starting from Debian + package version 0.6.0.dfsg.1-1. Those roms which are free can be found + in split packages of their own, represented accordingly in the dependecy + relationships. + +The debian packages are maintained through Subversion on: + + + +Upstream Author: + + Fabrice Bellard + +Copyright: + + Copyright (C) 2003, 2004, 2005, 2006, 2007 Fabrice Bellard + +License: + + QEMU as a whole is released under the GNU General Public License. + On Debian systems, the complete text of the GNU General Public License + can be found in the file /usr/share/common-licenses/GPL. + + Parts of QEMU have specific licenses which are compatible with the + GNU General Public License. Hence each source file contains its own + licensing information. + + In particular, the QEMU virtual CPU core library (libqemu.a) is + released under the GNU Lesser General Public License. On Debian systems, + the complete text of the GNU Lesser General Public License can be found + in the file /usr/share/common-licenses/LGPL. + + Many hardware device emulation sources are released under the BSD license. + On Debian systems, the complete text of the BSD license be found in the + file /usr/share/common-licenses/BSD. + + --- qemu-0.9.0.orig/debian/qemu-ifup +++ qemu-0.9.0/debian/qemu-ifup @@ -0,0 +1,2 @@ +#!/bin/sh +sudo -p "Password for $0:" /sbin/ifconfig $1 172.20.0.1 --- qemu-0.9.0.orig/debian/watch +++ qemu-0.9.0/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://www.qemu.org/download.html qemu-([\d.]*).tar.gz debian uupdate --- qemu-0.9.0.orig/debian/README.Debian +++ qemu-0.9.0/debian/README.Debian @@ -0,0 +1,13 @@ +qemu for Debian +--------------- + +The qemu debian package includes a simple script called qemu-make-debian-root +under /usr/sbin, which uses debootstrap to create an image suitable for qemu +with a fresh Debian installation inside. + +If you just want a test system, not wanting to go through any installation +process, that might be just ideal. Take a look at the manual page +qemu-make-debian-root (8) for further usage instructions. + + -- Guilherme de S. Pastore , Sun May 15 09:49:11 2005 + --- qemu-0.9.0.orig/debian/compat +++ qemu-0.9.0/debian/compat @@ -0,0 +1 @@ +5 --- qemu-0.9.0.orig/debian/TODO +++ qemu-0.9.0/debian/TODO @@ -0,0 +1,9 @@ +Just a small list of things not to forget for any new (upstream) release: + +* Make sure it works with the BIOS files in testing or otherwise raise the + dependency versions + +* If adding support for a new (host, not guest) arch: + Make sure to add it to the gpm Build-Dep (if that arch has gpm of course) + until Bug#267174 is solved. + --- qemu-0.9.0.orig/debian/links +++ qemu-0.9.0/debian/links @@ -0,0 +1,19 @@ +usr/share/man/man1/qemu-user.1 usr/share/man/man1/qemu-arm.1 +usr/share/man/man1/qemu-user.1 usr/share/man/man1/qemu-armeb.1 +usr/share/man/man1/qemu-user.1 usr/share/man/man1/qemu-i386.1 +usr/share/man/man1/qemu-user.1 usr/share/man/man1/qemu-m68k.1 +usr/share/man/man1/qemu-user.1 usr/share/man/man1/qemu-mips.1 +usr/share/man/man1/qemu-user.1 usr/share/man/man1/qemu-mipsel.1 +usr/share/man/man1/qemu-user.1 usr/share/man/man1/qemu-ppc.1 +usr/share/man/man1/qemu-user.1 usr/share/man/man1/qemu-sparc.1 +usr/share/man/man1/qemu.1 usr/share/man/man1/qemu-system-arm.1 +usr/share/man/man1/qemu.1 usr/share/man/man1/qemu-system-x86_64.1 +usr/share/man/man1/qemu.1 usr/share/man/man1/qemu-system-sparc.1 +usr/share/man/man1/qemu.1 usr/share/man/man1/qemu-system-ppc.1 +usr/share/man/man1/qemu.1 usr/share/man/man1/qemu-system-mips.1 +usr/share/man/man1/qemu.1 usr/share/man/man1/qemu-system-mipsel.1 +usr/share/bochs/BIOS-bochs-latest usr/share/qemu/bios.bin +usr/share/vgabios/vgabios.bin usr/share/qemu/vgabios.bin +usr/share/vgabios/vgabios.cirrus.bin usr/share/qemu/vgabios-cirrus.bin +usr/share/proll/proll-qemu.elf usr/share/qemu/proll.elf +usr/share/openhackware/ppc_rom.bin usr/share/qemu/ppc_rom.bin --- qemu-0.9.0.orig/debian/patches/37_syscall_mount.patch +++ qemu-0.9.0/debian/patches/37_syscall_mount.patch @@ -0,0 +1,16 @@ +#DPATCHLEVEL=0 +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2006-11-05 07:07:44.000000000 +0200 ++++ linux-user/syscall.c 2006-11-05 07:07:48.000000000 +0200 +@@ -2200,7 +2200,9 @@ long do_syscall(void *cpu_env, int num, + break; + case TARGET_NR_mount: + /* need to look at the data field */ +- goto unimplemented; ++ ret = get_errno(mount((const char *)arg1, (const char *)arg2, ++ (const char *)arg3, (unsigned long)arg4, (const void *)arg5)); ++ break; + case TARGET_NR_umount: + p = lock_user_string(arg1); + ret = get_errno(umount(p)); --- qemu-0.9.0.orig/debian/patches/10_signal_jobs.patch +++ qemu-0.9.0/debian/patches/10_signal_jobs.patch @@ -0,0 +1,25 @@ +#DPATCHLEVEL=0 +Index: linux-user/signal.c +=================================================================== +RCS file: /cvsroot/qemu/qemu/linux-user/signal.c,v +retrieving revision 1.27 +diff -u -r1.27 signal.c +--- linux-user/signal.c 30 Jan 2005 22:59:18 -0000 1.27 ++++ linux-user/signal.c 22 Mar 2005 12:42:30 -0000 +@@ -341,10 +341,15 @@ + k = &sigact_table[sig - 1]; + handler = k->sa._sa_handler; + if (handler == TARGET_SIG_DFL) { ++ if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) { ++ kill(getpid(),SIGSTOP); ++ return 0; ++ } else + /* default handler : ignore some signal. The other are fatal */ + if (sig != TARGET_SIGCHLD && + sig != TARGET_SIGURG && +- sig != TARGET_SIGWINCH) { ++ sig != TARGET_SIGWINCH && ++ sig != TARGET_SIGCONT) { + force_sig(sig); + } else { + return 0; /* indicate ignored */ --- qemu-0.9.0.orig/debian/patches/55_unmux_socketcall.patch +++ qemu-0.9.0/debian/patches/55_unmux_socketcall.patch @@ -0,0 +1,35 @@ +Index: linux-user/arm/syscall_nr.h +=================================================================== +--- linux-user/arm/syscall_nr.h.orig 2007-02-07 10:48:43.000000000 +0200 ++++ linux-user/arm/syscall_nr.h 2007-02-07 10:56:55.000000000 +0200 +@@ -256,9 +256,8 @@ + #define TARGET_NR_epoll_ctl (251) + #define TARGET_NR_epoll_wait (252) + #define TARGET_NR_remap_file_pages (253) +- /* 254 for set_thread_area */ +- /* 255 for get_thread_area */ +- /* 256 for set_tid_address */ ++#define TARGET_NR_set_thread_area (254) ++#define TARGET_NR_get_thread_area (255) + #define TARGET_NR_set_tid_address 256 + #define TARGET_NR_timer_create 257 + #define TARGET_NR_timer_settime 258 +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2007-02-07 10:50:45.000000000 +0200 ++++ linux-user/syscall.c 2007-02-07 10:53:37.000000000 +0200 +@@ -4171,6 +4171,14 @@ long do_syscall(void *cpu_env, int num, + case TARGET_NR_getdomainname: + goto unimplemented_nowarn; + #endif ++#ifdef TARGET_NR_futex ++ case TARGET_NR_futex: ++ goto unimplemented_nowarn; ++#endif ++#ifdef TARGET_NR_set_tid_address ++ case TARGET_NR_set_tid_address: ++ goto unimplemented_nowarn; ++#endif + #ifdef TARGET_NR_clock_gettime + case TARGET_NR_clock_gettime: + { --- qemu-0.9.0.orig/debian/patches/80_ui_curses.patch +++ qemu-0.9.0/debian/patches/80_ui_curses.patch @@ -0,0 +1,2058 @@ +Index: Makefile.target +=================================================================== +--- Makefile.target.orig 2007-02-07 12:11:38.000000000 +0200 ++++ Makefile.target 2007-02-07 12:11:39.000000000 +0200 +@@ -413,6 +413,9 @@ endif + ifdef CONFIG_SDL + VL_OBJS+=sdl.o x_keymap.o + endif ++ifdef CONFIG_CURSES ++VL_OBJS+=curses.o ++endif + VL_OBJS+=vnc.o + ifdef CONFIG_COCOA + VL_OBJS+=cocoa.o +@@ -463,7 +466,8 @@ SDL_LIBS := $(filter-out -mwindows, $(SD + endif + + $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a +- $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) ++ $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) \ ++ $(COCOA_LIBS) $(CURSES_LIBS) $(VL_LIBS) + + cocoa.o: cocoa.m + $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< +@@ -477,6 +481,9 @@ vnc.o: vnc.c keymaps.c sdl_keysym.h vnch + sdlaudio.o: sdlaudio.c + $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< + ++curses.o: curses.c keymaps.c curses_keys.h ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(CURSES_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< ++ + depend: $(SRCS) + $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend + +Index: cocoa.m +=================================================================== +--- cocoa.m.orig 2007-02-06 01:01:54.000000000 +0200 ++++ cocoa.m 2007-02-07 12:11:39.000000000 +0200 +@@ -365,7 +365,7 @@ static void cocoa_refresh(DisplayState * + pool = [ [ NSAutoreleasePool alloc ] init ]; + distantPast = [ NSDate distantPast ]; + +- vga_hw_update(); ++ video_hw_update(); + + do { + event = [ NSApp nextEventMatchingMask:NSAnyEventMask untilDate:distantPast +Index: configure +=================================================================== +--- configure.orig 2007-02-07 12:11:39.000000000 +0200 ++++ configure 2007-02-07 12:11:39.000000000 +0200 +@@ -263,6 +263,8 @@ for opt do + ;; + --disable-nptl) nptl="no" + ;; ++ --disable-curses) curses="no" ++ ;; + esac + done + +@@ -583,6 +585,24 @@ EOF + fi + fi + ++########################################## ++# curses probe ++ ++if test -z "$curses" ; then ++ ++curses=no ++ ++cat > $TMPC << EOF ++#include ++int main( void ) { return curses_version (); } ++EOF ++ ++if $cc -o $TMPE -lcurses $TMPC 2> /dev/null ; then ++curses=yes ++fi ++ ++fi # -z $curses ++ + # Check if tools are available to build documentation. + if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then + build_docs="yes" +@@ -631,6 +651,7 @@ echo "SDL support $sdl" + if test "$sdl" != "no" ; then + echo "SDL static link $sdl_static" + fi ++echo "curses support $curses" + echo "mingw32 support $mingw32" + echo "Adlib support $adlib" + echo "CoreAudio support $coreaudio" +@@ -852,7 +873,8 @@ if test "$target_user_only" = "no" -a "$ + -a "$sdl" = "no" -a "$cocoa" = "no" ; then + echo "ERROR: QEMU requires SDL or Cocoa for graphical output" + echo "To build QEMU without graphical output configure with --disable-gfx-check" +- echo "Note that this will disable all output from the virtual graphics card." ++ echo "Note that this will disable all output from the virtual graphics card" ++ echo "except for the curses interface." + exit 1; + fi + +@@ -1009,6 +1031,15 @@ if test "$cocoa" = "yes" ; then + echo "CONFIG_COCOA=yes" >> $config_mak + fi + ++if test "$curses" = "yes" ; then ++ if test "$target_cpu" != "sparc" -a "$target_cpu" != "arm" ; then ++ echo "#define CONFIG_CURSES 1" >> $config_h ++ echo "CONFIG_CURSES=yes" >> $config_mak ++ echo "CURSES_LIBS=-lcurses" >> $config_mak ++ echo "CURSES_CFLAGS=" >> $config_mak ++ fi ++fi ++ + done # for target in $targets + + # build tree in object directory if source path is different from current one +Index: console.c +=================================================================== +--- console.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ console.c 2007-02-07 12:11:39.000000000 +0200 +@@ -110,9 +110,10 @@ struct TextConsole { + int text_console; /* true if text console */ + DisplayState *ds; + /* Graphic console state. */ +- vga_hw_update_ptr hw_update; +- vga_hw_invalidate_ptr hw_invalidate; +- vga_hw_screen_dump_ptr hw_screen_dump; ++ video_hw_update_ptr hw_update; ++ video_hw_invalidate_ptr hw_invalidate; ++ video_hw_screen_dump_ptr hw_screen_dump; ++ video_hw_text_update_ptr hw_text_update; + void *hw; + + int g_width, g_height; +@@ -127,6 +128,7 @@ struct TextConsole { + TextAttributes t_attrib_default; /* default text attributes */ + TextAttributes t_attrib; /* currently active text attributes */ + TextCell *cells; ++ int text_invalidate; + + enum TTYState state; + int esc_params[MAX_ESC_PARAMS]; +@@ -143,19 +145,19 @@ static TextConsole *active_console; + static TextConsole *consoles[MAX_CONSOLES]; + static int nb_consoles = 0; + +-void vga_hw_update(void) ++void video_hw_update(void) + { + if (active_console && active_console->hw_update) + active_console->hw_update(active_console->hw); + } + +-void vga_hw_invalidate(void) ++void video_hw_invalidate(void) + { + if (active_console->hw_invalidate) + active_console->hw_invalidate(active_console->hw); + } + +-void vga_hw_screen_dump(const char *filename) ++void video_hw_screen_dump(const char *filename) + { + /* There is currently no was of specifying which screen we want to dump, + so always dump the dirst one. */ +@@ -163,6 +165,14 @@ void vga_hw_screen_dump(const char *file + consoles[0]->hw_screen_dump(consoles[0]->hw, filename); + } + ++void video_hw_text_update(uint8_t *chardata, ++ void (*dpy_cursor)(DisplayState *s, int x, int y)) ++{ ++ if (active_console->hw_text_update) ++ active_console->hw_text_update( ++ active_console->hw, chardata, dpy_cursor); ++} ++ + /* convert a RGBA color to a color index usable in graphic primitives */ + static unsigned int vga_get_color(DisplayState *ds, unsigned int rgba) + { +@@ -513,6 +523,11 @@ static void update_xy(TextConsole *s, in + int y1, y2; + + if (s == active_console) { ++ if (!s->ds->depth) { ++ s->text_invalidate = 1; ++ return; ++ } ++ + y1 = (s->y_base + y) % s->total_height; + y2 = y1 - s->y_displayed; + if (y2 < 0) +@@ -533,6 +548,11 @@ static void console_show_cursor(TextCons + int y, y1; + + if (s == active_console) { ++ if (!s->ds->depth) { ++ s->text_invalidate = 1; ++ return; ++ } ++ + y1 = (s->y_base + s->y) % s->total_height; + y = y1 - s->y_displayed; + if (y < 0) +@@ -561,6 +581,11 @@ static void console_refresh(TextConsole + if (s != active_console) + return; + ++ if (!s->ds->depth) { ++ s->text_invalidate = 1; ++ return; ++ } ++ + vga_fill_rect(s->ds, 0, 0, s->ds->width, s->ds->height, + color_table[0][COLOR_BLACK]); + y1 = s->y_displayed; +@@ -637,6 +662,11 @@ static void console_put_lf(TextConsole * + c++; + } + if (s == active_console && s->y_displayed == s->y_base) { ++ if (!s->ds->depth) { ++ s->text_invalidate = 1; ++ return; ++ } ++ + vga_bitblt(s->ds, 0, FONT_HEIGHT, 0, 0, + s->width * FONT_WIDTH, + (s->height - 1) * FONT_HEIGHT); +@@ -991,17 +1021,7 @@ void console_select(unsigned int index) + s = consoles[index]; + if (s) { + active_console = s; +- if (s->text_console) { +- if (s->g_width != s->ds->width || +- s->g_height != s->ds->height) { +- s->g_width = s->ds->width; +- s->g_height = s->ds->height; +- text_console_resize(s); +- } +- console_refresh(s); +- } else { +- vga_hw_invalidate(); +- } ++ video_hw_invalidate(); + } + } + +@@ -1105,6 +1125,41 @@ void kbd_put_keysym(int keysym) + } + } + ++static void text_console_invalidate(void *opaque) ++{ ++ TextConsole *s = (TextConsole *) opaque; ++ ++ if (s->g_width != s->ds->width || ++ s->g_height != s->ds->height) { ++ s->g_width = s->ds->width; ++ s->g_height = s->ds->height; ++ text_console_resize(s); ++ } ++ console_refresh(s); ++} ++ ++static void text_console_update(void *opaque, uint8_t *chardata, ++ void (*dpy_cursor)(DisplayState *s, int x, int y)) ++{ ++ TextConsole *s = (TextConsole *) opaque; ++ int i, j, src; ++ uint32_t *dest = (uint32_t *) chardata; ++ ++ if (!s->text_invalidate) ++ return; ++ s->text_invalidate = 0; ++ ++ src = s->y_base * s->width; ++ for (i = 0; i < s->height; i ++) ++ for (j = 0; j < s->width; j ++, src ++) ++ *dest ++ = s->cells[src].ch | ++ (s->cells[src].t_attrib.fgcol << 12) | ++ (s->cells[src].t_attrib.bgcol << 8) | ++ (s->cells[src].t_attrib.bold << 21); ++ dpy_update(s->ds, 0, 0, s->width, s->height); ++ dpy_cursor(s->ds, s->x, s->y); ++} ++ + static TextConsole *new_console(DisplayState *ds, int text) + { + TextConsole *s; +@@ -1134,9 +1189,10 @@ static TextConsole *new_console(DisplayS + return s; + } + +-TextConsole *graphic_console_init(DisplayState *ds, vga_hw_update_ptr update, +- vga_hw_invalidate_ptr invalidate, +- vga_hw_screen_dump_ptr screen_dump, ++TextConsole *graphic_console_init(DisplayState *ds, video_hw_update_ptr update, ++ video_hw_invalidate_ptr invalidate, ++ video_hw_screen_dump_ptr screen_dump, ++ video_hw_text_update_ptr text_update, + void *opaque) + { + TextConsole *s; +@@ -1147,20 +1203,31 @@ TextConsole *graphic_console_init(Displa + s->hw_update = update; + s->hw_invalidate = invalidate; + s->hw_screen_dump = screen_dump; ++ s->hw_text_update = text_update; + s->hw = opaque; + return s; + } + + int is_graphic_console(void) + { +- return !active_console->text_console; ++ return active_console && !active_console->text_console; ++} ++ ++void console_color_init(DisplayState *ds) ++{ ++ int i,j; ++ for(j = 0; j < 2; j++) { ++ for(i = 0; i < 8; i++) { ++ color_table[j][i] = col_expand(ds, ++ vga_get_color(ds, color_table_rgb[j][i])); ++ } ++ } + } + + CharDriverState *text_console_init(DisplayState *ds) + { + CharDriverState *chr; + TextConsole *s; +- int i,j; + static int color_inited; + + chr = qemu_mallocz(sizeof(CharDriverState)); +@@ -1182,12 +1249,7 @@ CharDriverState *text_console_init(Displ + + if (!color_inited) { + color_inited = 1; +- for(j = 0; j < 2; j++) { +- for(i = 0; i < 8; i++) { +- color_table[j][i] = col_expand(s->ds, +- vga_get_color(s->ds, color_table_rgb[j][i])); +- } +- } ++ console_color_init(s->ds); + } + s->y_displayed = 0; + s->y_base = 0; +@@ -1197,6 +1259,10 @@ CharDriverState *text_console_init(Displ + s->g_width = s->ds->width; + s->g_height = s->ds->height; + ++ s->hw_invalidate = text_console_invalidate; ++ s->hw_text_update = text_console_update; ++ s->hw = s; ++ + /* Set text attribute defaults */ + s->t_attrib_default.bold = 0; + s->t_attrib_default.uline = 0; +Index: curses.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ curses.c 2007-02-07 12:11:39.000000000 +0200 +@@ -0,0 +1,363 @@ ++/* ++ * QEMU curses/ncurses display driver ++ * ++ * Copyright (c) 2005 Andrzej Zaborowski ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ */ ++#include "vl.h" ++ ++#include ++ ++#ifndef _WIN32 ++#include ++#include ++#include ++#endif ++ ++#define FONT_HEIGHT 16 ++#define FONT_WIDTH 8 ++ ++static char screen[160 * 100]; ++static WINDOW *screenpad = NULL; ++static int width, height, gwidth, gheight, invalidate; ++static int px, py, sminx, sminy, smaxx, smaxy; ++ ++static void curses_update(DisplayState *ds, int x, int y, int w, int h) ++{ ++ chtype *line; ++ ++ line = ((chtype *) screen) + y * width; ++ for (h += y; y < h; y ++, line += width) ++ mvwaddchnstr(screenpad, y, 0, line, width); ++ ++ pnoutrefresh(screenpad, py, px, sminy, sminx, smaxy - 1, smaxx - 1); ++ refresh(); ++} ++ ++static void curses_calc_pad(void) ++{ ++ if (is_graphic_console()) { ++ width = gwidth; ++ height = gheight; ++ } else { ++ width = COLS; ++ height = LINES; ++ } ++ ++ if (screenpad) ++ delwin(screenpad); ++ ++ clear(); ++ refresh(); ++ ++ screenpad = newpad(height, width); ++ ++ if (width > COLS) { ++ px = (width - COLS) / 2; ++ sminx = 0; ++ smaxx = COLS; ++ } else { ++ px = 0; ++ sminx = (COLS - width) / 2; ++ smaxx = sminx + width; ++ } ++ ++ if (height > LINES) { ++ py = (height - LINES) / 2; ++ sminy = 0; ++ smaxy = LINES; ++ } else { ++ py = 0; ++ sminy = (LINES - height) / 2; ++ smaxy = sminy + height; ++ } ++} ++ ++static void curses_resize(DisplayState *ds, int w, int h) ++{ ++ if (w == gwidth && h == gheight) ++ return; ++ ++ gwidth = w; ++ gheight = h; ++ ++ curses_calc_pad(); ++} ++ ++#ifndef _WIN32 ++#ifdef SIGWINCH ++static void curses_winch_handler(int signum) ++{ ++ struct winsize { ++ unsigned short ws_row; ++ unsigned short ws_col; ++ unsigned short ws_xpixel; /* unused */ ++ unsigned short ws_ypixel; /* unused */ ++ } ws; ++ ++ /* terminal size changed */ ++ if (ioctl(1, TIOCGWINSZ, &ws) == -1) ++ return; ++ ++ resize_term(ws.ws_row, ws.ws_col); ++ curses_calc_pad(); ++ invalidate = 1; ++ ++ /* some systems require this */ ++ signal(SIGWINCH, curses_winch_handler); ++} ++#endif ++#endif ++ ++static void curses_cursor_position(DisplayState *ds, int x, int y) ++{ ++ if (x >= 0) { ++ x = sminx + x - px; ++ y = sminy + y - py; ++ ++ if (x >= 0 && y >= 0 && x < COLS && y < LINES) { ++ move(y, x); ++ curs_set(1); ++ /* it seems that curs_set(1) must always be called before ++ * curs_set(2) for the latter to have effect */ ++ if (!is_graphic_console()) ++ curs_set(2); ++ return; ++ } ++ } ++ ++ curs_set(0); ++} ++ ++/* generic keyboard conversion */ ++ ++#include "curses_keys.h" ++#include "keymaps.c" ++ ++static kbd_layout_t *kbd_layout = 0; ++static int keycode2keysym[CURSES_KEYS]; ++ ++static void curses_refresh(DisplayState *ds) ++{ ++ int chr, nextchr, keysym, keycode; ++ ++ if (invalidate) { ++ clear(); ++ refresh(); ++ curses_calc_pad(); ++ ds->width = FONT_WIDTH * width; ++ ds->height = FONT_HEIGHT * height; ++ video_hw_invalidate(); ++ invalidate = 0; ++ } ++ ++ video_hw_text_update(screen, curses_cursor_position); ++ ++ nextchr = ERR; ++ while (1) { ++ /* while there are any pending key strokes to process */ ++ if (nextchr == ERR) ++ chr = getch(); ++ else { ++ chr = nextchr; ++ nextchr = ERR; ++ } ++ ++ if (chr == ERR) ++ break; ++ ++ /* this shouldn't occur when we use a custom SIGWINCH handler */ ++ if (chr == KEY_RESIZE) { ++ clear(); ++ refresh(); ++ curses_calc_pad(); ++ curses_update(ds, 0, 0, width, height); ++ ds->width = FONT_WIDTH * width; ++ ds->height = FONT_HEIGHT * height; ++ continue; ++ } ++ ++ keycode = curses2keycode[chr]; ++ if (keycode == -1) ++ continue; ++ ++ /* alt key */ ++ if (keycode == 1) { ++ nextchr = getch(); ++ ++ if (nextchr != ERR) { ++ keycode = curses2keycode[nextchr]; ++ nextchr = ERR; ++ if (keycode == -1) ++ continue; ++ ++ keycode |= ALT; ++ ++ /* process keys reserved for qemu */ ++ if (keycode >= QEMU_KEY_CONSOLE0 && ++ keycode < QEMU_KEY_CONSOLE0 + 9) { ++ erase(); ++ wnoutrefresh(stdscr); ++ console_select(keycode - QEMU_KEY_CONSOLE0); ++ ++ invalidate = 1; ++ continue; ++ } ++ } ++ } ++ ++ if (kbd_layout && !(keycode & GREY)) { ++ keysym = keycode2keysym[keycode & KEY_MASK]; ++ if (keysym == -1) ++ keysym = chr; ++ ++ keycode &= ~KEY_MASK; ++ keycode |= keysym2scancode(kbd_layout, keysym); ++ } ++ ++ if (is_graphic_console()) { ++ /* since terminals don't know about key press and release ++ * events, we need to emit both for each key received */ ++ if (keycode & SHIFT) ++ kbd_put_keycode(SHIFT_CODE); ++ if (keycode & CNTRL) ++ kbd_put_keycode(CNTRL_CODE); ++ if (keycode & ALT) ++ kbd_put_keycode(ALT_CODE); ++ if (keycode & GREY) ++ kbd_put_keycode(GREY_CODE); ++ kbd_put_keycode(keycode & KEY_MASK); ++ if (keycode & GREY) ++ kbd_put_keycode(GREY_CODE); ++ kbd_put_keycode((keycode & KEY_MASK) | KEY_RELEASE); ++ if (keycode & ALT) ++ kbd_put_keycode(ALT_CODE | KEY_RELEASE); ++ if (keycode & CNTRL) ++ kbd_put_keycode(CNTRL_CODE | KEY_RELEASE); ++ if (keycode & SHIFT) ++ kbd_put_keycode(SHIFT_CODE | KEY_RELEASE); ++ } else { ++ keysym = curses2keysym[chr]; ++ if (keysym == -1) ++ keysym = chr; ++ ++ kbd_put_keysym(keysym); ++ } ++ } ++} ++ ++static void curses_cleanup(void *opaque) ++{ ++ endwin(); ++} ++ ++static void curses_setup(void) ++{ ++ int i, colour_default[8] = { ++ COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, ++ COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, ++ }; ++ ++ /* input as raw as possible, let everything be interpreted ++ * by the guest system */ ++ initscr(); noecho(); intrflush(stdscr, FALSE); ++ nonl(); keypad(stdscr, TRUE); start_color(); ++ raw(); scrollok(stdscr, FALSE); ++ ++ for (i = 0; i < 64; i ++) ++ init_pair(i, colour_default[i & 7], colour_default[i >> 3]); ++} ++ ++static void curses_keyboard_setup(void) ++{ ++ int i, keycode, keysym; ++ ++#if defined(__APPLE__) ++ /* always use generic keymaps */ ++ if (!keyboard_layout) ++ keyboard_layout = "en-us"; ++#endif ++ if(keyboard_layout) { ++ kbd_layout = init_keyboard_layout(keyboard_layout); ++ if (!kbd_layout) ++ exit(1); ++ } ++ ++ for (i = 0; i < CURSES_KEYS; i ++) ++ keycode2keysym[i] = -1; ++ ++ for (i = 0; i < CURSES_KEYS; i ++) { ++ if (curses2keycode[i] == -1) ++ continue; ++ ++ keycode = curses2keycode[i] & KEY_MASK; ++ if (keycode2keysym[keycode] >= 0) ++ continue; ++ ++ for (keysym = 0; keysym < CURSES_KEYS; keysym ++) ++ if (curses2keycode[keysym] == keycode) { ++ keycode2keysym[keycode] = keysym; ++ break; ++ } ++ ++ if (keysym >= CURSES_KEYS) ++ keycode2keysym[keycode] = i; ++ } ++} ++ ++void curses_display_init(DisplayState *ds, int full_screen) ++{ ++#ifndef _WIN32 ++ if (!isatty(1)) { ++ fprintf(stderr, "We need a terminal output\n"); ++ exit(1); ++ } ++#endif ++ ++ curses_setup(); ++ curses_keyboard_setup(); ++ ++#ifndef _WIN32 ++ signal(SIGINT, SIG_DFL); ++ signal(SIGQUIT, SIG_DFL); ++#ifdef SIGWINCH ++ /* some curses implementations provide a handler, but we ++ * want to be sure this is handled regardless of the library */ ++ signal(SIGWINCH, curses_winch_handler); ++#endif ++#endif ++ ++ ds->data = screen; ++ ds->linesize = 0; ++ ds->depth = 0; ++ ds->width = 640; ++ ds->height = 400; ++ ds->dpy_update = curses_update; ++ ds->dpy_resize = curses_resize; ++ ds->dpy_refresh = curses_refresh; ++ ++ invalidate = 0; ++ ++ /* Standard VGA initial text mode dimensions */ ++ curses_resize(ds, 80, 25); ++ ++ qemu_ui_register_cleanup(0, curses_cleanup); ++} ++/* vim: set ai ts=4 sw=4 et: */ +Index: curses_keys.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ curses_keys.h 2007-02-07 12:11:39.000000000 +0200 +@@ -0,0 +1,485 @@ ++/* ++ * Keycode and keysyms conversion tables for curses ++ * ++ * Copyright (c) 2005 Andrzej Zaborowski ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ */ ++#define KEY_RELEASE 0x80 ++#define KEY_MASK 0x7f ++#define SHIFT_CODE 0x2a ++#define SHIFT 0x0080 ++#define GREY_CODE 0xe0 ++#define GREY 0x0100 ++#define CNTRL_CODE 0x1d ++#define CNTRL 0x0200 ++#define ALT_CODE 0x38 ++#define ALT 0x0400 ++ ++/* curses won't detect a Control + Alt + 1, so use Alt + 1 */ ++#define QEMU_KEY_CONSOLE0 (2 | ALT) /* (curses2keycode['1'] | ALT) */ ++ ++#define CURSES_KEYS KEY_MAX /* KEY_MAX defined in */ ++ ++int curses2keycode[CURSES_KEYS] = { ++ [0 ... (CURSES_KEYS - 1)] = -1, ++ ++ [0x01b] = 1, /* Escape */ ++ ['1'] = 2, ++ ['2'] = 3, ++ ['3'] = 4, ++ ['4'] = 5, ++ ['5'] = 6, ++ ['6'] = 7, ++ ['7'] = 8, ++ ['8'] = 9, ++ ['9'] = 10, ++ ['0'] = 11, ++ ['-'] = 12, ++ ['='] = 13, ++ [0x07f] = 14, /* Backspace */ ++ [0x107] = 14, /* Backspace */ ++ ++ ['\t'] = 15, /* Tab */ ++ ['q'] = 16, ++ ['w'] = 17, ++ ['e'] = 18, ++ ['r'] = 19, ++ ['t'] = 20, ++ ['y'] = 21, ++ ['u'] = 22, ++ ['i'] = 23, ++ ['o'] = 24, ++ ['p'] = 25, ++ ['['] = 26, ++ [']'] = 27, ++ ['\n'] = 28, /* Return */ ++ ['\r'] = 28, /* Return */ ++ [0x157] = 28, /* Return */ ++ ++ ['a'] = 30, ++ ['s'] = 31, ++ ['d'] = 32, ++ ['f'] = 33, ++ ['g'] = 34, ++ ['h'] = 35, ++ ['j'] = 36, ++ ['k'] = 37, ++ ['l'] = 38, ++ [';'] = 39, ++ ['\''] = 40, /* Single quote */ ++ ['`'] = 41, ++ ['\\'] = 43, /* Backslash */ ++ ++ ['z'] = 44, ++ ['x'] = 45, ++ ['c'] = 46, ++ ['v'] = 47, ++ ['b'] = 48, ++ ['n'] = 49, ++ ['m'] = 50, ++ [','] = 51, ++ ['.'] = 52, ++ ['/'] = 53, ++ ++ [' '] = 57, ++ ++ [0x109] = 59, /* Function Key 1 */ ++ [0x10a] = 60, /* Function Key 2 */ ++ [0x10b] = 61, /* Function Key 3 */ ++ [0x10c] = 62, /* Function Key 4 */ ++ [0x10d] = 63, /* Function Key 5 */ ++ [0x10e] = 64, /* Function Key 6 */ ++ [0x10f] = 65, /* Function Key 7 */ ++ [0x110] = 66, /* Function Key 8 */ ++ [0x111] = 67, /* Function Key 9 */ ++ [0x112] = 68, /* Function Key 10 */ ++ [0x113] = 87, /* Function Key 11 */ ++ [0x114] = 88, /* Function Key 12 */ ++ ++ [0x106] = 71 | GREY, /* Home */ ++ [0x103] = 72 | GREY, /* Up Arrow */ ++ [0x153] = 73 | GREY, /* Page Up */ ++ [0x104] = 75 | GREY, /* Left Arrow */ ++ [0x105] = 77 | GREY, /* Right Arrow */ ++ [0x168] = 79 | GREY, /* End */ ++ [0x102] = 80 | GREY, /* Down Arrow */ ++ [0x152] = 81 | GREY, /* Page Down */ ++ [0x14b] = 82 | GREY, /* Insert */ ++ [0x14a] = 83 | GREY, /* Delete */ ++ ++ ['!'] = 2 | SHIFT, ++ ['@'] = 3 | SHIFT, ++ ['#'] = 4 | SHIFT, ++ ['$'] = 5 | SHIFT, ++ ['%'] = 6 | SHIFT, ++ ['^'] = 7 | SHIFT, ++ ['&'] = 8 | SHIFT, ++ ['*'] = 9 | SHIFT, ++ ['('] = 10 | SHIFT, ++ [')'] = 11 | SHIFT, ++ ['_'] = 12 | SHIFT, ++ ['+'] = 13 | SHIFT, ++ ++ [0x161] = 15 | SHIFT, /* Shift + Tab */ ++ ['Q'] = 16 | SHIFT, ++ ['W'] = 17 | SHIFT, ++ ['E'] = 18 | SHIFT, ++ ['R'] = 19 | SHIFT, ++ ['T'] = 20 | SHIFT, ++ ['Y'] = 21 | SHIFT, ++ ['U'] = 22 | SHIFT, ++ ['I'] = 23 | SHIFT, ++ ['O'] = 24 | SHIFT, ++ ['P'] = 25 | SHIFT, ++ ['{'] = 26 | SHIFT, ++ ['}'] = 27 | SHIFT, ++ ++ ['A'] = 30 | SHIFT, ++ ['S'] = 31 | SHIFT, ++ ['D'] = 32 | SHIFT, ++ ['F'] = 33 | SHIFT, ++ ['G'] = 34 | SHIFT, ++ ['H'] = 35 | SHIFT, ++ ['J'] = 36 | SHIFT, ++ ['K'] = 37 | SHIFT, ++ ['L'] = 38 | SHIFT, ++ [':'] = 39 | SHIFT, ++ ['"'] = 40 | SHIFT, ++ ['~'] = 41 | SHIFT, ++ ['|'] = 43 | SHIFT, ++ ++ ['Z'] = 44 | SHIFT, ++ ['X'] = 45 | SHIFT, ++ ['C'] = 46 | SHIFT, ++ ['V'] = 47 | SHIFT, ++ ['B'] = 48 | SHIFT, ++ ['N'] = 49 | SHIFT, ++ ['M'] = 50 | SHIFT, ++ ['<'] = 51 | SHIFT, ++ ['>'] = 52 | SHIFT, ++ ['?'] = 53 | SHIFT, ++ ++ [0x115] = 59 | SHIFT, /* Shift + Function Key 1 */ ++ [0x116] = 60 | SHIFT, /* Shift + Function Key 2 */ ++ [0x117] = 61 | SHIFT, /* Shift + Function Key 3 */ ++ [0x118] = 62 | SHIFT, /* Shift + Function Key 4 */ ++ [0x119] = 63 | SHIFT, /* Shift + Function Key 5 */ ++ [0x11a] = 64 | SHIFT, /* Shift + Function Key 6 */ ++ [0x11b] = 65 | SHIFT, /* Shift + Function Key 7 */ ++ [0x11c] = 66 | SHIFT, /* Shift + Function Key 8 */ ++ ++ [0x011] = 16 | CNTRL, /* Control + q */ ++ [0x017] = 17 | CNTRL, /* Control + w */ ++ [0x005] = 18 | CNTRL, /* Control + e */ ++ [0x012] = 19 | CNTRL, /* Control + r */ ++ [0x014] = 20 | CNTRL, /* Control + t */ ++ [0x019] = 21 | CNTRL, /* Control + y */ ++ [0x015] = 22 | CNTRL, /* Control + u */ ++ [0x009] = 23 | CNTRL, /* Control + i */ ++ [0x00f] = 24 | CNTRL, /* Control + o */ ++ [0x010] = 25 | CNTRL, /* Control + p */ ++ ++ [0x001] = 30 | CNTRL, /* Control + a */ ++ [0x013] = 31 | CNTRL, /* Control + s */ ++ [0x014] = 32 | CNTRL, /* Control + d */ ++ [0x006] = 33 | CNTRL, /* Control + f */ ++ [0x007] = 34 | CNTRL, /* Control + g */ ++ [0x008] = 35 | CNTRL, /* Control + h */ ++ [0x00a] = 36 | CNTRL, /* Control + j */ ++ [0x00b] = 37 | CNTRL, /* Control + k */ ++ [0x00c] = 38 | CNTRL, /* Control + l */ ++ ++ [0x01a] = 44 | CNTRL, /* Control + z */ ++ [0x018] = 45 | CNTRL, /* Control + x */ ++ [0x003] = 46 | CNTRL, /* Control + c */ ++ [0x016] = 47 | CNTRL, /* Control + v */ ++ [0x002] = 48 | CNTRL, /* Control + b */ ++ [0x00e] = 49 | CNTRL, /* Control + n */ ++ /* Control + m collides with the keycode for Enter */ ++ ++}; ++ ++int curses2keysym[CURSES_KEYS] = { ++ [0 ... (CURSES_KEYS - 1)] = -1, ++ ++ ['\n'] = '\n', ++ ['\r'] = '\n', ++ ++ [0x07f] = QEMU_KEY_BACKSPACE, ++ ++ [0x102] = QEMU_KEY_DOWN, ++ [0x103] = QEMU_KEY_UP, ++ [0x104] = QEMU_KEY_LEFT, ++ [0x105] = QEMU_KEY_RIGHT, ++ [0x106] = QEMU_KEY_HOME, ++ [0x107] = QEMU_KEY_BACKSPACE, ++ ++ [0x14a] = QEMU_KEY_DELETE, ++ [0x152] = QEMU_KEY_PAGEDOWN, ++ [0x153] = QEMU_KEY_PAGEUP, ++ [0x157] = '\n', ++ [0x168] = QEMU_KEY_END, ++ ++}; ++ ++typedef struct { ++ const char* name; ++ int keysym; ++} name2keysym_t; ++ ++static name2keysym_t name2keysym[] = { ++ /* Plain ASCII */ ++ { "space", 0x020 }, ++ { "exclam", 0x021 }, ++ { "quotedbl", 0x022 }, ++ { "numbersign", 0x023 }, ++ { "dollar", 0x024 }, ++ { "percent", 0x025 }, ++ { "ampersand", 0x026 }, ++ { "apostrophe", 0x027 }, ++ { "parenleft", 0x028 }, ++ { "parenright", 0x029 }, ++ { "asterisk", 0x02a }, ++ { "plus", 0x02b }, ++ { "comma", 0x02c }, ++ { "minus", 0x02d }, ++ { "period", 0x02e }, ++ { "slash", 0x02f }, ++ { "0", 0x030 }, ++ { "1", 0x031 }, ++ { "2", 0x032 }, ++ { "3", 0x033 }, ++ { "4", 0x034 }, ++ { "5", 0x035 }, ++ { "6", 0x036 }, ++ { "7", 0x037 }, ++ { "8", 0x038 }, ++ { "9", 0x039 }, ++ { "colon", 0x03a }, ++ { "semicolon", 0x03b }, ++ { "less", 0x03c }, ++ { "equal", 0x03d }, ++ { "greater", 0x03e }, ++ { "question", 0x03f }, ++ { "at", 0x040 }, ++ { "A", 0x041 }, ++ { "B", 0x042 }, ++ { "C", 0x043 }, ++ { "D", 0x044 }, ++ { "E", 0x045 }, ++ { "F", 0x046 }, ++ { "G", 0x047 }, ++ { "H", 0x048 }, ++ { "I", 0x049 }, ++ { "J", 0x04a }, ++ { "K", 0x04b }, ++ { "L", 0x04c }, ++ { "M", 0x04d }, ++ { "N", 0x04e }, ++ { "O", 0x04f }, ++ { "P", 0x050 }, ++ { "Q", 0x051 }, ++ { "R", 0x052 }, ++ { "S", 0x053 }, ++ { "T", 0x054 }, ++ { "U", 0x055 }, ++ { "V", 0x056 }, ++ { "W", 0x057 }, ++ { "X", 0x058 }, ++ { "Y", 0x059 }, ++ { "Z", 0x05a }, ++ { "bracketleft", 0x05b }, ++ { "backslash", 0x05c }, ++ { "bracketright", 0x05d }, ++ { "asciicircum", 0x05e }, ++ { "underscore", 0x05f }, ++ { "grave", 0x060 }, ++ { "a", 0x061 }, ++ { "b", 0x062 }, ++ { "c", 0x063 }, ++ { "d", 0x064 }, ++ { "e", 0x065 }, ++ { "f", 0x066 }, ++ { "g", 0x067 }, ++ { "h", 0x068 }, ++ { "i", 0x069 }, ++ { "j", 0x06a }, ++ { "k", 0x06b }, ++ { "l", 0x06c }, ++ { "m", 0x06d }, ++ { "n", 0x06e }, ++ { "o", 0x06f }, ++ { "p", 0x070 }, ++ { "q", 0x071 }, ++ { "r", 0x072 }, ++ { "s", 0x073 }, ++ { "t", 0x074 }, ++ { "u", 0x075 }, ++ { "v", 0x076 }, ++ { "w", 0x077 }, ++ { "x", 0x078 }, ++ { "y", 0x079 }, ++ { "z", 0x07a }, ++ { "braceleft", 0x07b }, ++ { "bar", 0x07c }, ++ { "braceright", 0x07d }, ++ { "asciitilde", 0x07e }, ++ ++ /* Latin-1 extensions */ ++ { "nobreakspace", 0x0a0 }, ++ { "exclamdown", 0x0a1 }, ++ { "cent", 0x0a2 }, ++ { "sterling", 0x0a3 }, ++ { "currency", 0x0a4 }, ++ { "yen", 0x0a5 }, ++ { "brokenbar", 0x0a6 }, ++ { "section", 0x0a7 }, ++ { "diaeresis", 0x0a8 }, ++ { "copyright", 0x0a9 }, ++ { "ordfeminine", 0x0aa }, ++ { "guillemotleft", 0x0ab }, ++ { "notsign", 0x0ac }, ++ { "hyphen", 0x0ad }, ++ { "registered", 0x0ae }, ++ { "macron", 0x0af }, ++ { "degree", 0x0b0 }, ++ { "plusminus", 0x0b1 }, ++ { "twosuperior", 0x0b2 }, ++ { "threesuperior", 0x0b3 }, ++ { "acute", 0x0b4 }, ++ { "mu", 0x0b5 }, ++ { "paragraph", 0x0b6 }, ++ { "periodcentered", 0x0b7 }, ++ { "cedilla", 0x0b8 }, ++ { "onesuperior", 0x0b9 }, ++ { "masculine", 0x0ba }, ++ { "guillemotright", 0x0bb }, ++ { "onequarter", 0x0bc }, ++ { "onehalf", 0x0bd }, ++ { "threequarters", 0x0be }, ++ { "questiondown", 0x0bf }, ++ { "Agrave", 0x0c0 }, ++ { "Aacute", 0x0c1 }, ++ { "Acircumflex", 0x0c2 }, ++ { "Atilde", 0x0c3 }, ++ { "Adiaeresis", 0x0c4 }, ++ { "Aring", 0x0c5 }, ++ { "AE", 0x0c6 }, ++ { "Ccedilla", 0x0c7 }, ++ { "Egrave", 0x0c8 }, ++ { "Eacute", 0x0c9 }, ++ { "Ecircumflex", 0x0ca }, ++ { "Ediaeresis", 0x0cb }, ++ { "Igrave", 0x0cc }, ++ { "Iacute", 0x0cd }, ++ { "Icircumflex", 0x0ce }, ++ { "Idiaeresis", 0x0cf }, ++ { "ETH", 0x0d0 }, ++ { "Eth", 0x0d0 }, ++ { "Ntilde", 0x0d1 }, ++ { "Ograve", 0x0d2 }, ++ { "Oacute", 0x0d3 }, ++ { "Ocircumflex", 0x0d4 }, ++ { "Otilde", 0x0d5 }, ++ { "Odiaeresis", 0x0d6 }, ++ { "multiply", 0x0d7 }, ++ { "Ooblique", 0x0d8 }, ++ { "Oslash", 0x0d8 }, ++ { "Ugrave", 0x0d9 }, ++ { "Uacute", 0x0da }, ++ { "Ucircumflex", 0x0db }, ++ { "Udiaeresis", 0x0dc }, ++ { "Yacute", 0x0dd }, ++ { "THORN", 0x0de }, ++ { "Thorn", 0x0de }, ++ { "ssharp", 0x0df }, ++ { "agrave", 0x0e0 }, ++ { "aacute", 0x0e1 }, ++ { "acircumflex", 0x0e2 }, ++ { "atilde", 0x0e3 }, ++ { "adiaeresis", 0x0e4 }, ++ { "aring", 0x0e5 }, ++ { "ae", 0x0e6 }, ++ { "ccedilla", 0x0e7 }, ++ { "egrave", 0x0e8 }, ++ { "eacute", 0x0e9 }, ++ { "ecircumflex", 0x0ea }, ++ { "ediaeresis", 0x0eb }, ++ { "igrave", 0x0ec }, ++ { "iacute", 0x0ed }, ++ { "icircumflex", 0x0ee }, ++ { "idiaeresis", 0x0ef }, ++ { "eth", 0x0f0 }, ++ { "ntilde", 0x0f1 }, ++ { "ograve", 0x0f2 }, ++ { "oacute", 0x0f3 }, ++ { "ocircumflex", 0x0f4 }, ++ { "otilde", 0x0f5 }, ++ { "odiaeresis", 0x0f6 }, ++ { "division", 0x0f7 }, ++ { "oslash", 0x0f8 }, ++ { "ooblique", 0x0f8 }, ++ { "ugrave", 0x0f9 }, ++ { "uacute", 0x0fa }, ++ { "ucircumflex", 0x0fb }, ++ { "udiaeresis", 0x0fc }, ++ { "yacute", 0x0fd }, ++ { "thorn", 0x0fe }, ++ { "ydiaeresis", 0x0ff }, ++ ++ /* Special keys */ ++ { "BackSpace", 0x07f }, ++ { "Tab", '\t' }, ++ { "Return", '\r' }, ++ { "Right", 0x105 }, ++ { "Left", 0x104 }, ++ { "Up", 0x103 }, ++ { "Down", 0x102 }, ++ { "Page_Down", 0x152 }, ++ { "Page_Up", 0x153 }, ++ { "Insert", 0x14b }, ++ { "Delete", 0x14a }, ++ { "Home", 0x106 }, ++ { "End", 0x168 }, ++ { "F1", 0x109 }, ++ { "F2", 0x10a }, ++ { "F3", 0x10b }, ++ { "F4", 0x10c }, ++ { "F5", 0x10d }, ++ { "F6", 0x10e }, ++ { "F7", 0x10f }, ++ { "F8", 0x110 }, ++ { "F9", 0x111 }, ++ { "F10", 0x112 }, ++ { "F11", 0x113 }, ++ { "F12", 0x114 }, ++ { "F13", 0x115 }, ++ { "F14", 0x116 }, ++ { "F15", 0x117 }, ++ { "F16", 0x118 }, ++ { "F17", 0x119 }, ++ { "F18", 0x11a }, ++ { "F19", 0x11b }, ++ { "F20", 0x11c }, ++ { "Escape", 27 }, ++ ++ { 0, 0 }, ++}; ++/* vim: set ai ts=4 sw=4 et: */ +Index: hw/cirrus_vga.c +=================================================================== +--- hw/cirrus_vga.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ hw/cirrus_vga.c 2007-02-07 12:11:39.000000000 +0200 +@@ -689,7 +689,7 @@ static void cirrus_do_copy(CirrusVGAStat + /* we have to flush all pending changes so that the copy + is generated at the appropriate moment in time */ + if (notify) +- vga_hw_update(); ++ video_hw_update(); + + (*s->cirrus_rop) (s, s->vram_ptr + s->cirrus_blt_dstaddr, + s->vram_ptr + s->cirrus_blt_srcaddr, +Index: hw/pl110.c +=================================================================== +--- hw/pl110.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ hw/pl110.c 2007-02-07 12:11:39.000000000 +0200 +@@ -415,7 +415,7 @@ void *pl110_init(DisplayState *ds, uint3 + s->pic = pic; + s->irq = irq; + graphic_console_init(ds, pl110_update_display, pl110_invalidate_display, +- NULL, s); ++ NULL, NULL, s); + /* ??? Save/restore. */ + return s; + } +Index: hw/tcx.c +=================================================================== +--- hw/tcx.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ hw/tcx.c 2007-02-07 12:11:39.000000000 +0200 +@@ -338,7 +338,7 @@ void tcx_init(DisplayState *ds, uint32_t + cpu_register_physical_memory(addr + 0x200000, TCX_DAC_NREGS, io_memory); + + graphic_console_init(s->ds, tcx_update_display, tcx_invalidate_display, +- tcx_screen_dump, s); ++ tcx_screen_dump, 0, s); + register_savevm("tcx", addr, 1, tcx_save, tcx_load, s); + qemu_register_reset(tcx_reset, s); + tcx_reset(s); +Index: hw/vga.c +=================================================================== +--- hw/vga.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ hw/vga.c 2007-02-07 12:11:39.000000000 +0200 +@@ -1621,6 +1621,167 @@ static void vga_reset(VGAState *s) + s->graphic_mode = -1; /* force full update */ + } + ++#define TEXTMODE_X(x) ((x) % width) ++#define TEXTMODE_Y(x) ((x) / width) ++#define VMEM2CHTYPE(v) ((v & 0xff0007ff) | \ ++ ((v & 0x00000800) << 10) | ((v & 0x00007000) >> 1)) ++/* relay text rendering to the display driver ++ * instead of doing a full vga_update_display() */ ++static void vga_update_text(void *opaque, uint8_t *chardata, ++ void (*dpy_cursor)(DisplayState *s, int x, int y)) ++{ ++ VGAState *s = (VGAState *) opaque; ++ int graphic_mode, i, cursor_offset, cursor_visible; ++ int cw, cheight, width, height, size, c_min, c_max; ++ uint32_t *src, *dst, val; ++ char msg_buffer[80]; ++ int full_update; ++ full_update = 0; ++ ++ if (!(s->ar_index & 0x20)) { ++ graphic_mode = GMODE_BLANK; ++ } else { ++ graphic_mode = s->gr[6] & 1; ++ } ++ if (graphic_mode != s->graphic_mode) { ++ s->graphic_mode = graphic_mode; ++ full_update = 1; ++ } ++ if (s->last_width == -1) { ++ s->last_width = 0; ++ full_update = 1; ++ } ++ ++ switch (graphic_mode) { ++ case GMODE_TEXT: ++ /* TODO: update palette */ ++ full_update |= update_basic_params(s); ++ ++ /* total width & height */ ++ cheight = (s->cr[9] & 0x1f) + 1; ++ cw = 8; ++ if (!(s->sr[1] & 0x01)) ++ cw = 9; ++ if (s->sr[1] & 0x08) ++ cw = 16; /* NOTE: no 18 pixel wide */ ++ width = (s->cr[0x01] + 1); ++ if (s->cr[0x06] == 100) { ++ /* ugly hack for CGA 160x100x16 - explain me the logic */ ++ height = 100; ++ } else { ++ height = s->cr[0x12] | ++ ((s->cr[0x07] & 0x02) << 7) | ++ ((s->cr[0x07] & 0x40) << 3); ++ height = (height + 1) / cheight; ++ } ++ ++ size = (height * width); ++ if (size > CH_ATTR_SIZE) { ++ if (!full_update) ++ return; ++ ++ sprintf(msg_buffer, "%i x %i Text mode", width, height); ++ break; ++ } ++ ++ if (width != s->last_width || height != s->last_height || ++ cw != s->last_cw || cheight != s->last_ch) { ++ s->last_scr_width = width * cw; ++ s->last_scr_height = height * cheight; ++ dpy_resize(s->ds, width, height); ++ s->last_width = width; ++ s->last_height = height; ++ s->last_ch = cheight; ++ s->last_cw = cw; ++ full_update = 1; ++ } ++ ++ /* Update "hardware" cursor */ ++ cursor_offset = ((s->cr[0x0e] << 8) | s->cr[0x0f]) - s->start_addr; ++ if (cursor_offset != s->cursor_offset || ++ s->cr[0xa] != s->cursor_start || ++ s->cr[0xb] != s->cursor_end || full_update) { ++ cursor_visible = !(s->cr[0xa] & 0x20); ++ if (cursor_visible && cursor_offset < size && cursor_offset >= 0) ++ dpy_cursor(s->ds, ++ TEXTMODE_X(cursor_offset), ++ TEXTMODE_Y(cursor_offset)); ++ else ++ dpy_cursor(s->ds, -1, -1); ++ s->cursor_offset = cursor_offset; ++ s->cursor_start = s->cr[0xa]; ++ s->cursor_end = s->cr[0xb]; ++ } ++ ++ src = (uint32_t *) s->vram_ptr + s->start_addr; ++ dst = (uint32_t *) chardata; ++ ++ if (full_update) { ++ for (i = 0; i < size; src ++, dst ++, i ++) { ++ val = VMEM2CHTYPE(*src); ++ *dst = val; ++ } ++ ++ dpy_update(s->ds, 0, 0, width, height); ++ } else { ++ c_max = 0; ++ ++ for (i = 0; i < size; src ++, dst ++, i ++) { ++ val = VMEM2CHTYPE(*src); ++ if (*dst != val) { ++ *dst = val; ++ c_max = i; ++ break; ++ } ++ } ++ c_min = i; ++ for (; i < size; src ++, dst ++, i ++) { ++ val = VMEM2CHTYPE(*src); ++ if (*dst != val) { ++ *dst = val; ++ c_max = i; ++ } ++ } ++ ++ if (c_min <= c_max) { ++ i = TEXTMODE_Y(c_min); ++ dpy_update(s->ds, 0, i, width, TEXTMODE_Y(c_max) - i + 1); ++ } ++ } ++ ++ return; ++ case GMODE_GRAPH: ++ if (!full_update) ++ return; ++ ++ s->get_resolution(s, &width, &height); ++ sprintf(msg_buffer, "%i x %i Graphic mode", width, height); ++ break; ++ case GMODE_BLANK: ++ default: ++ if (!full_update) ++ return; ++ ++ sprintf(msg_buffer, "VGA Blank mode"); ++ break; ++ } ++ ++ /* Display a message */ ++ dpy_cursor(s->ds, -1, -1); ++ dpy_resize(s->ds, 60, 3); ++ memset(chardata, 0, 60 * 3 * 4); ++ size = strlen(msg_buffer); ++ width = (60 - size) / 2; ++ for (i = 0; i < 60 * 3 * 4; i += 4) ++ chardata[i] = ' '; ++ for (i = 0; i < size; i ++) { ++ chardata[(60 + width + i) * 4] = msg_buffer[i]; ++ chardata[(60 + width + i) * 4 + 1] = 0x01; /* colour */ ++ chardata[(60 + width + i) * 4 + 2] = 0x20; /* colour */ ++ } ++ dpy_update(s->ds, 0, 0, 60, 3); ++} ++ + static CPUReadMemoryFunc *vga_mem_read[3] = { + vga_mem_readb, + vga_mem_readw, +@@ -1789,7 +1950,7 @@ void vga_common_init(VGAState *s, Displa + s->get_offsets = vga_get_offsets; + s->get_resolution = vga_get_resolution; + graphic_console_init(s->ds, vga_update_display, vga_invalidate_display, +- vga_screen_dump, s); ++ vga_screen_dump, vga_update_text, s); + } + + /* used by both ISA and PCI */ +Index: monitor.c +=================================================================== +--- monitor.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ monitor.c 2007-02-07 12:11:39.000000000 +0200 +@@ -389,7 +389,7 @@ static void do_change(const char *device + + static void do_screen_dump(const char *filename) + { +- vga_hw_screen_dump(filename); ++ video_hw_screen_dump(filename); + } + + static void do_log(const char *items) +@@ -753,6 +753,8 @@ static const KeyDef key_defs[] = { + { 0x31, "n" }, + { 0x32, "m" }, + ++ { 0x37, "asterisk" }, ++ + { 0x39, "spc" }, + { 0x3a, "caps_lock" }, + { 0x3b, "f1" }, +@@ -818,11 +820,13 @@ static int get_keycode(const char *key) + if (!strcmp(key, p->name)) + return p->keycode; + } +- if (strstart(key, "0x", NULL)) { +- ret = strtoul(key, &endp, 0); +- if (*endp == '\0' && ret >= 0x01 && ret <= 0xff) ++ ++ if (*key == '#') { ++ ret = strtoul(key + 1, &endp, 0); ++ if (ret > 0 && ret < 0x100 && *endp == 0) + return ret; + } ++ + return -1; + } + +@@ -1184,6 +1188,20 @@ static void do_wav_capture (const char * + } + #endif + ++static void do_setenv(const char *cmd) ++{ ++ int len; ++ char name[256], *value; ++ value = strchr(cmd, '='); ++ len = value - cmd; ++ if (len >= sizeof(name)) ++ len = sizeof(name) - 1; ++ memcpy(name, cmd, len); ++ name[value - cmd] = 0; ++ if (setenv(name, ++ value, 1) == -1) ++ term_printf("assignment failed\n"); ++} ++ + static term_cmd_t term_cmds[] = { + { "help|?", "s?", do_help, + "[cmd]", "show the help" }, +@@ -1251,6 +1269,8 @@ static term_cmd_t term_cmds[] = { + #endif + { "stopcapture", "i", do_stop_capture, + "capture index", "stop capture" }, ++ { "ui", "s", do_ui_set, ++ "name", "switch user interface" }, + { "memsave", "lis", do_memory_save, + "addr size file", "save to disk virtual memory dump starting at 'addr' of size 'size'", }, + { NULL, NULL, }, +@@ -1949,6 +1969,11 @@ static void monitor_handle_command(const + memcpy(cmdname, pstart, len); + cmdname[len] = '\0'; + ++ if (strchr(cmdname, '=')) { ++ do_setenv(pstart); ++ return; ++ } ++ + /* find the command */ + for(cmd = term_cmds; cmd->name != NULL; cmd++) { + if (compare_cmd(cmdname, cmd->name)) +@@ -2401,6 +2426,12 @@ void readline_find_completion(const char + for(cmd = info_cmds; cmd->name != NULL; cmd++) { + cmd_completion(str, cmd->name); + } ++ } else if (!strcmp(cmd->name, "ui")) { ++ cmd_completion(str, "dumb"); ++ cmd_completion(str, "vnc"); ++ cmd_completion(str, "sdl"); ++ cmd_completion(str, "cocoa"); ++ cmd_completion(str, "curses"); + } else if (!strcmp(cmd->name, "sendkey")) { + completion_index = strlen(str); + for(key = key_defs; key->name != NULL; key++) { +@@ -2449,6 +2480,10 @@ static void term_event(void *opaque, int + if (!hide_banner) + term_printf("QEMU %s monitor - type 'help' for more information\n", + QEMU_VERSION); ++ ++ readline_history_restore(); ++ atexit(readline_history_save); ++ + monitor_start_input(); + } + +Index: readline.c +=================================================================== +--- readline.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ readline.c 2007-02-07 12:11:39.000000000 +0200 +@@ -26,6 +26,7 @@ + #define TERM_CMD_BUF_SIZE 4095 + #define TERM_MAX_CMDS 64 + #define NB_COMPLETIONS_MAX 256 ++#define HISTORY_FILENAME ".qemu_history" + + #define IS_NORM 0 + #define IS_ESC 1 +@@ -227,7 +228,7 @@ static void term_hist_add(const char *cm + new_entry = hist_entry; + /* Put this entry at the end of history */ + memmove(&term_history[idx], &term_history[idx + 1], +- &term_history[TERM_MAX_CMDS] - &term_history[idx + 1]); ++ (TERM_MAX_CMDS - idx - 1) * sizeof(char *)); + term_history[TERM_MAX_CMDS - 1] = NULL; + for (; idx < TERM_MAX_CMDS; idx++) { + if (term_history[idx] == NULL) +@@ -239,8 +240,8 @@ static void term_hist_add(const char *cm + if (idx == TERM_MAX_CMDS) { + /* Need to get one free slot */ + free(term_history[0]); +- memcpy(term_history, &term_history[1], +- &term_history[TERM_MAX_CMDS] - &term_history[1]); ++ memmove(term_history, &term_history[1], ++ (TERM_MAX_CMDS - 1) * sizeof(char *)); + term_history[TERM_MAX_CMDS - 1] = NULL; + idx = TERM_MAX_CMDS - 1; + } +@@ -422,4 +423,65 @@ const char *readline_get_history(unsigne + return term_history[index]; + } + ++static FILE *readline_open_historyfile(char *modes) ++{ ++ char *filename, *home; ++ FILE *ret; ++ ++ home = getenv("HOME"); ++ if (!home) ++ return 0; ++ ++ filename = qemu_malloc(strlen(home) + 1 + strlen(HISTORY_FILENAME) + 1); ++ if (!filename) ++ return 0; ++ ++ sprintf(filename, "%s/" HISTORY_FILENAME, home); ++ ret = fopen(filename, modes); ++ qemu_free(filename); + ++ return ret; ++} ++ ++void readline_history_save(void) ++{ ++ int idx; ++ FILE *fd; ++ const char *line; ++ ++ fd = readline_open_historyfile("w"); ++ if (!fd) ++ return; ++ ++ idx = 0; ++ while ((line = readline_get_history(idx ++))) ++ fprintf(fd, "%s\n", line); ++ ++ fclose(fd); ++} ++ ++void readline_history_restore(void) ++{ ++ int idx; ++ FILE *fd; ++ char line[TERM_CMD_BUF_SIZE + 1], *ret; ++ ++ fd = readline_open_historyfile("r"); ++ if (!fd) ++ return; ++ ++ memset(term_history, 0, sizeof(term_history)); ++ for (idx = 0; idx < TERM_MAX_CMDS; idx ++) { ++ ret = fgets(line, TERM_CMD_BUF_SIZE + 1, fd); ++ if (!ret || *line == 0 || *line == '\n') ++ break; ++ ++ ret = strchr(line, '\n'); ++ if (ret) ++ *ret = 0; ++ ++ term_history[idx] = qemu_strdup(line); ++ } ++ ++ fclose(fd); ++} +Index: sdl.c +=================================================================== +--- sdl.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ sdl.c 2007-02-07 12:11:39.000000000 +0200 +@@ -302,8 +302,8 @@ static void toggle_full_screen(DisplaySt + if (!gui_saved_grab) + sdl_grab_end(); + } +- vga_hw_invalidate(); +- vga_hw_update(); ++ video_hw_invalidate(); ++ video_hw_update(); + } + + static void sdl_refresh(DisplayState *ds) +@@ -316,7 +316,7 @@ static void sdl_refresh(DisplayState *ds + sdl_update_caption(); + } + +- vga_hw_update(); ++ video_hw_update(); + + while (SDL_PollEvent(ev)) { + switch (ev->type) { +Index: vl.c +=================================================================== +--- vl.c.orig 2007-02-07 12:11:39.000000000 +0200 ++++ vl.c 2007-02-07 12:11:39.000000000 +0200 +@@ -130,6 +130,7 @@ int vga_ram_size; + int bios_size; + static DisplayState display_state; + int nographic; ++int curses; + const char* keyboard_layout = NULL; + int64_t ticks_per_sec; + int boot_device = 'c'; +@@ -4123,7 +4124,7 @@ static void dumb_resize(DisplayState *ds + + static void dumb_refresh(DisplayState *ds) + { +- vga_hw_update(); ++ video_hw_update(); + } + + void dumb_display_init(DisplayState *ds) +@@ -4137,6 +4138,83 @@ void dumb_display_init(DisplayState *ds) + } + + /***********************************************************/ ++/* switching interfaces */ ++static void *qemu_ui_param; ++static void (*qemu_ui_cleanup)(void *opaque); ++ ++void qemu_ui_register_cleanup(void *opaque, void (*ui_cleanup)(void *opaque)) ++{ ++ qemu_ui_param = opaque; ++ qemu_ui_cleanup = ui_cleanup; ++} ++ ++static void qemu_ui_atexit(void) ++{ ++ if (qemu_ui_cleanup) ++ qemu_ui_cleanup(qemu_ui_param); ++} ++ ++void do_ui_set(const char *ui) ++{ ++ int known = 0; ++ /* Check if name is valid */ ++ known |= !strcmp(ui, "dumb"); ++ known |= !strcmp(ui, "vnc"); ++#ifdef CONFIG_SDL ++ known |= !strcmp(ui, "sdl"); ++#endif ++#ifdef CONFIG_COCOA ++ known |= !strcmp(ui, "cocoa"); ++#endif ++#ifdef CONFIG_CURSES ++ known |= !strcmp(ui, "curses"); ++#endif ++ ++ if (!known) { ++ term_printf("unknown UI\n"); ++ return; ++ } ++ ++ /* Kill current UI */ ++ if (qemu_ui_cleanup) { ++ qemu_ui_cleanup(qemu_ui_param); ++ qemu_ui_cleanup = 0; ++ } ++ nographic = 0; ++ curses = 0; ++ ++ /* Start a new one */ ++ if (!strcmp(ui, "dumb")) { ++ nographic = 1; ++ dumb_display_init(&display_state); ++ } ++ if (!strcmp(ui, "vnc")) { ++ if (vnc_display == -1) ++ vnc_display = 0; ++ vnc_display_init(&display_state, vnc_display); ++ } ++#ifdef CONFIG_SDL ++ if (!strcmp(ui, "sdl")) { ++ sdl_display_init(&display_state, full_screen); ++ } ++#endif ++#ifdef CONFIG_COCOA ++ if (!strcmp(ui, "cocoa")) { ++ cocoa_display_init(&display_state, full_screen); ++ } ++#endif ++#ifdef CONFIG_CURSES ++ if (!strcmp(ui, "curses")) { ++ curses = 1; ++ curses_display_init(&display_state, full_screen); ++ } ++#endif ++ console_color_init(&display_state); ++ video_hw_invalidate(); ++ display_state.dpy_refresh(&display_state); ++} ++ ++/***********************************************************/ + /* I/O handling */ + + #define MAX_IO_HANDLERS 64 +@@ -6110,6 +6188,9 @@ void help(void) + "-hdachs c,h,s[,t] force hard disk 0 physical geometry and the optional BIOS\n" + " translation (t=none or lba) (usually qemu can guess them)\n" + "-L path set the directory for the BIOS, VGA BIOS and keymaps\n" ++#ifdef CONFIG_CURSES ++ "-curses use a curses/ncurses interface instead of SDL\n" ++#endif + #ifdef USE_KQEMU + "-kernel-kqemu enable KQEMU full virtualization (default is user mode only)\n" + "-no-kqemu disable KQEMU kernel module usage\n" +@@ -6207,6 +6288,7 @@ enum { + QEMU_OPTION_usbdevice, + QEMU_OPTION_smp, + QEMU_OPTION_vnc, ++ QEMU_OPTION_curses, + QEMU_OPTION_no_acpi, + QEMU_OPTION_no_reboot, + QEMU_OPTION_daemonize, +@@ -6265,6 +6347,9 @@ const QEMUOption qemu_options[] = { + { "hdachs", HAS_ARG, QEMU_OPTION_hdachs }, + { "L", HAS_ARG, QEMU_OPTION_L }, + { "no-code-copy", 0, QEMU_OPTION_no_code_copy }, ++#ifdef CONFIG_CURSES ++ { "curses", 0, QEMU_OPTION_curses }, ++#endif + #ifdef USE_KQEMU + { "no-kqemu", 0, QEMU_OPTION_no_kqemu }, + { "kernel-kqemu", 0, QEMU_OPTION_kernel_kqemu }, +@@ -6577,6 +6662,7 @@ int main(int argc, char **argv) + #endif + snapshot = 0; + nographic = 0; ++ curses = 0; + kernel_filename = NULL; + kernel_cmdline = ""; + #ifdef TARGET_PPC +@@ -6713,7 +6799,16 @@ int main(int argc, char **argv) + pstrcpy(monitor_device, sizeof(monitor_device), "stdio"); + pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio"); + nographic = 1; ++ curses = 0; ++ break; ++#ifdef CONFIG_CURSES ++ case QEMU_OPTION_curses: ++ pstrcpy(monitor_device, sizeof(monitor_device), "vc"); ++ pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "vc"); ++ curses = 1; ++ nographic = 0; + break; ++#endif + case QEMU_OPTION_kernel: + kernel_filename = optarg; + break; +@@ -7156,12 +7251,20 @@ int main(int argc, char **argv) + + init_ioports(); + ++ qemu_ui_cleanup = 0; ++ + /* terminal init */ + if (nographic) { + dumb_display_init(ds); + } else if (vnc_display != NULL) { + vnc_display_init(ds, vnc_display); +- } else { ++ } else ++#if defined(CONFIG_CURSES) ++ if (curses) { ++ curses_display_init(ds, full_screen); ++ } else ++#endif ++ { + #if defined(CONFIG_SDL) + sdl_display_init(ds, full_screen); + #elif defined(CONFIG_COCOA) +@@ -7171,6 +7274,8 @@ int main(int argc, char **argv) + #endif + } + ++ atexit(qemu_ui_atexit); ++ + monitor_hd = qemu_chr_open(monitor_device); + if (!monitor_hd) { + fprintf(stderr, "qemu: could not open monitor device '%s'\n", monitor_device); +Index: vl.h +=================================================================== +--- vl.h.orig 2007-02-06 01:01:54.000000000 +0200 ++++ vl.h 2007-02-07 12:11:39.000000000 +0200 +@@ -322,21 +322,29 @@ void qemu_chr_read(CharDriverState *s, u + typedef struct DisplayState DisplayState; + typedef struct TextConsole TextConsole; + +-typedef void (*vga_hw_update_ptr)(void *); +-typedef void (*vga_hw_invalidate_ptr)(void *); +-typedef void (*vga_hw_screen_dump_ptr)(void *, const char *); +- +-TextConsole *graphic_console_init(DisplayState *ds, vga_hw_update_ptr update, +- vga_hw_invalidate_ptr invalidate, +- vga_hw_screen_dump_ptr screen_dump, ++typedef void (*video_hw_update_ptr)(void *); ++typedef void (*video_hw_invalidate_ptr)(void *); ++typedef void (*video_hw_screen_dump_ptr)(void *, const char *); ++typedef void (*video_hw_text_update_ptr)(void *, uint8_t *, ++ void (*)(DisplayState *s, int x, int y)); ++ ++TextConsole *graphic_console_init(DisplayState *ds, video_hw_update_ptr update, ++ video_hw_invalidate_ptr invalidate, ++ video_hw_screen_dump_ptr screen_dump, ++ video_hw_text_update_ptr text_update, + void *opaque); +-void vga_hw_update(void); +-void vga_hw_invalidate(void); +-void vga_hw_screen_dump(const char *filename); ++void video_hw_update(void); ++void video_hw_invalidate(void); ++void video_hw_screen_dump(const char *filename); ++void video_hw_text_update(uint8_t *chardata, ++ void (*dpy_cursor)(DisplayState *s, int x, int y)); + + int is_graphic_console(void); + CharDriverState *text_console_init(DisplayState *ds); + void console_select(unsigned int index); ++void do_ui_set(const char *ui); ++void qemu_ui_register_cleanup(void *opaque, void (*ui_cleanup)(void *opaque)); ++void console_color_init(DisplayState *ds); + + /* serial ports */ + +@@ -907,6 +915,9 @@ void sdl_display_init(DisplayState *ds, + /* cocoa.m */ + void cocoa_display_init(DisplayState *ds, int full_screen); + ++/* curses.c */ ++void curses_display_init(DisplayState *ds, int full_screen); ++ + /* vnc.c */ + void vnc_display_init(DisplayState *ds, const char *display); + void do_info_vnc(void); +@@ -1394,6 +1405,8 @@ void readline_find_completion(const char + const char *readline_get_history(unsigned int index); + void readline_start(const char *prompt, int is_password, + ReadLineFunc *readline_func, void *opaque); ++void readline_history_save(void); ++void readline_history_restore(void); + + void kqemu_record_dump(void); + +Index: vnc.c +=================================================================== +--- vnc.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ vnc.c 2007-02-07 12:17:08.000000000 +0200 +@@ -78,6 +78,8 @@ struct VncState + Buffer output; + Buffer input; + kbd_layout_t *kbd_layout; ++ int reading; ++ void (*deferred)(void *); + /* current output mode information */ + VncWritePixels *write_pixels; + VncSendHextileTile *send_hextile_tile; +@@ -208,6 +210,7 @@ static void vnc_dpy_resize(DisplayState + ds->width = w; + ds->height = h; + ds->linesize = w * vs->depth; ++ console_color_init(ds); + if (vs->csock != -1 && vs->has_resize && size_changed) { + vnc_write_u8(vs, 0); /* msg id */ + vnc_write_u8(vs, 0); +@@ -500,7 +503,7 @@ static void vnc_dpy_refresh(DisplayState + { + VncState *vs = ds->opaque; + vnc_timer_init(vs); +- vga_hw_update(); ++ video_hw_update(); + } + + static int vnc_listen_poll(void *opaque) +@@ -595,6 +598,7 @@ static void vnc_client_read(void *opaque + VncState *vs = opaque; + long ret; + ++ vs->reading = 1; + buffer_reserve(&vs->input, 4096); + + ret = recv(vs->csock, buffer_end(&vs->input), 4096, 0); +@@ -610,7 +614,7 @@ static void vnc_client_read(void *opaque + + ret = vs->read_handler(vs, vs->input.buffer, len); + if (vs->csock == -1) +- return; ++ break; + + if (!ret) { + memmove(vs->input.buffer, vs->input.buffer + len, (vs->input.offset - len)); +@@ -619,6 +623,12 @@ static void vnc_client_read(void *opaque + vs->read_handler_expect = ret; + } + } ++ ++ vs->reading = 0; ++ if (vs->deferred) { ++ vs->deferred(vs); ++ vs->deferred = 0; ++ } + } + + static void vnc_write(VncState *vs, const void *data, size_t len) +@@ -786,6 +796,9 @@ static void do_key_event(VncState *vs, i + return; + } + break; ++ case 0x45: /* num lock */ ++ case 0x3a: /* caps lock */ ++ return; + } + + if (is_graphic_console()) { +@@ -979,8 +992,8 @@ static void set_pixel_format(VncState *v + memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); + memset(vs->old_data, 42, vs->ds->linesize * vs->ds->height); + +- vga_hw_invalidate(); +- vga_hw_update(); ++ video_hw_invalidate(); ++ video_hw_update(); + } + + static int protocol_client_msg(VncState *vs, char *data, size_t len) +@@ -1153,6 +1166,37 @@ static void vnc_listen_read(void *opaque + + extern int parse_host_port(struct sockaddr_in *saddr, const char *str); + ++void vnc_cleanup2(void *opaque) ++{ ++ VncState *vs = (VncState *)opaque; ++ ++ qemu_set_fd_handler2(vs->lsock, NULL, NULL, NULL, NULL); ++ qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL); ++ qemu_free(vs); ++} ++ ++void vnc_cleanup(void *opaque) ++{ ++ VncState *vs = (VncState *) opaque; ++ ++ reset_keys(vs); ++ if (vs->timer) { ++ qemu_del_timer(vs->timer); ++ qemu_free_timer(vs->timer); ++ } ++ ++ closesocket(vs->lsock); ++ closesocket(vs->csock); ++ vs->lsock = -1; ++ vs->csock = -1; ++ ++ /* FIXME */ ++ if (vs->reading) ++ vs->deferred = vnc_cleanup2; ++ else ++ vnc_cleanup2(vs); ++} ++ + void vnc_display_init(DisplayState *ds, const char *arg) + { + struct sockaddr *addr; +@@ -1181,6 +1225,9 @@ void vnc_display_init(DisplayState *ds, + + vs->ds = ds; + ++ vs->reading = 0; ++ vs->deferred = 0; ++ + if (!keyboard_layout) + keyboard_layout = "en-us"; + +@@ -1255,4 +1302,6 @@ void vnc_display_init(DisplayState *ds, + if (ret == -1) { + exit(1); + } ++ ++ qemu_ui_register_cleanup(vs, vnc_cleanup); + } --- qemu-0.9.0.orig/debian/patches/42_arm_tls.patch +++ qemu-0.9.0/debian/patches/42_arm_tls.patch @@ -0,0 +1,863 @@ +#DPATCHLEVEL=0 +Index: exec-all.h +=================================================================== +--- exec-all.h.orig 2007-02-06 01:01:54.000000000 +0200 ++++ exec-all.h 2007-02-07 10:49:17.000000000 +0200 +@@ -357,163 +357,7 @@ extern CPUWriteMemoryFunc *io_mem_write[ + extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4]; + extern void *io_mem_opaque[IO_MEM_NB_ENTRIES]; + +-#ifdef __powerpc__ +-static inline int testandset (int *p) +-{ +- int ret; +- __asm__ __volatile__ ( +- "0: lwarx %0,0,%1\n" +- " xor. %0,%3,%0\n" +- " bne 1f\n" +- " stwcx. %2,0,%1\n" +- " bne- 0b\n" +- "1: " +- : "=&r" (ret) +- : "r" (p), "r" (1), "r" (0) +- : "cr0", "memory"); +- return ret; +-} +-#endif +- +-#ifdef __i386__ +-static inline int testandset (int *p) +-{ +- long int readval = 0; +- +- __asm__ __volatile__ ("lock; cmpxchgl %2, %0" +- : "+m" (*p), "+a" (readval) +- : "r" (1) +- : "cc"); +- return readval; +-} +-#endif +- +-#ifdef __x86_64__ +-static inline int testandset (int *p) +-{ +- long int readval = 0; +- +- __asm__ __volatile__ ("lock; cmpxchgl %2, %0" +- : "+m" (*p), "+a" (readval) +- : "r" (1) +- : "cc"); +- return readval; +-} +-#endif +- +-#ifdef __s390__ +-static inline int testandset (int *p) +-{ +- int ret; +- +- __asm__ __volatile__ ("0: cs %0,%1,0(%2)\n" +- " jl 0b" +- : "=&d" (ret) +- : "r" (1), "a" (p), "0" (*p) +- : "cc", "memory" ); +- return ret; +-} +-#endif +- +-#ifdef __alpha__ +-static inline int testandset (int *p) +-{ +- int ret; +- unsigned long one; +- +- __asm__ __volatile__ ("0: mov 1,%2\n" +- " ldl_l %0,%1\n" +- " stl_c %2,%1\n" +- " beq %2,1f\n" +- ".subsection 2\n" +- "1: br 0b\n" +- ".previous" +- : "=r" (ret), "=m" (*p), "=r" (one) +- : "m" (*p)); +- return ret; +-} +-#endif +- +-#ifdef __sparc__ +-static inline int testandset (int *p) +-{ +- int ret; +- +- __asm__ __volatile__("ldstub [%1], %0" +- : "=r" (ret) +- : "r" (p) +- : "memory"); +- +- return (ret ? 1 : 0); +-} +-#endif +- +-#ifdef __arm__ +-static inline int testandset (int *spinlock) +-{ +- register unsigned int ret; +- __asm__ __volatile__("swp %0, %1, [%2]" +- : "=r"(ret) +- : "0"(1), "r"(spinlock)); +- +- return ret; +-} +-#endif +- +-#ifdef __mc68000 +-static inline int testandset (int *p) +-{ +- char ret; +- __asm__ __volatile__("tas %1; sne %0" +- : "=r" (ret) +- : "m" (p) +- : "cc","memory"); +- return ret; +-} +-#endif +- +-#ifdef __ia64 +-#include +- +-static inline int testandset (int *p) +-{ +- return __sync_lock_test_and_set (p, 1); +-} +-#endif +- +-typedef int spinlock_t; +- +-#define SPIN_LOCK_UNLOCKED 0 +- +-#if defined(CONFIG_USER_ONLY) +-static inline void spin_lock(spinlock_t *lock) +-{ +- while (testandset(lock)); +-} +- +-static inline void spin_unlock(spinlock_t *lock) +-{ +- *lock = 0; +-} +- +-static inline int spin_trylock(spinlock_t *lock) +-{ +- return !testandset(lock); +-} +-#else +-static inline void spin_lock(spinlock_t *lock) +-{ +-} +- +-static inline void spin_unlock(spinlock_t *lock) +-{ +-} +- +-static inline int spin_trylock(spinlock_t *lock) +-{ +- return 1; +-} +-#endif ++#include "spinlock.h" + + extern spinlock_t tb_lock; + +Index: linux-user/arm/syscall.h +=================================================================== +--- linux-user/arm/syscall.h.orig 2007-02-06 01:01:54.000000000 +0200 ++++ linux-user/arm/syscall.h 2007-02-07 10:49:17.000000000 +0200 +@@ -28,7 +28,9 @@ struct target_pt_regs { + #define ARM_SYSCALL_BASE 0x900000 + #define ARM_THUMB_SYSCALL 0 + +-#define ARM_NR_cacheflush (ARM_SYSCALL_BASE + 0xf0000 + 2) ++#define ARM_NR_BASE 0xf0000 ++#define ARM_NR_cacheflush (ARM_NR_BASE + 2) ++#define ARM_NR_set_tls (ARM_NR_BASE + 5) + + #define ARM_NR_semihosting 0x123456 + #define ARM_NR_thumb_semihosting 0xAB +Index: linux-user/main.c +=================================================================== +--- linux-user/main.c.orig 2007-02-07 10:49:17.000000000 +0200 ++++ linux-user/main.c 2007-02-07 10:49:17.000000000 +0200 +@@ -313,6 +313,50 @@ static void arm_cache_flush(target_ulong + } + } + ++/* Handle a jump to the kernel code page. */ ++static int ++do_kernel_trap(CPUARMState *env) ++{ ++ uint32_t addr; ++ uint32_t *ptr; ++ uint32_t cpsr; ++ ++ switch (env->regs[15]) { ++ case 0xffff0fc0: /* __kernel_cmpxchg */ ++ /* XXX: This only works between threads, not between processes. ++ Use native atomic operations. */ ++ /* ??? This probably breaks horribly if the access segfaults. */ ++ cpu_lock(); ++ ptr = (uint32_t *)env->regs[2]; ++ cpsr = cpsr_read(env); ++ if (*ptr == env->regs[0]) { ++ *ptr = env->regs[1]; ++ env->regs[0] = 0; ++ cpsr |= CPSR_C; ++ } else { ++ env->regs[0] = -1; ++ cpsr &= ~CPSR_C; ++ } ++ cpsr_write(env, cpsr, CPSR_C); ++ cpu_unlock(); ++ break; ++ case 0xffff0fe0: /* __kernel_get_tls */ ++ env->regs[0] = env->cp15.c13_tls; ++ break; ++ default: ++ return 1; ++ } ++ /* Jump back to the caller. */ ++ addr = env->regs[14]; ++ if (addr & 1) { ++ env->thumb = 1; ++ addr &= ~1; ++ } ++ env->regs[15] = addr; ++ ++ return 0; ++} ++ + void cpu_loop(CPUARMState *env) + { + int trapnr; +@@ -418,10 +462,8 @@ void cpu_loop(CPUARMState *env) + } + } + +- if (n == ARM_NR_cacheflush) { +- arm_cache_flush(env->regs[0], env->regs[1]); +- } else if (n == ARM_NR_semihosting +- || n == ARM_NR_thumb_semihosting) { ++ if (n == ARM_NR_semihosting ++ || n == ARM_NR_thumb_semihosting) { + env->regs[0] = do_arm_semihosting (env); + } else if (n == 0 || n >= ARM_SYSCALL_BASE + || (env->thumb && n == ARM_THUMB_SYSCALL)) { +@@ -432,14 +474,35 @@ void cpu_loop(CPUARMState *env) + n -= ARM_SYSCALL_BASE; + env->eabi = 0; + } +- env->regs[0] = do_syscall(env, +- n, +- env->regs[0], +- env->regs[1], +- env->regs[2], +- env->regs[3], +- env->regs[4], +- env->regs[5]); ++ if (n > ARM_NR_BASE) { ++ switch (n) ++ { ++ case ARM_NR_cacheflush: ++ arm_cache_flush(env->regs[0], env->regs[1]); ++ break; ++#ifdef USE_NPTL ++ case ARM_NR_set_tls: ++ cpu_set_tls(env, env->regs[0]); ++ env->regs[0] = 0; ++ break; ++#endif ++ default: ++ printf ("Error: Bad syscall: %x\n", n); ++ env->regs[0] = -ENOSYS; ++ goto error; ++ } ++ } ++ else ++ { ++ env->regs[0] = do_syscall(env, ++ n, ++ env->regs[0], ++ env->regs[1], ++ env->regs[2], ++ env->regs[3], ++ env->regs[4], ++ env->regs[5]); ++ } + } else { + goto error; + } +@@ -478,6 +541,10 @@ void cpu_loop(CPUARMState *env) + } + } + break; ++ case EXCP_KERNEL_TRAP: ++ if (do_kernel_trap(env)) ++ goto error; ++ break; + default: + error: + fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", +@@ -1808,6 +1875,10 @@ int main(int argc, char **argv) + ts->heap_base = info->brk; + /* This will be filled in on the first SYS_HEAPINFO call. */ + ts->heap_limit = 0; ++ /* Register the magic kernel code page. The cpu will generate a ++ special exception when it tries to execute code here. We can't ++ put real code here because it may be in use by the host kernel. */ ++ page_set_flags(0xffff0000, 0xffff0fff, 0); + } + #elif defined(TARGET_SPARC) + { +Index: linux-user/qemu.h +=================================================================== +--- linux-user/qemu.h.orig 2007-02-06 01:01:54.000000000 +0200 ++++ linux-user/qemu.h 2007-02-07 10:49:17.000000000 +0200 +@@ -80,6 +80,9 @@ typedef struct TaskState { + #endif + int used; /* non zero if used */ + struct image_info *info; ++#ifdef USE_NPTL ++ uint32_t *child_tidptr; ++#endif + uint8_t stack[0]; + } __attribute__((aligned(16))) TaskState; + +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2007-02-07 10:48:43.000000000 +0200 ++++ linux-user/syscall.c 2007-02-07 10:50:45.000000000 +0200 +@@ -73,9 +73,18 @@ + #include + + #include "qemu.h" ++#include "spinlock.h" + + //#define DEBUG + ++#ifdef USE_NPTL ++#define CLONE_NPTL_FLAGS2 (CLONE_SETTLS | \ ++ CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID) ++#else ++/* XXX: Hardcode the above values. */ ++#define CLONE_NPTL_FLAGS2 0 ++#endif ++ + #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ + || defined(TARGET_M68K) + /* 16 bit uid wrappers emulation */ +@@ -1804,20 +1813,38 @@ int do_modify_ldt(CPUX86State *env, int + thread/process */ + #define NEW_STACK_SIZE 8192 + ++#ifdef USE_NPTL ++static spinlock_t nptl_lock = SPIN_LOCK_UNLOCKED; ++#endif ++ + static int clone_func(void *arg) + { + CPUState *env = arg; ++#ifdef HAVE_NPTL ++ /* Wait until the parent has finshed initializing the tls state. */ ++ while (!spin_trylock(&nptl_lock)) ++ usleep(1); ++ spin_unlock(&nptl_lock); ++#endif + cpu_loop(env); + /* never exits */ + return 0; + } + +-int do_fork(CPUState *env, unsigned int flags, unsigned long newsp) ++int do_fork(CPUState *env, unsigned int flags, unsigned long newsp, ++ uint32_t *parent_tidptr, void *newtls, ++ uint32_t *child_tidptr) + { + int ret; + TaskState *ts; + uint8_t *new_stack; + CPUState *new_env; ++#ifdef USE_NPTL ++ unsigned int nptl_flags; ++ ++ if (flags & CLONE_PARENT_SETTID) ++ *parent_tidptr = gettid(); ++#endif + + if (flags & CLONE_VM) { + ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE); +@@ -1869,16 +1896,64 @@ int do_fork(CPUState *env, unsigned int + #error unsupported target CPU + #endif + new_env->opaque = ts; ++#ifdef USE_NPTL ++ nptl_flags = flags; ++ flags &= ~CLONE_NPTL_FLAGS2; ++ ++ if (nptl_flags & CLONE_CHILD_CLEARTID) { ++ ts->child_tidptr = child_tidptr; ++ } ++ ++ if (nptl_flags & CLONE_SETTLS) ++ cpu_set_tls (new_env, newtls); ++ ++ /* Grab the global cpu lock so that the thread setup appears ++ atomic. */ ++ if (nptl_flags & CLONE_CHILD_SETTID) ++ spin_lock(&nptl_lock); ++ ++#else ++ if (flags & CLONE_NPTL_FLAGS2) ++ return -EINVAL; ++#endif + #ifdef __ia64__ + ret = __clone2(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env); + #else + ret = clone(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env); + #endif ++#ifdef USE_NPTL ++ if (ret != -1) { ++ if (nptl_flags & CLONE_CHILD_SETTID) ++ *child_tidptr = ret; ++ } ++ ++ /* Allow the child to continue. */ ++ if (nptl_flags & CLONE_CHILD_SETTID) ++ spin_unlock(&nptl_lock); ++#endif + } else { + /* if no CLONE_VM, we consider it is a fork */ +- if ((flags & ~CSIGNAL) != 0) ++ if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0) + return -EINVAL; + ret = fork(); ++#ifdef USE_NPTL ++ /* There is a race condition here. The parent process could ++ theoretically read the TID in the child process before the child ++ tid is set. This would require using either ptrace ++ (not implemented) or having *_tidptr to point at a shared memory ++ mapping. We can't repeat the spinlock hack used above because ++ the child process gets its own copy of the lock. */ ++ if (ret == 0) { ++ /* Child Process. */ ++ if (flags & CLONE_CHILD_SETTID) ++ *child_tidptr = gettid(); ++ ts = (TaskState *)env->opaque; ++ if (flags & CLONE_CHILD_CLEARTID) ++ ts->child_tidptr = child_tidptr; ++ if (flags & CLONE_SETTLS) ++ cpu_set_tls (env, newtls); ++ } ++#endif + } + return ret; + } +@@ -2141,7 +2216,7 @@ long do_syscall(void *cpu_env, int num, + ret = do_brk(arg1); + break; + case TARGET_NR_fork: +- ret = get_errno(do_fork(cpu_env, SIGCHLD, 0)); ++ ret = get_errno(do_fork(cpu_env, SIGCHLD, 0, NULL, NULL, NULL)); + break; + case TARGET_NR_waitpid: + { +@@ -3218,7 +3293,8 @@ long do_syscall(void *cpu_env, int num, + ret = get_errno(fsync(arg1)); + break; + case TARGET_NR_clone: +- ret = get_errno(do_fork(cpu_env, arg1, arg2)); ++ ret = get_errno(do_fork(cpu_env, arg1, arg2, (uint32_t *)arg3, ++ (void *)arg4, (uint32_t *)arg5)); + break; + #ifdef __NR_exit_group + /* new thread calls */ +@@ -3595,7 +3671,8 @@ long do_syscall(void *cpu_env, int num, + #endif + #ifdef TARGET_NR_vfork + case TARGET_NR_vfork: +- ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHLD, 0)); ++ ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHLD, 0, ++ NULL, NULL, NULL)); + break; + #endif + #ifdef TARGET_NR_ugetrlimit +Index: spinlock.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ spinlock.h 2007-02-07 10:49:17.000000000 +0200 +@@ -0,0 +1,181 @@ ++/* ++ * Atomic operation helper include ++ * ++ * Copyright (c) 2005 Fabrice Bellard ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++#ifndef SPINLOCK_H ++#define SPINLOCK_H ++ ++#ifdef __powerpc__ ++static inline int testandset (int *p) ++{ ++ int ret; ++ __asm__ __volatile__ ( ++ "0: lwarx %0,0,%1\n" ++ " xor. %0,%3,%0\n" ++ " bne 1f\n" ++ " stwcx. %2,0,%1\n" ++ " bne- 0b\n" ++ "1: " ++ : "=&r" (ret) ++ : "r" (p), "r" (1), "r" (0) ++ : "cr0", "memory"); ++ return ret; ++} ++#endif ++ ++#ifdef __i386__ ++static inline int testandset (int *p) ++{ ++ long int readval = 0; ++ ++ __asm__ __volatile__ ("lock; cmpxchgl %2, %0" ++ : "+m" (*p), "+a" (readval) ++ : "r" (1) ++ : "cc"); ++ return readval; ++} ++#endif ++ ++#ifdef __x86_64__ ++static inline int testandset (int *p) ++{ ++ long int readval = 0; ++ ++ __asm__ __volatile__ ("lock; cmpxchgl %2, %0" ++ : "+m" (*p), "+a" (readval) ++ : "r" (1) ++ : "cc"); ++ return readval; ++} ++#endif ++ ++#ifdef __s390__ ++static inline int testandset (int *p) ++{ ++ int ret; ++ ++ __asm__ __volatile__ ("0: cs %0,%1,0(%2)\n" ++ " jl 0b" ++ : "=&d" (ret) ++ : "r" (1), "a" (p), "0" (*p) ++ : "cc", "memory" ); ++ return ret; ++} ++#endif ++ ++#ifdef __alpha__ ++static inline int testandset (int *p) ++{ ++ int ret; ++ unsigned long one; ++ ++ __asm__ __volatile__ ("0: mov 1,%2\n" ++ " ldl_l %0,%1\n" ++ " stl_c %2,%1\n" ++ " beq %2,1f\n" ++ ".subsection 2\n" ++ "1: br 0b\n" ++ ".previous" ++ : "=r" (ret), "=m" (*p), "=r" (one) ++ : "m" (*p)); ++ return ret; ++} ++#endif ++ ++#ifdef __sparc__ ++static inline int testandset (int *p) ++{ ++ int ret; ++ ++ __asm__ __volatile__("ldstub [%1], %0" ++ : "=r" (ret) ++ : "r" (p) ++ : "memory"); ++ ++ return (ret ? 1 : 0); ++} ++#endif ++ ++#ifdef __arm__ ++static inline int testandset (int *spinlock) ++{ ++ register unsigned int ret; ++ __asm__ __volatile__("swp %0, %1, [%2]" ++ : "=r"(ret) ++ : "0"(1), "r"(spinlock)); ++ ++ return ret; ++} ++#endif ++ ++#ifdef __mc68000 ++static inline int testandset (int *p) ++{ ++ char ret; ++ __asm__ __volatile__("tas %1; sne %0" ++ : "=r" (ret) ++ : "m" (p) ++ : "cc","memory"); ++ return ret; ++} ++#endif ++ ++#ifdef __ia64 ++#include ++ ++static inline int testandset (int *p) ++{ ++ return __sync_lock_test_and_set (p, 1); ++} ++#endif ++ ++typedef int spinlock_t; ++ ++#define SPIN_LOCK_UNLOCKED 0 ++ ++#if defined(CONFIG_USER_ONLY) ++static inline void spin_lock(spinlock_t *lock) ++{ ++ while (testandset(lock)); ++} ++ ++static inline void spin_unlock(spinlock_t *lock) ++{ ++ *lock = 0; ++} ++ ++static inline int spin_trylock(spinlock_t *lock) ++{ ++ return !testandset(lock); ++} ++#else ++static inline void spin_lock(spinlock_t *lock) ++{ ++} ++ ++static inline void spin_unlock(spinlock_t *lock) ++{ ++} ++ ++static inline int spin_trylock(spinlock_t *lock) ++{ ++ return 1; ++} ++#endif ++ ++#endif +Index: configure +=================================================================== +--- configure.orig 2007-02-06 01:01:54.000000000 +0200 ++++ configure 2007-02-07 10:52:06.000000000 +0200 +@@ -98,6 +98,7 @@ linux_user="no" + darwin_user="no" + build_docs="no" + uname_release="" ++nptl="yes" + + # OS specific + targetos=`uname -s` +@@ -254,6 +255,8 @@ for opt do + ;; + --enable-uname-release=*) uname_release="$optarg" + ;; ++ --disable-nptl) nptl="no" ++ ;; + esac + done + +@@ -299,6 +302,7 @@ echo " --enable-linux-user enable + echo " --disable-linux-user disable all linux usermode emulation targets" + echo " --enable-darwin-user enable all darwin usermode emulation targets" + echo " --disable-darwin-user disable all darwin usermode emulation targets" ++echo " --disable-nptl disable usermode NPTL guest support" + echo " --fmod-lib path to FMOD library" + echo " --fmod-inc path to FMOD includes" + echo " --enable-uname-release=R Return R for uname -r in usermode emulation" +@@ -477,6 +481,23 @@ if $cc -fno-reorder-blocks -fno-optimize + have_gcc3_options="yes" + fi + ++# check NPTL support ++cat > $TMPC < ++void foo() ++{ ++#ifndef CLONE_SETTLS ++#error bork ++#endif ++} ++EOF ++ ++if $cc -c -o $TMPO $TMPC 2> /dev/null ; then ++ : ++else ++ nptl="no" ++fi ++ + ########################################## + # SDL probe + +@@ -626,6 +647,7 @@ echo "kqemu support $kqemu" + echo "Documentation $build_docs" + [ ! -z "$uname_release" ] && \ + echo "uname -r $uname_release" ++echo "NPTL support $nptl" + + if test $sdl_too_old = "yes"; then + echo "-> Your SDL version is too old - please upgrade to have SDL support" +@@ -966,6 +988,14 @@ if test "$target_user_only" = "no"; then + echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak + fi + fi ++else ++ if test "$nptl" = "yes" ; then ++ case "$target_cpu" in ++ arm | armeb) ++ echo "#define USE_NPTL 1" >> $config_h ++ ;; ++ esac ++ fi + fi + + if test "$cocoa" = "yes" ; then +Index: target-arm/cpu.h +=================================================================== +--- target-arm/cpu.h.orig 2007-02-06 01:01:54.000000000 +0200 ++++ target-arm/cpu.h 2007-02-07 10:49:17.000000000 +0200 +@@ -37,6 +37,7 @@ + #define EXCP_IRQ 5 + #define EXCP_FIQ 6 + #define EXCP_BKPT 7 ++#define EXCP_KERNEL_TRAP 8 /* Jumped to kernel code page. */ + + /* We currently assume float and double are IEEE single and double + precision respectively. +@@ -87,6 +88,7 @@ typedef struct CPUARMState { + uint32_t c9_data; + uint32_t c13_fcse; /* FCSE PID. */ + uint32_t c13_context; /* Context ID. */ ++ uint32_t c13_tls; /* Context ID. */ + } cp15; + + /* Internal CPU feature flags. */ +@@ -136,6 +138,15 @@ void switch_mode(CPUARMState *, int); + int cpu_arm_signal_handler(int host_signum, void *pinfo, + void *puc); + ++void cpu_lock(void); ++void cpu_unlock(void); ++#if defined(USE_NPTL) ++static inline void cpu_set_tls(CPUARMState *env, void *newtls) ++{ ++ env->cp15.c13_tls = (uint32_t)(long)newtls; ++} ++#endif ++ + #define CPSR_M (0x1f) + #define CPSR_T (1 << 5) + #define CPSR_F (1 << 6) +@@ -147,7 +158,11 @@ int cpu_arm_signal_handler(int host_sign + #define CPSR_J (1 << 24) + #define CPSR_IT_0_1 (3 << 25) + #define CPSR_Q (1 << 27) +-#define CPSR_NZCV (0xf << 28) ++#define CPSR_V (1 << 28) ++#define CPSR_C (1 << 29) ++#define CPSR_Z (1 << 30) ++#define CPSR_N (1 << 31) ++#define CPSR_NZCV (CPSR_N | CPSR_Z | CPSR_C | CPSR_V) + + #define CACHED_CPSR_BITS (CPSR_T | CPSR_Q | CPSR_NZCV) + /* Return the current CPSR value. */ +Index: target-arm/exec.h +=================================================================== +--- target-arm/exec.h.orig 2007-02-06 01:01:54.000000000 +0200 ++++ target-arm/exec.h 2007-02-07 10:49:17.000000000 +0200 +@@ -58,8 +58,6 @@ int cpu_arm_handle_mmu_fault (CPUState * + + /* In op_helper.c */ + +-void cpu_lock(void); +-void cpu_unlock(void); + void helper_set_cp15(CPUState *, uint32_t, uint32_t); + uint32_t helper_get_cp15(CPUState *, uint32_t); + +Index: target-arm/op.c +=================================================================== +--- target-arm/op.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ target-arm/op.c 2007-02-07 10:49:17.000000000 +0200 +@@ -891,6 +891,12 @@ void OPPROTO op_bkpt(void) + cpu_loop_exit(); + } + ++void OPPROTO op_kernel_trap(void) ++{ ++ env->exception_index = EXCP_KERNEL_TRAP; ++ cpu_loop_exit(); ++} ++ + /* VFP support. We follow the convention used for VFP instrunctions: + Single precition routines have a "s" suffix, double precision a + "d" suffix. */ +Index: target-arm/op_mem.h +=================================================================== +--- target-arm/op_mem.h.orig 2007-02-06 01:01:54.000000000 +0200 ++++ target-arm/op_mem.h 2007-02-07 10:49:17.000000000 +0200 +@@ -1,5 +1,6 @@ + /* ARM memory operations. */ + ++void helper_ld(uint32_t); + /* Load from address T1 into T0. */ + #define MEM_LD_OP(name) \ + void OPPROTO glue(op_ld##name,MEMSUFFIX)(void) \ +Index: target-arm/translate.c +=================================================================== +--- target-arm/translate.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ target-arm/translate.c 2007-02-07 10:49:17.000000000 +0200 +@@ -2416,6 +2416,15 @@ static inline int gen_intermediate_code_ + nb_gen_labels = 0; + lj = -1; + do { ++#ifdef CONFIG_USER_ONLY ++ /* Intercept jump to the magic kernel page. */ ++ if (dc->pc > 0xffff0000) { ++ gen_op_kernel_trap(); ++ dc->is_jmp = DISAS_UPDATE; ++ break; ++ } ++#endif ++ + if (env->nb_breakpoints > 0) { + for(j = 0; j < env->nb_breakpoints; j++) { + if (env->breakpoints[j] == dc->pc) { --- qemu-0.9.0.orig/debian/patches/22_net_tuntap_stall.patch +++ qemu-0.9.0/debian/patches/22_net_tuntap_stall.patch @@ -0,0 +1,14 @@ +#DPATCHLEVEL=0 +Index: vl.c +=================================================================== +--- vl.c.orig 2006-08-11 19:30:56.000000000 +0300 ++++ vl.c 2006-08-11 19:31:13.000000000 +0300 +@@ -3064,7 +3064,7 @@ static int tap_open(char *ifname, int if + return -1; + } + memset(&ifr, 0, sizeof(ifr)); +- ifr.ifr_flags = IFF_TAP | IFF_NO_PI; ++ ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE; + if (ifname[0] != '\0') + pstrcpy(ifr.ifr_name, IFNAMSIZ, ifname); + else --- qemu-0.9.0.orig/debian/patches/40_sparc_fp_to_int.patch +++ qemu-0.9.0/debian/patches/40_sparc_fp_to_int.patch @@ -0,0 +1,36 @@ +Index: target-sparc/op.c +=================================================================== +RCS file: /sources/qemu/qemu/target-sparc/op.c,v +retrieving revision 1.23 +diff -u -d -p -r1.23 op.c +--- target-sparc/op.c 23 Oct 2006 21:37:34 -0000 1.23 ++++ target-sparc/op.c 7 Feb 2007 01:25:09 -0000 +@@ -1472,23 +1472,23 @@ void OPPROTO op_fstod(void) + /* Float to integer conversion. */ + void OPPROTO op_fstoi(void) + { +- *((int32_t *)&FT0) = float32_to_int32(FT1, &env->fp_status); ++ *((int32_t *)&FT0) = float32_to_int32_round_to_zero(FT1, &env->fp_status); + } + + void OPPROTO op_fdtoi(void) + { +- *((int32_t *)&FT0) = float64_to_int32(DT1, &env->fp_status); ++ *((int32_t *)&FT0) = float64_to_int32_round_to_zero(DT1, &env->fp_status); + } + + #ifdef TARGET_SPARC64 + void OPPROTO op_fstox(void) + { +- *((int64_t *)&DT0) = float32_to_int64(FT1, &env->fp_status); ++ *((int64_t *)&DT0) = float32_to_int64_round_to_zero(FT1, &env->fp_status); + } + + void OPPROTO op_fdtox(void) + { +- *((int64_t *)&DT0) = float64_to_int64(DT1, &env->fp_status); ++ *((int64_t *)&DT0) = float64_to_int64_round_to_zero(DT1, &env->fp_status); + } + + void OPPROTO op_fmovs_cc(void) + --- qemu-0.9.0.orig/debian/patches/01_typo_qemu-img.patch +++ qemu-0.9.0/debian/patches/01_typo_qemu-img.patch @@ -0,0 +1,13 @@ +Index: qemu-img.c +=================================================================== +--- qemu-img.c.orig 2007-02-07 12:56:34.000000000 +0200 ++++ qemu-img.c 2007-02-07 12:56:39.000000000 +0200 +@@ -297,7 +297,7 @@ static int img_create(int argc, char **a + drv = bdrv_find_format(fmt); + if (!drv) + error("Unknown file format '%s'", fmt); +- printf("Formating '%s', fmt=%s", ++ printf("Formatting '%s', fmt=%s", + filename, fmt); + if (encrypted) + printf(", encrypted"); --- qemu-0.9.0.orig/debian/patches/61_safe_64bit_int.patch +++ qemu-0.9.0/debian/patches/61_safe_64bit_int.patch @@ -0,0 +1,23 @@ +#DPATCHLEVEL=0 +Index: dyngen-exec.h +=================================================================== +--- dyngen-exec.h.orig 2006-07-22 20:23:34.000000000 +0300 ++++ dyngen-exec.h 2006-08-11 06:13:30.000000000 +0300 +@@ -38,7 +38,7 @@ + // Linux/Sparc64 defines uint64_t + #if !(defined (__sparc_v9__) && defined(__linux__)) + /* XXX may be done for all 64 bits targets ? */ +-#if defined (__x86_64__) || defined(__ia64) ++#if defined (__x86_64__) || defined(__ia64) || defined(__alpha__) || defined(__sparc__) + typedef unsigned long uint64_t; + #else + typedef unsigned long long uint64_t; +@@ -55,7 +55,7 @@ + typedef signed int int32_t; + // Linux/Sparc64 defines int64_t + #if !(defined (__sparc_v9__) && defined(__linux__)) +-#if defined (__x86_64__) || defined(__ia64) ++#if defined (__x86_64__) || defined(__ia64) || defined(__alpha__) || defined(__sparc__) + typedef signed long int64_t; + #else + typedef signed long long int64_t; --- qemu-0.9.0.orig/debian/patches/63_sparc_build.patch +++ qemu-0.9.0/debian/patches/63_sparc_build.patch @@ -0,0 +1,14 @@ +#DPATCHLEVEL=0 +Index: sparc.ld +=================================================================== +--- sparc.ld.orig 2006-07-22 20:23:34.000000000 +0300 ++++ sparc.ld 2006-08-11 06:13:47.000000000 +0300 +@@ -6,7 +6,7 @@ + SECTIONS + { + /* Read-only sections, merged into text segment: */ +- . = 0x60000000 + SIZEOF_HEADERS; ++ . = 0x60000000 + 0x400; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } --- qemu-0.9.0.orig/debian/patches/60_ppc_ld.patch +++ qemu-0.9.0/debian/patches/60_ppc_ld.patch @@ -0,0 +1,297 @@ +#DPATCHLEVEL=1 +diff -Naur qemu-0.7.2.orig/ppc.ld qemu-0.7.2/ppc.ld +--- qemu-0.7.2.orig/ppc.ld 2005-09-04 20:11:31.000000000 +0300 ++++ qemu-0.7.2/ppc.ld 2005-11-21 01:57:35.000000000 +0200 +@@ -1,116 +1,195 @@ +-/* ld script to make i386 Linux kernel +- * Written by Martin Mares ; +- */ +-OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") +-OUTPUT_ARCH(powerpc) +-SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib); ++/* Default linker script, for normal executables */ ++OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", ++ "elf32-powerpc") ++OUTPUT_ARCH(powerpc:common) + ENTRY(_start) ++SEARCH_DIR("/usr/powerpc-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); ++/* Do we need any of these for elf? ++ __DYNAMIC = 0; */ + SECTIONS + { + /* Read-only sections, merged into text segment: */ +- . = 0x60000000 + SIZEOF_HEADERS; +- .interp : { *(.interp) } +- .hash : { *(.hash) } +- .dynsym : { *(.dynsym) } +- .dynstr : { *(.dynstr) } +- .gnu.version : { *(.gnu.version) } +- .gnu.version_d : { *(.gnu.version_d) } +- .gnu.version_r : { *(.gnu.version_r) } +- .rel.text : +- { *(.rel.text) *(.rel.gnu.linkonce.t*) } +- .rela.text : +- { *(.rela.text) *(.rela.gnu.linkonce.t*) } +- .rel.data : +- { *(.rel.data) *(.rel.gnu.linkonce.d*) } +- .rela.data : +- { *(.rela.data) *(.rela.gnu.linkonce.d*) } +- .rel.rodata : +- { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } +- .rela.rodata : +- { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } +- .rel.got : { *(.rel.got) } +- .rela.got : { *(.rela.got) } +- .rel.ctors : { *(.rel.ctors) } +- .rela.ctors : { *(.rela.ctors) } +- .rel.dtors : { *(.rel.dtors) } +- .rela.dtors : { *(.rela.dtors) } +- .rel.init : { *(.rel.init) } +- .rela.init : { *(.rela.init) } +- .rel.fini : { *(.rel.fini) } +- .rela.fini : { *(.rela.fini) } +- .rel.bss : { *(.rel.bss) } +- .rela.bss : { *(.rela.bss) } +- .rel.plt : { *(.rel.plt) } +- .rela.plt : { *(.rela.plt) } +- .init : { *(.init) } =0x47ff041f +- .text : ++ PROVIDE (__executable_start = 0x60000000); . = 0x60000000 + SIZEOF_HEADERS; ++ .interp : { *(.interp) } ++ .hash : { *(.hash) } ++ .dynsym : { *(.dynsym) } ++ .dynstr : { *(.dynstr) } ++ .gnu.version : { *(.gnu.version) } ++ .gnu.version_d : { *(.gnu.version_d) } ++ .gnu.version_r : { *(.gnu.version_r) } ++ .rel.init : { *(.rel.init) } ++ .rela.init : { *(.rela.init) } ++ .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } ++ .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } ++ .rel.fini : { *(.rel.fini) } ++ .rela.fini : { *(.rela.fini) } ++ .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } ++ .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } ++ .rel.data.rel.ro : { *(.rel.data.rel.ro*) } ++ .rela.data.rel.ro : { *(.rel.data.rel.ro*) } ++ .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } ++ .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } ++ .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } ++ .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } ++ .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } ++ .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } ++ .rel.ctors : { *(.rel.ctors) } ++ .rela.ctors : { *(.rela.ctors) } ++ .rel.dtors : { *(.rel.dtors) } ++ .rela.dtors : { *(.rela.dtors) } ++ .rel.got : { *(.rel.got) } ++ .rela.got : { *(.rela.got) } ++ .rela.got1 : { *(.rela.got1) } ++ .rela.got2 : { *(.rela.got2) } ++ .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } ++ .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } ++ .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } ++ .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } ++ .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } ++ .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } ++ .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } ++ .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } ++ .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } ++ .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } ++ .rel.plt : { *(.rel.plt) } ++ .rela.plt : { *(.rela.plt) } ++ .init : + { +- *(.text) ++ KEEP (*(.init)) ++ } =0 ++ .text : ++ { ++ *(.text .stub .text.* .gnu.linkonce.t.*) ++ KEEP (*(.text.*personality*)) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) +- *(.gnu.linkonce.t*) +- } =0x47ff041f +- _etext = .; ++ } =0 ++ .fini : ++ { ++ KEEP (*(.fini)) ++ } =0 ++ PROVIDE (__etext = .); ++ PROVIDE (_etext = .); + PROVIDE (etext = .); +- .fini : { *(.fini) } =0x47ff041f ++ .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } ++ .rodata1 : { *(.rodata1) } ++ .sdata2 : ++ { ++ PROVIDE (_SDA2_BASE_ = 32768); ++ *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) ++ } ++ .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } ++ .eh_frame_hdr : { *(.eh_frame_hdr) } ++ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } ++ .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } ++ /* Adjust the address for the data segment. We want to adjust up to ++ the same address within the page on the next page up. */ ++ . = ALIGN (0x10000) - ((0x10000 - .) & (0x10000 - 1)); . = DATA_SEGMENT_ALIGN (0x10000, 0x1000); ++ /* Exception handling */ ++ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } ++ .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } ++ /* Thread Local Storage sections */ ++ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } ++ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } ++ /* Ensure the __preinit_array_start label is properly aligned. We ++ could instead move the label definition inside the section, but ++ the linker would then create the section even if it turns out to ++ be empty, which isn't pretty. */ + . = ALIGN(32 / 8); + PROVIDE (__preinit_array_start = .); +- .preinit_array : { *(.preinit_array) } ++ .preinit_array : { KEEP (*(.preinit_array)) } + PROVIDE (__preinit_array_end = .); + PROVIDE (__init_array_start = .); +- .init_array : { *(.init_array) } ++ .init_array : { KEEP (*(.init_array)) } + PROVIDE (__init_array_end = .); + PROVIDE (__fini_array_start = .); +- .fini_array : { *(.fini_array) } ++ .fini_array : { KEEP (*(.fini_array)) } + PROVIDE (__fini_array_end = .); +- .rodata : { *(.rodata) *(.gnu.linkonce.r*) } +- .rodata1 : { *(.rodata1) } +- .reginfo : { *(.reginfo) } +- /* Adjust the address for the data segment. We want to adjust up to +- the same address within the page on the next page up. */ +- . = ALIGN(0x100000) + (. & (0x100000 - 1)); +- .data : ++ .ctors : + { +- *(.data) +- *(.gnu.linkonce.d*) +- CONSTRUCTORS ++ /* gcc uses crtbegin.o to find the start of ++ the constructors, so we make sure it is ++ first. Because this is a wildcard, it ++ doesn't matter if the user does not ++ actually link against crtbegin.o; the ++ linker won't look for a file to match a ++ wildcard. The wildcard also means that it ++ doesn't matter which directory crtbegin.o ++ is in. */ ++ KEEP (*crtbegin*.o(.ctors)) ++ /* We don't want to include the .ctor section from ++ from the crtend.o file until after the sorted ctors. ++ The .ctor section from the crtend file contains the ++ end of ctors marker and it must be last */ ++ KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) ++ KEEP (*(SORT(.ctors.*))) ++ KEEP (*(.ctors)) + } +- .data1 : { *(.data1) } +- .ctors : ++ .dtors : + { +- *(.ctors) ++ KEEP (*crtbegin*.o(.dtors)) ++ KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) ++ KEEP (*(SORT(.dtors.*))) ++ KEEP (*(.dtors)) + } +- .dtors : ++ .jcr : { KEEP (*(.jcr)) } ++ .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } ++ .got1 : { *(.got1) } ++ .got2 : { *(.got2) } ++ .dynamic : { *(.dynamic) } ++ . = DATA_SEGMENT_RELRO_END (0, .); ++ .data : + { +- *(.dtors) ++ *(.data .data.* .gnu.linkonce.d.*) ++ KEEP (*(.gnu.linkonce.d.*personality*)) ++ SORT(CONSTRUCTORS) + } +- .plt : { *(.plt) } +- .got : { *(.got.plt) *(.got) } +- .dynamic : { *(.dynamic) } ++ .data1 : { *(.data1) } ++ .got : { *(.got.plt) *(.got) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ +- .sdata : { *(.sdata) } +- _edata = .; ++ .sdata : ++ { ++ PROVIDE (_SDA_BASE_ = 32768); ++ *(.sdata .sdata.* .gnu.linkonce.s.*) ++ } ++ _edata = .; + PROVIDE (edata = .); + __bss_start = .; +- .sbss : { *(.sbss) *(.scommon) } +- .bss : ++ .sbss : ++ { ++ PROVIDE (__sbss_start = .); ++ PROVIDE (___sbss_start = .); ++ *(.dynsbss) ++ *(.sbss .sbss.* .gnu.linkonce.sb.*) ++ *(.scommon) ++ PROVIDE (__sbss_end = .); ++ PROVIDE (___sbss_end = .); ++ } ++ .plt : { *(.plt) } ++ .bss : + { + *(.dynbss) +- *(.bss) ++ *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) ++ /* Align here to ensure that the .bss section occupies space up to ++ _end. Align after .bss to ensure correct alignment even if the ++ .bss section disappears because there are no input sections. */ ++ . = ALIGN(32 / 8); + } +- _end = . ; ++ . = ALIGN(32 / 8); ++ _end = .; + PROVIDE (end = .); ++ . = DATA_SEGMENT_END (.); + /* Stabs debugging sections. */ +- .stab 0 : { *(.stab) } +- .stabstr 0 : { *(.stabstr) } +- .stab.excl 0 : { *(.stab.excl) } +- .stab.exclstr 0 : { *(.stab.exclstr) } +- .stab.index 0 : { *(.stab.index) } ++ .stab 0 : { *(.stab) } ++ .stabstr 0 : { *(.stabstr) } ++ .stab.excl 0 : { *(.stab.excl) } ++ .stab.exclstr 0 : { *(.stab.exclstr) } ++ .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } +- .comment 0 : { *(.comment) } ++ .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ +@@ -124,7 +203,7 @@ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ +- .debug_info 0 : { *(.debug_info) } ++ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } +@@ -136,5 +215,6 @@ + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +- /* These must appear regardless of . */ ++ /DISCARD/ : { *(.fixup) } ++ /DISCARD/ : { *(.note.GNU-stack) } + } --- qemu-0.9.0.orig/debian/patches/64_ppc_asm_constraints.patch +++ qemu-0.9.0/debian/patches/64_ppc_asm_constraints.patch @@ -0,0 +1,12 @@ +#DPATCHLEVEL=1 +--- a/cpu-all.h ++++ b/cpu-all.h +@@ -250,7 +250,7 @@ static inline void stw_le_p(void *ptr, i + static inline void stl_le_p(void *ptr, int v) + { + #ifdef __powerpc__ +- __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*(uint32_t *)ptr) : "r" (v), "r" (ptr)); ++ __asm__ __volatile__ ("stwbrx %0,0,%1" : : "r" (v), "r" (ptr) : "memory"); + #else + uint8_t *p = ptr; + p[0] = v; --- qemu-0.9.0.orig/debian/patches/11_signal_sigaction.patch +++ qemu-0.9.0/debian/patches/11_signal_sigaction.patch @@ -0,0 +1,15 @@ +#DPATCHLEVEL=0 +--- linux-user/signal.c 2005-04-27 09:44:53.534806341 +0300 ++++ linux-user/signal.c 2005-04-27 09:42:52.325180111 +0300 +@@ -429,6 +429,11 @@ + + if (sig < 1 || sig > TARGET_NSIG) + return -EINVAL; ++ ++ /* no point doing the stuff as those are not allowed for sigaction */ ++ if ((sig == TARGET_SIGKILL) || (sig == TARGET_SIGSTOP)) ++ return -EINVAL; ++ + k = &sigact_table[sig - 1]; + #if defined(DEBUG_SIGNAL) + fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n", --- qemu-0.9.0.orig/debian/patches/31_syscalls.patch +++ qemu-0.9.0/debian/patches/31_syscalls.patch @@ -0,0 +1,108 @@ +#DPATCHLEVEL=0 +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2007-02-07 10:42:55.000000000 +0200 ++++ linux-user/syscall.c 2007-02-07 10:43:03.000000000 +0200 +@@ -142,6 +142,7 @@ type name (type1 arg1,type2 arg2,type3 a + #define __NR_sys_getdents __NR_getdents + #define __NR_sys_getdents64 __NR_getdents64 + #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo ++#define __NR_sys_syslog __NR_syslog + + #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__) + #define __NR__llseek __NR_lseek +@@ -161,6 +162,7 @@ _syscall3(int, sys_getdents64, uint, fd, + _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, + loff_t *, res, uint, wh); + _syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo) ++_syscall3(int,sys_syslog,int,type,char*,bufp,int,len) + #ifdef __NR_exit_group + _syscall1(int,exit_group,int,error_code) + #endif +@@ -174,6 +176,7 @@ extern int getresuid(uid_t *, uid_t *, u + extern int setresgid(gid_t, gid_t, gid_t); + extern int getresgid(gid_t *, gid_t *, gid_t *); + extern int setgroups(int, gid_t *); ++extern int uselib(const char*); + + static inline long get_errno(long ret) + { +@@ -2810,7 +2813,9 @@ long do_syscall(void *cpu_env, int num, + } + break; + case TARGET_NR_uselib: +- goto unimplemented; ++ ret = get_errno(uselib(path((const char*)arg1))); ++ break; ++ + case TARGET_NR_swapon: + p = lock_user_string(arg1); + ret = get_errno(swapon(p, arg2)); +@@ -3050,7 +3055,9 @@ long do_syscall(void *cpu_env, int num, + #endif + + case TARGET_NR_syslog: +- goto unimplemented; ++ ret = get_errno(sys_syslog((int)arg1, (char*)arg2, (int)arg3)); ++ break; ++ + case TARGET_NR_setitimer: + { + struct itimerval value, ovalue, *pvalue; +@@ -3924,7 +3931,9 @@ long do_syscall(void *cpu_env, int num, + goto unimplemented; + #ifdef TARGET_NR_mincore + case TARGET_NR_mincore: +- goto unimplemented; ++ page_unprotect_range(arg3, ((size_t)arg2 + TARGET_PAGE_SIZE - 1) / TARGET_PAGE_SIZE); ++ ret = get_errno(mincore((void*)arg1, (size_t)arg2, (unsigned char*)arg3)); ++ break; + #endif + #ifdef TARGET_NR_madvise + case TARGET_NR_madvise: +@@ -4021,7 +4030,8 @@ long do_syscall(void *cpu_env, int num, + ret = get_errno(gettid()); + break; + case TARGET_NR_readahead: +- goto unimplemented; ++ ret = get_errno(readahead((int)arg1, (off64_t)arg2, (size_t)arg3)); ++ break; + #ifdef TARGET_NR_setxattr + case TARGET_NR_setxattr: + case TARGET_NR_lsetxattr: +@@ -4046,6 +4056,22 @@ long do_syscall(void *cpu_env, int num, + case TARGET_NR_getdomainname: + goto unimplemented_nowarn; + #endif ++#ifdef TARGET_NR_clock_gettime ++ case TARGET_NR_clock_gettime: ++ { ++ struct target_timespec* ttp = (struct target_timespec*)arg2; ++ struct timespec htp; ++ if(ttp) { ++ htp.tv_sec = tswapl(ttp->tv_sec); ++ htp.tv_nsec = tswapl(ttp->tv_nsec); ++ ret = get_errno(clock_gettime((clockid_t)arg1, &htp)); ++ ttp->tv_sec = tswapl(htp.tv_sec); ++ ttp->tv_nsec = tswapl(htp.tv_nsec); ++ } else ++ ret = get_errno(clock_gettime((clockid_t)arg1, NULL)); ++ break; ++ } ++#endif + default: + unimplemented: + gemu_log("qemu: Unsupported syscall: %d\n", num); +Index: Makefile.target +=================================================================== +--- Makefile.target.orig 2007-02-06 01:01:54.000000000 +0200 ++++ Makefile.target 2007-02-07 10:44:58.000000000 +0200 +@@ -182,7 +182,7 @@ OP_CFLAGS+=$(OS_CFLAGS) + ######################################################### + + CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE +-LIBS+=-lm ++LIBS+=-lm -lrt + ifndef CONFIG_USER_ONLY + LIBS+=-lz + endif --- qemu-0.9.0.orig/debian/patches/06_exit_segfault.patch +++ qemu-0.9.0/debian/patches/06_exit_segfault.patch @@ -0,0 +1,41 @@ +#DPATCHLEVEL=0 +Index: linux-user/main.c +=================================================================== +--- linux-user/main.c.orig 2006-07-22 20:23:34.000000000 +0300 ++++ linux-user/main.c 2006-08-11 19:31:04.000000000 +0300 +@@ -618,7 +618,7 @@ void cpu_loop (CPUSPARCState *env) + default: + printf ("Unhandled trap: 0x%x\n", trapnr); + cpu_dump_state(env, stderr, fprintf, 0); +- exit (1); ++ _exit (1); + } + process_pending_signals (env); + } +@@ -1401,7 +1401,7 @@ void cpu_loop (CPUState *env) + default: + printf ("Unhandled trap: 0x%x\n", trapnr); + cpu_dump_state(env, stderr, fprintf, 0); +- exit (1); ++ _exit (1); + } + process_pending_signals (env); + } +@@ -1480,7 +1480,7 @@ int main(int argc, char **argv) + for(item = cpu_log_items; item->mask != 0; item++) { + printf("%-10s %s\n", item->name, item->help); + } +- exit(1); ++ _exit(1); + } + cpu_set_log(mask); + } else if (!strcmp(r, "s")) { +@@ -1499,7 +1499,7 @@ int main(int argc, char **argv) + if (qemu_host_page_size == 0 || + (qemu_host_page_size & (qemu_host_page_size - 1)) != 0) { + fprintf(stderr, "page size must be a power of two\n"); +- exit(1); ++ _exit(1); + } + } else if (!strcmp(r, "g")) { + gdbstub_port = atoi(argv[optind++]); --- qemu-0.9.0.orig/debian/patches/03_machines_list_no_error.patch +++ qemu-0.9.0/debian/patches/03_machines_list_no_error.patch @@ -0,0 +1,14 @@ +#DPATCHLEVEL=0 +Index: vl.c +=================================================================== +--- vl.c.orig 2006-07-22 20:23:34.000000000 +0300 ++++ vl.c 2006-08-11 19:30:53.000000000 +0300 +@@ -5727,7 +5727,7 @@ int main(int argc, char **argv) + m->name, m->desc, + m == first_machine ? " (default)" : ""); + } +- exit(1); ++ exit(strcmp(optarg, "?")); + } + break; + case QEMU_OPTION_initrd: --- qemu-0.9.0.orig/debian/patches/12_signal_powerpc_support.patch +++ qemu-0.9.0/debian/patches/12_signal_powerpc_support.patch @@ -0,0 +1,397 @@ +#DPATCHLEVEL=1 +Index: qemu-0.8.2/linux-user/signal.c +=================================================================== +--- qemu-0.8.2.orig/linux-user/signal.c 2006-08-11 19:06:59.000000000 +0300 ++++ qemu-0.8.2/linux-user/signal.c 2006-08-11 19:10:52.000000000 +0300 +@@ -2,6 +2,7 @@ + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard ++ * Copyright (c) 2005 Josh Triplett + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -16,6 +17,12 @@ + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ * Various portions adapted from the Linux kernel: ++ * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) ++ * Derived from "arch/i386/kernel/signal.c" ++ * Copyright (C) 1991, 1992 Linus Torvalds ++ * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson + */ + #include + #include +@@ -1961,6 +1968,370 @@ + return -ENOSYS; + } + ++#elif defined(TARGET_PPC) ++/* Adapted from the Linux kernel: ++ * arch/ppc/kernel/signal.c ++ * include/asm-ppc/elf.h ++ * include/asm-ppc/ptrace.h ++ * include/asm-ppc/sigcontext.h ++ * include/asm-ppc/ucontext.h ++ */ ++ ++/* ++ * When we have signals to deliver, we set up on the ++ * user stack, going down from the original stack pointer: ++ * a sigregs struct ++ * a sigcontext struct ++ * a gap of __SIGNAL_FRAMESIZE bytes ++ * ++ * Each of these things must be a multiple of 16 bytes in size. ++ * ++ */ ++ ++#define TARGET_ELF_NGREG 48 /* includes nip, msr, lr, etc. */ ++#define TARGET_ELF_NFPREG 33 /* includes fpscr */ ++#define TARGET_ELF_NVRREG 33 /* includes vscr */ ++ ++/* General registers */ ++typedef unsigned long target_elf_greg_t; ++typedef target_elf_greg_t target_elf_gregset_t[TARGET_ELF_NGREG]; ++ ++/* Floating point registers */ ++typedef double target_elf_fpreg_t; ++typedef target_elf_fpreg_t target_elf_fpregset_t[TARGET_ELF_NFPREG]; ++ ++/* Altivec registers */ ++/* FIXME: Altivec not supported yet. */ ++/* typedef __vector128 elf_vrreg_t; */ ++typedef uint64_t target_elf_vrreg_t[2]; ++typedef target_elf_vrreg_t target_elf_vrregset_t[TARGET_ELF_NVRREG]; ++ ++struct target_mcontext { ++ target_elf_gregset_t mc_gregs; ++ target_elf_fpregset_t mc_fregs; ++ /* The kernel calls this mc_pad, but does #define tramp mc_pad */ ++ target_ulong tramp[2]; ++ target_elf_vrregset_t mc_vregs __attribute__((__aligned__(16))); ++}; ++ ++struct target_sigregs { ++ struct target_mcontext mctx; /* all the register values */ ++ /* Programs using the rs6000/xcoff abi can save up to 19 gp regs ++ and 18 fp regs below sp before decrementing it. */ ++ int abigap[56]; ++}; ++ ++struct target_sigcontext { ++ target_ulong _unused[4]; ++ uint32_t signal; ++ target_ulong handler; ++ target_ulong oldmask; ++ struct target_pt_regs *regs; ++}; ++ ++#define __SIGNAL_FRAMESIZE 64 ++ ++static int ++save_user_regs(CPUState *env, struct target_mcontext *frame, int sigret) ++{ ++ /* save general and floating-point registers */ ++#if 0 /* FIXME: handle floating-point, Altivec, SPE */ ++ CHECK_FULL_REGS(regs); ++ preempt_disable(); ++ if (regs->msr & MSR_FP) ++ giveup_fpu(current); ++#ifdef CONFIG_ALTIVEC ++ if (current->thread.used_vr && (regs->msr & MSR_VEC)) ++ giveup_altivec(current); ++#endif /* CONFIG_ALTIVEC */ ++#ifdef CONFIG_SPE ++ if (current->thread.used_spe && (regs->msr & MSR_SPE)) ++ giveup_spe(current); ++#endif /* CONFIG_ALTIVEC */ ++ preempt_enable(); ++#endif /* 0 */ ++ ++ /* Note: this needs to be in the same order as target_pt_regs */ ++ if(!memcpy(&frame->mc_gregs, env->gpr, ++ 32*sizeof(target_elf_greg_t)) ++ || __put_user(env->nip, &frame->mc_gregs[32]) ++ || __put_user(do_load_msr(env), &frame->mc_gregs[33]) ++ /* FIXME: || __put_user(orig_gpr3, &frame->mc_gregs[34]) */ ++ || __put_user(env->ctr, &frame->mc_gregs[35]) ++ || __put_user(env->lr, &frame->mc_gregs[36]) ++ || __put_user(do_load_xer(env), &frame->mc_gregs[37]) ++ || __put_user(do_load_cr(env), &frame->mc_gregs[38]) ++ || __put_user(env->spr[SPR_MQ], &frame->mc_gregs[39]) ++ /* FIXME: || __put_user(trap, &frame->mc_gregs[40]) */ ++ || __put_user(env->spr[SPR_DAR], &frame->mc_gregs[41]) ++ || __put_user(env->spr[SPR_DSISR], &frame->mc_gregs[42]) ++ /* FIXME: || __put_user(result, &frame->mc_gregs[43]) */) ++ return 1; ++ ++ if(!memcpy(&frame->mc_fregs, env->fpr, ++ 32*sizeof(target_elf_fpreg_t)) ++ || __put_user(do_load_fpscr(env), &frame->mc_fregs[32])) ++ ++ do_store_fpscr(env, 0, 0xFF); /* turn off all fp exceptions */ ++ ++#if 0 /* FIXME: handle Altivec, SPE */ ++#ifdef CONFIG_ALTIVEC ++ /* save altivec registers */ ++ if (current->thread.used_vr) { ++ if (!memcpy(&frame->mc_vregs, current->thread.vr, ++ ELF_NVRREG * sizeof(vector128))) ++ return 1; ++ /* set MSR_VEC in the saved MSR value to indicate that ++ frame->mc_vregs contains valid data */ ++ if (__put_user(regs->msr | MSR_VEC, &frame->mc_gregs[PT_MSR])) ++ return 1; ++ } ++ /* else assert((regs->msr & MSR_VEC) == 0) */ ++ ++ /* We always copy to/from vrsave, it's 0 if we don't have or don't ++ * use altivec. Since VSCR only contains 32 bits saved in the least ++ * significant bits of a vector, we "cheat" and stuff VRSAVE in the ++ * most significant bits of that same vector. --BenH ++ */ ++ if (__put_user(current->thread.vrsave, (u32 __user *)&frame->mc_vregs[32])) ++ return 1; ++#endif /* CONFIG_ALTIVEC */ ++ ++#ifdef CONFIG_SPE ++ /* save spe registers */ ++ if (current->thread.used_spe) { ++ if (!memcpy(&frame->mc_vregs, current->thread.evr, ++ ELF_NEVRREG * sizeof(u32))) ++ return 1; ++ /* set MSR_SPE in the saved MSR value to indicate that ++ frame->mc_vregs contains valid data */ ++ if (__put_user(regs->msr | MSR_SPE, &frame->mc_gregs[PT_MSR])) ++ return 1; ++ } ++ /* else assert((regs->msr & MSR_SPE) == 0) */ ++ ++ /* We always copy to/from spefscr */ ++ if (__put_user(current->thread.spefscr, (u32 *)&frame->mc_vregs + ELF_NEVRREG)) ++ return 1; ++#endif /* CONFIG_SPE */ ++#endif /* 0 */ ++ ++ if (sigret) { ++ /* Set up the sigreturn trampoline: li r0,sigret; sc */ ++ if (__put_user(0x38000000UL + sigret, &frame->tramp[0]) ++ || __put_user(0x44000002UL, &frame->tramp[1])) ++ return 1; ++#if 0 ++ flush_icache_range((unsigned long) &frame->tramp[0], ++ (unsigned long) &frame->tramp[2]); ++#endif ++ } ++ ++ return 0; ++} ++ ++static int ++restore_user_regs(CPUState *env, struct target_mcontext *sr, int sig) ++{ ++ target_ulong save_r2 = 0; ++ target_ulong saved_xer; ++ target_ulong saved_cr; ++ double saved_fpscr; ++ ++#if 0 /* FIXME: handle Altivec, SPE */ ++#if defined(CONFIG_ALTIVEC) || defined(CONFIG_SPE) ++ unsigned long msr; ++#endif ++#endif /* 0 */ ++ ++ /* backup/restore the TLS as we don't want it to be modified */ ++ if (!sig) ++ save_r2 = env->gpr[2]; ++ ++ /* Copy all registers except MSR */ ++ /* Note: this needs to be in the same order as target_pt_regs */ ++ if(!memcpy(env->gpr, &sr->mc_gregs, ++ 32*sizeof(target_elf_greg_t)) ++ || __get_user(env->nip, &sr->mc_gregs[32]) ++ /* FIXME: || __get_user(orig_gpr3, &sr->mc_gregs[34]) */ ++ || __get_user(env->ctr, &sr->mc_gregs[35]) ++ || __get_user(env->lr, &sr->mc_gregs[36]) ++ || __get_user(saved_xer, &sr->mc_gregs[37]) ++ || __get_user(saved_cr, &sr->mc_gregs[38]) ++ || __get_user(env->spr[SPR_MQ], &sr->mc_gregs[39]) ++ /* FIXME: || __get_user(trap, &sr->mc_gregs[40]) */ ++ || __get_user(env->spr[SPR_DAR], &sr->mc_gregs[41]) ++ || __get_user(env->spr[SPR_DSISR], &sr->mc_gregs[42]) ++ /* FIXME: || __get_user(result, &sr->mc_gregs[43]) */) ++ return 1; ++ do_store_xer(env, saved_xer); ++ do_store_cr(env, saved_cr, 0xFF); ++ ++ if (!sig) ++ env->gpr[2] = save_r2; ++ ++ /* The kernel delays restoring the floating-point registers until the ++ * thread uses floating-point again. For simplicity, just restore the ++ * registers now. */ ++ if(!memcpy(env->fpr, &sr->mc_fregs, ++ 32*sizeof(target_elf_fpreg_t)) ++ || __get_user(saved_fpscr, &sr->mc_fregs[32])) ++ return 1; ++ do_store_fpscr(env, saved_fpscr, 0xFF); ++ ++#if 0 /* FIXME: handle Altivec, SPE */ ++#ifdef CONFIG_ALTIVEC ++ /* force the process to reload the altivec registers from ++ current->thread when it next does altivec instructions */ ++ regs->msr &= ~MSR_VEC; ++ if (!__get_user(msr, &sr->mc_gregs[PT_MSR]) && (msr & MSR_VEC) != 0) { ++ /* restore altivec registers from the stack */ ++ if (!memcpy(current->thread.vr, &sr->mc_vregs, ++ sizeof(sr->mc_vregs))) ++ return 1; ++ } else if (current->thread.used_vr) ++ memset(¤t->thread.vr, 0, ELF_NVRREG * sizeof(vector128)); ++ ++ /* Always get VRSAVE back */ ++ if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32])) ++ return 1; ++#endif /* CONFIG_ALTIVEC */ ++ ++#ifdef CONFIG_SPE ++ /* force the process to reload the spe registers from ++ current->thread when it next does spe instructions */ ++ regs->msr &= ~MSR_SPE; ++ if (!__get_user(msr, &sr->mc_gregs[PT_MSR]) && (msr & MSR_SPE) != 0) { ++ /* restore spe registers from the stack */ ++ if (!memcpy(current->thread.evr, &sr->mc_vregs, ++ ELF_NEVRREG * sizeof(u32))) ++ return 1; ++ } else if (current->thread.used_spe) ++ memset(¤t->thread.evr, 0, ELF_NEVRREG * sizeof(u32)); ++ ++ /* Always get SPEFSCR back */ ++ if (__get_user(current->thread.spefscr, (u32 *)&sr->mc_vregs + ELF_NEVRREG)) ++ return 1; ++#endif /* CONFIG_SPE */ ++#endif /* 0 */ ++ ++#if 0 /* FIXME: handle floating-point, Altivec, SPE */ ++#ifndef CONFIG_SMP ++ preempt_disable(); ++ if (last_task_used_math == current) ++ last_task_used_math = NULL; ++ if (last_task_used_altivec == current) ++ last_task_used_altivec = NULL; ++ if (last_task_used_spe == current) ++ last_task_used_spe = NULL; ++ preempt_enable(); ++#endif ++#endif /* 0 */ ++ return 0; ++} ++ ++static void setup_frame(int sig, struct emulated_sigaction *ka, ++ target_sigset_t *oldset, CPUState *env) ++{ ++ struct target_sigcontext *sc; ++ struct target_sigregs *frame; ++ target_ulong origsp = env->gpr[1]; ++ target_ulong newsp = origsp; ++ ++ /* Set up Signal Frame */ ++ newsp -= sizeof(struct target_sigregs); ++ frame = (struct target_sigregs *) newsp; ++ ++ /* Put a sigcontext on the stack */ ++ newsp -= sizeof(*sc); ++ sc = (struct target_sigcontext *) newsp; ++ ++ /* create a stack frame for the caller of the handler */ ++ newsp -= __SIGNAL_FRAMESIZE; ++ ++ if (!access_ok(VERIFY_WRITE, (void *) newsp, origsp - newsp)) ++ goto badframe; ++ ++#if TARGET_NSIG != 64 ++#error "Please adjust handle_signal()" ++#endif ++ if (__put_user((target_ulong) ka->sa._sa_handler, &sc->handler) ++ || __put_user(oldset->sig[0], &sc->oldmask) ++ || __put_user(oldset->sig[1], &sc->_unused[3]) ++ || __put_user(frame, (target_ulong *)&sc->regs) ++ || __put_user(sig, &sc->signal)) ++ goto badframe; ++ ++ if (save_user_regs(env, &frame->mctx, TARGET_NR_sigreturn)) ++ goto badframe; ++ ++ if (put_user(env->gpr[1], (unsigned long *)newsp)) ++ goto badframe; ++ env->gpr[1] = newsp; ++ env->gpr[3] = sig; ++ env->gpr[4] = (unsigned long) sc; ++ env->nip = (unsigned long) ka->sa._sa_handler; ++ env->lr = (unsigned long) frame->mctx.tramp; ++ /* FIXME: env->trap = 0; */ ++ ++ return; ++ ++badframe: ++#ifdef DEBUG_SIGNAL ++ fprintf(stderr, ++ "badframe in handle_signal, frame=%p newsp=%lx\n", ++ frame, newsp); ++#endif ++ force_sig(TARGET_SIGSEGV); ++} ++ ++static void setup_rt_frame(int sig, struct emulated_sigaction *ka, ++ target_siginfo_t *info, ++ target_sigset_t *set, CPUState *env) ++{ ++ fprintf(stderr, "setup_rt_frame: not implemented\n"); ++} ++ ++long do_sigreturn(CPUState *env) ++{ ++ struct target_sigcontext *sc; ++ struct target_sigcontext sigctx; ++ struct target_mcontext *sr; ++ target_sigset_t set; ++ sigset_t host_set; ++ ++ /* Always make any pending restarted system calls return -EINTR */ ++#if 0 /* FIXME */ ++ current_thread_info()->restart_block.fn = do_no_restart_syscall; ++#endif ++ ++ sc = (struct target_sigcontext *)(env->gpr[1] + __SIGNAL_FRAMESIZE); ++ if (!memcpy(&sigctx, sc, sizeof(sigctx))) ++ goto badframe; ++ ++ set.sig[0] = sigctx.oldmask; ++ set.sig[1] = sigctx._unused[3]; ++ target_to_host_sigset_internal(&host_set, &set); ++ sigprocmask(SIG_SETMASK, &host_set, NULL); ++ ++ sr = (struct target_mcontext *) tswapl((target_ulong)sigctx.regs); ++ if (!access_ok(VERIFY_READ, sr, sizeof(*sr)) ++ || restore_user_regs(env, sr, 1)) ++ goto badframe; ++ ++ return 0; ++ ++badframe: ++ force_sig(TARGET_SIGSEGV); ++ return 0; ++} ++ ++long do_rt_sigreturn(CPUState *env) ++{ ++ fprintf(stderr, "do_rt_sigreturn: not implemented\n"); ++ return -ENOSYS; ++} ++ + #else + + static void setup_frame(int sig, struct emulated_sigaction *ka, --- qemu-0.9.0.orig/debian/patches/39_syscall_fadvise64.patch +++ qemu-0.9.0/debian/patches/39_syscall_fadvise64.patch @@ -0,0 +1,29 @@ +Index: linux-user/arm/syscall_nr.h +=================================================================== +--- linux-user/arm/syscall_nr.h.orig 2007-02-07 11:31:53.000000000 +0200 ++++ linux-user/arm/syscall_nr.h 2007-02-07 11:35:29.000000000 +0200 +@@ -273,6 +273,7 @@ + #define TARGET_NR_fstatfs64 267 + #define TARGET_NR_tgkill 268 + #define TARGET_NR_utimes 269 ++#define TARGET_NR_fadvise64_64 270 + #define TARGET_NR_arm_fadvise64_64 270 + #define TARGET_NR_pciconfig_iobase 271 + #define TARGET_NR_pciconfig_read 272 +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2007-02-07 11:31:23.000000000 +0200 ++++ linux-user/syscall.c 2007-02-07 11:31:23.000000000 +0200 +@@ -3967,6 +3967,12 @@ long do_syscall(void *cpu_env, int num, + ret = get_errno(mincore((void*)arg1, (size_t)arg2, (unsigned char*)arg3)); + break; + #endif ++#ifdef TARGET_NR_fadvise64_64 ++ case TARGET_NR_fadvise64_64: ++ /* Just return success */ ++ ret = get_errno(0); ++ break; ++#endif + #ifdef TARGET_NR_madvise + case TARGET_NR_madvise: + /* A straight passthrough may not be safe because qemu sometimes --- qemu-0.9.0.orig/debian/patches/series +++ qemu-0.9.0/debian/patches/series @@ -0,0 +1,33 @@ +01_typo_qemu-img.patch -p0 +02_snapshot_use_tmpdir.patch -p0 +03_machines_list_no_error.patch -p0 +04_do_not_print_rtc_freq_if_ok.patch +05_non-fatal_if_linux_hd_missing.patch +06_exit_segfault.patch -p0 +10_signal_jobs.patch -p0 +11_signal_sigaction.patch -p0 +12_signal_powerpc_support.patch +21_net_soopts.patch -p0 +22_net_tuntap_stall.patch -p0 +30_syscall_ipc.patch -p0 +31_syscalls.patch -p0 +32_syscall_sysctl.patch -p0 +33_syscall_ppc_clone.patch -p0 +35_syscall_sockaddr.patch -p0 +36_syscall_prctl.patch -p0 +37_syscall_mount.patch -p0 +39_syscall_fadvise64.patch -p0 +40_sparc_fp_to_int.patch -p0 +41_arm_fpa_sigfpe.patch -p0 +42_arm_tls.patch -p0 +43_arm_cpustate.patch -p0 +52_ne2000_return.patch +55_unmux_socketcall.patch -p0 +60_ppc_ld.patch +61_safe_64bit_int.patch -p0 +62_linux_boot_nasm.patch -p0 +63_sparc_build.patch -p0 +64_ppc_asm_constraints.patch +65_kfreebsd.patch -p0 +66_tls_ld.patch -p0 +80_ui_curses.patch -p0 --- qemu-0.9.0.orig/debian/patches/35_syscall_sockaddr.patch +++ qemu-0.9.0/debian/patches/35_syscall_sockaddr.patch @@ -0,0 +1,68 @@ +#DPATCHLEVEL=0 +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2007-02-07 10:46:16.000000000 +0200 ++++ linux-user/syscall.c 2007-02-07 10:47:35.000000000 +0200 +@@ -52,6 +52,7 @@ + //#include + #include + #include ++#include + #include + + #define termios host_termios +@@ -407,12 +408,15 @@ static long do_select(long n, + + static inline void target_to_host_sockaddr(struct sockaddr *addr, + target_ulong target_addr, +- socklen_t len) ++ socklen_t *target_len) + { ++ const socklen_t len = sizeof (struct sockaddr_un); + struct target_sockaddr *target_saddr; + +- target_saddr = lock_user(target_addr, len, 1); +- memcpy(addr, target_saddr, len); ++ target_saddr = lock_user(target_addr, *target_len, 1); ++ if (target_saddr->sa_family == AF_UNIX && *target_len > len) ++ *target_len = len; ++ memcpy(addr, target_saddr, *target_len); + addr->sa_family = tswap16(target_saddr->sa_family); + unlock_user(target_saddr, target_addr, 0); + } +@@ -877,7 +881,7 @@ static long do_bind(int sockfd, target_u + { + void *addr = alloca(addrlen); + +- target_to_host_sockaddr(addr, target_addr, addrlen); ++ target_to_host_sockaddr(addr, target_addr, &addrlen); + return get_errno(bind(sockfd, addr, addrlen)); + } + +@@ -886,7 +890,7 @@ static long do_connect(int sockfd, targe + { + void *addr = alloca(addrlen); + +- target_to_host_sockaddr(addr, target_addr, addrlen); ++ target_to_host_sockaddr(addr, target_addr, &addrlen); + return get_errno(connect(sockfd, addr, addrlen)); + } + +@@ -905,7 +909,7 @@ static long do_sendrecvmsg(int fd, targe + msg.msg_namelen = tswap32(msgp->msg_namelen); + msg.msg_name = alloca(msg.msg_namelen); + target_to_host_sockaddr(msg.msg_name, tswapl(msgp->msg_name), +- msg.msg_namelen); ++ &msg.msg_namelen); + } else { + msg.msg_name = NULL; + msg.msg_namelen = 0; +@@ -1013,7 +1017,7 @@ static long do_sendto(int fd, target_ulo + host_msg = lock_user(msg, len, 1); + if (target_addr) { + addr = alloca(addrlen); +- target_to_host_sockaddr(addr, target_addr, addrlen); ++ target_to_host_sockaddr(addr, target_addr, &addrlen); + ret = get_errno(sendto(fd, host_msg, len, flags, addr, addrlen)); + } else { + ret = get_errno(send(fd, host_msg, len, flags)); --- qemu-0.9.0.orig/debian/patches/62_linux_boot_nasm.patch +++ qemu-0.9.0/debian/patches/62_linux_boot_nasm.patch @@ -0,0 +1,62 @@ +#DPATCHLEVEL=0 +diff -Naur pc-bios.orig/linux_boot.asm pc-bios/linux_boot.asm +--- pc-bios.orig/linux_boot.asm 1970-01-01 02:00:00.000000000 +0200 ++++ pc-bios/linux_boot.asm 2006-01-07 09:08:24.000000000 +0200 +@@ -0,0 +1,31 @@ ++; ++; QEMU Boot sector to launch a preloaded Linux kernel ++; Copyright (c) 2004 Fabrice Bellard ++; Copyright (c) 2006 Guillem Jover ++; ++ ++LOAD_SEG equ 0x9000 ++ ++bits 16 ++global _start ++ ++section .text ++ ++_start: ++ cli ++ cld ++ mov ax, LOAD_SEG ++ mov ds, ax ++ mov es, ax ++ mov fs, ax ++ mov gs, ax ++ mov ss, ax ++ mov sp, 0x8ffe ++ jmp LOAD_SEG + 0x20:0 ++ ++ times 510 - ($ - $$) db 0 ++ ++ ; boot sector signature ++ db 0x55 ++ db 0xaa ++ +diff -Naur pc-bios.orig/Makefile pc-bios/Makefile +--- pc-bios.orig/Makefile 2005-12-20 00:51:53.000000000 +0200 ++++ pc-bios/Makefile 2006-01-16 07:18:54.000000000 +0200 +@@ -5,19 +5,12 @@ + + DEFINES= + +-TARGETS= +-ifeq ($(ARCH),i386) + TARGETS+=linux_boot.bin +-endif + + all: $(TARGETS) + +-linux_boot.bin: linux_boot.o +- ld --oformat binary -Ttext 0 -o $@ $< +- chmod a-x $@ +- +-%.o: %.S +- $(CC) $(DEFINES) -c -o $@ $< ++linux_boot.bin: linux_boot.asm ++ nasm -f bin -o $@ $< + + clean: + rm -f $(TARGETS) *.o *~ + --- qemu-0.9.0.orig/debian/patches/66_tls_ld.patch +++ qemu-0.9.0/debian/patches/66_tls_ld.patch @@ -0,0 +1,46 @@ +--- arm.ld 2006-05-03 23:32:58.000000000 +0300 ++++ arm.ld 2006-05-29 18:25:00.000000000 +0300 +@@ -26,6 +26,10 @@ + { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } ++ .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } ++ .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } ++ .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } ++ .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } +@@ -54,6 +58,9 @@ + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + .reginfo : { *(.reginfo) } ++ /* Thread Local Storage sections */ ++ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } ++ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(0x100000) + (. & (0x100000 - 1)); +--- i386.ld 2006-05-03 23:32:58.000000000 +0300 ++++ i386.ld 2006-05-29 18:21:33.000000000 +0300 +@@ -28,6 +28,10 @@ + { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } ++ .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } ++ .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } ++ .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } ++ .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } +@@ -53,6 +57,9 @@ + _etext = .; + PROVIDE (etext = .); + .fini : { *(.fini) } =0x47ff041f ++ /* Thread Local Storage sections */ ++ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } ++ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + . = ALIGN(32 / 8); + PROVIDE (__preinit_array_start = .); + .preinit_array : { *(.preinit_array) } --- qemu-0.9.0.orig/debian/patches/02_snapshot_use_tmpdir.patch +++ qemu-0.9.0/debian/patches/02_snapshot_use_tmpdir.patch @@ -0,0 +1,17 @@ +#DPATCHLEVEL=0 +--- block.c 2006-05-03 23:32:58.000000000 +0300 ++++ block.c 2006-05-28 17:04:15.000000000 +0300 +@@ -169,8 +169,12 @@ + void get_tmp_filename(char *filename, int size) + { + int fd; ++ char *tmpdir; + /* XXX: race condition possible */ +- pstrcpy(filename, size, "/tmp/vl.XXXXXX"); ++ tmpdir = getenv("TMPDIR"); ++ if (!tmpdir) ++ tmpdir = "/tmp"; ++ snprintf(filename, size, "%s/vl.XXXXXX", tmpdir); + fd = mkstemp(filename); + close(fd); + } --- qemu-0.9.0.orig/debian/patches/36_syscall_prctl.patch +++ qemu-0.9.0/debian/patches/36_syscall_prctl.patch @@ -0,0 +1,23 @@ +#DPATCHLEVEL=0 +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2006-11-05 07:07:41.000000000 +0200 ++++ linux-user/syscall.c 2006-11-05 07:07:44.000000000 +0200 +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -3486,7 +3487,8 @@ long do_syscall(void *cpu_env, int num, + case TARGET_NR_nfsservctl: + goto unimplemented; + case TARGET_NR_prctl: +- goto unimplemented; ++ ret = get_errno(prctl(arg1, arg2, arg3, arg4, arg5)); ++ break; + #ifdef TARGET_NR_pread + case TARGET_NR_pread: + page_unprotect_range(arg2, arg3); --- qemu-0.9.0.orig/debian/patches/32_syscall_sysctl.patch +++ qemu-0.9.0/debian/patches/32_syscall_sysctl.patch @@ -0,0 +1,52 @@ +#DPATCHLEVEL=0 +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2006-11-05 07:07:25.000000000 +0200 ++++ linux-user/syscall.c 2006-11-05 07:07:28.000000000 +0200 +@@ -51,6 +51,7 @@ + //#include + #include + #include ++#include + + #define termios host_termios + #define winsize host_winsize +@@ -3386,9 +3387,35 @@ long do_syscall(void *cpu_env, int num, + ret = get_errno(fdatasync(arg1)); + break; + case TARGET_NR__sysctl: +- /* We don't implement this, but ENODIR is always a safe +- return value. */ +- return -ENOTDIR; ++ { ++ struct __sysctl_args *args = (struct __sysctl_args *) arg1; ++ int *name_target, *name, nlen, *oldlenp, oldlen, newlen, i; ++ void *oldval, *newval; ++ ++ name_target = (int *) tswapl((long) args->name); ++ nlen = tswapl(args->nlen); ++ oldval = (void *) tswapl((long) args->oldval); ++ oldlenp = (int *) tswapl((long) args->oldlenp); ++ oldlen = tswapl(*oldlenp); ++ newval = (void *) tswapl((long) args->newval); ++ newlen = tswapl(args->newlen); ++ ++ name = alloca(nlen * sizeof (int)); ++ for (i = 0; i < nlen; i++) ++ name[i] = tswapl(name_target[i]); ++ ++ if (nlen == 2 && name[0] == CTL_KERN && name[1] == KERN_VERSION) { ++ ret = get_errno( ++ sysctl(name, nlen, oldval, &oldlen, newval, newlen)); ++ if (!is_error(ret)) { ++ *oldlenp = tswapl(oldlen); ++ } ++ } else { ++ gemu_log("qemu: Unsupported sysctl name\n"); ++ ret = -ENOSYS; ++ } ++ } ++ break; + case TARGET_NR_sched_setparam: + { + struct sched_param *target_schp; --- qemu-0.9.0.orig/debian/patches/65_kfreebsd.patch +++ qemu-0.9.0/debian/patches/65_kfreebsd.patch @@ -0,0 +1,39 @@ +Index: configure +=================================================================== +--- configure.orig 2006-07-22 20:23:34.000000000 +0300 ++++ configure 2006-11-04 21:08:25.000000000 +0200 +@@ -108,6 +108,12 @@ CFLAGS="-O2 -mno-cygwin" + MINGW32*) + mingw32="yes" + ;; ++GNU/kFreeBSD) ++oss="yes" ++if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then ++ kqemu="yes" ++fi ++;; + FreeBSD) + bsd="yes" + oss="yes" +Index: vl.c +=================================================================== +--- vl.c.orig 2006-11-04 21:02:57.000000000 +0200 ++++ vl.c 2006-11-04 21:08:26.000000000 +0200 +@@ -46,6 +46,8 @@ + #ifndef __APPLE__ + #include + #endif ++#elif defined (__GLIBC__) && defined (__FreeBSD_kernel__) ++#include + #else + #ifndef __sun__ + #include +@@ -3026,7 +3028,7 @@ static TAPState *net_tap_fd_init(VLANSta + return s; + } + +-#ifdef _BSD ++#if defined (_BSD) || defined (__FreeBSD_kernel__) + static int tap_open(char *ifname, int ifname_size) + { + int fd; --- qemu-0.9.0.orig/debian/patches/05_non-fatal_if_linux_hd_missing.patch +++ qemu-0.9.0/debian/patches/05_non-fatal_if_linux_hd_missing.patch @@ -0,0 +1,13 @@ +#DPATCHLEVEL=1 +Index: qemu-0.8.2/hw/pc.c +=================================================================== +--- qemu-0.8.2.orig/hw/pc.c 2006-07-22 20:23:34.000000000 +0300 ++++ qemu-0.8.2/hw/pc.c 2006-08-11 19:31:00.000000000 +0300 +@@ -696,7 +696,6 @@ static void pc_init1(int ram_size, int v + + if (bs_table[0] == NULL) { + fprintf(stderr, "A disk image must be given for 'hda' when booting a Linux kernel\n"); +- exit(1); + } + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, LINUX_BOOT_FILENAME); + ret = load_image(buf, bootsect); --- qemu-0.9.0.orig/debian/patches/30_syscall_ipc.patch +++ qemu-0.9.0/debian/patches/30_syscall_ipc.patch @@ -0,0 +1,30 @@ +#DPATCHLEVEL=0 +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2007-02-07 10:39:16.000000000 +0200 ++++ linux-user/syscall.c 2007-02-07 10:42:55.000000000 +0200 +@@ -41,8 +41,10 @@ + #include + #include + #include ++#include + #include + #include ++#include + #include + #include + #include +@@ -1333,11 +1335,11 @@ static long do_ipc(long call, long first + ret = get_errno(shmctl(first, second, NULL)); + break; + default: +- goto unimplemented; ++ ret = get_errno(shmctl(first, second, (struct shmid_ds *) ptr)); ++ break; + } + break; + default: +- unimplemented: + gemu_log("Unsupported ipc call: %ld (version %d)\n", call, version); + ret = -ENOSYS; + break; --- qemu-0.9.0.orig/debian/patches/41_arm_fpa_sigfpe.patch +++ qemu-0.9.0/debian/patches/41_arm_fpa_sigfpe.patch @@ -0,0 +1,100 @@ +#DPATCHLEVEL=0 +Index: linux-user/main.c +=================================================================== +--- linux-user/main.c.orig 2006-08-11 19:31:04.000000000 +0300 ++++ linux-user/main.c 2006-08-11 19:31:40.000000000 +0300 +@@ -323,18 +323,67 @@ void cpu_loop(CPUARMState *env) + { + TaskState *ts = env->opaque; + uint32_t opcode; ++ int rc; + + /* we handle the FPU emulation here, as Linux */ + /* we get the opcode */ + opcode = tget32(env->regs[15]); + +- if (EmulateAll(opcode, &ts->fpa, env) == 0) { ++ rc = EmulateAll(opcode, &ts->fpa, env); ++ if (rc == 0) { /* illegal instruction */ + info.si_signo = SIGILL; + info.si_errno = 0; + info.si_code = TARGET_ILL_ILLOPN; + info._sifields._sigfault._addr = env->regs[15]; + queue_signal(info.si_signo, &info); +- } else { ++ } else if (rc < 0) { /* FP exception */ ++ int arm_fpe=0; ++ ++ /* translate softfloat flags to FPSR flags */ ++ if (-rc & float_flag_invalid) ++ arm_fpe |= BIT_IOC; ++ if (-rc & float_flag_divbyzero) ++ arm_fpe |= BIT_DZC; ++ if (-rc & float_flag_overflow) ++ arm_fpe |= BIT_OFC; ++ if (-rc & float_flag_underflow) ++ arm_fpe |= BIT_UFC; ++ if (-rc & float_flag_inexact) ++ arm_fpe |= BIT_IXC; ++ ++ FPSR fpsr = ts->fpa.fpsr; ++ //printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe); ++ ++ if (fpsr & (arm_fpe << 16)) { /* exception enabled? */ ++ info.si_signo = SIGFPE; ++ info.si_errno = 0; ++ ++ /* ordered by priority, least first */ ++ if (arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES; ++ if (arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND; ++ if (arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF; ++ if (arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV; ++ if (arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV; ++ ++ info._sifields._sigfault._addr = env->regs[15]; ++ queue_signal(info.si_signo, &info); ++ } else { ++ env->regs[15] += 4; ++ } ++ ++ /* accumulate unenabled exceptions */ ++ if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC)) ++ fpsr |= BIT_IXC; ++ if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC)) ++ fpsr |= BIT_UFC; ++ if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC)) ++ fpsr |= BIT_OFC; ++ if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC)) ++ fpsr |= BIT_DZC; ++ if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC)) ++ fpsr |= BIT_IOC; ++ ts->fpa.fpsr=fpsr; ++ } else { /* everything OK */ + /* increment PC */ + env->regs[15] += 4; + } +Index: target-arm/nwfpe/fpa11.c +=================================================================== +--- target-arm/nwfpe/fpa11.c.orig 2006-07-22 20:23:34.000000000 +0300 ++++ target-arm/nwfpe/fpa11.c 2006-08-11 19:31:40.000000000 +0300 +@@ -162,6 +162,8 @@ unsigned int EmulateAll(unsigned int opc + fpa11->initflag = 1; + } + ++ set_float_exception_flags(0, &fpa11->fp_status); ++ + if (TEST_OPCODE(opcode,MASK_CPRT)) + { + //fprintf(stderr,"emulating CPRT\n"); +@@ -191,6 +193,11 @@ unsigned int EmulateAll(unsigned int opc + } + + // restore_flags(flags); ++ if(nRc == 1 && get_float_exception_flags(&fpa11->fp_status)) ++ { ++ //printf("fef 0x%x\n",float_exception_flags); ++ nRc=-get_float_exception_flags(&fpa11->fp_status); ++ } + + //printf("returning %d\n",nRc); + return(nRc); --- qemu-0.9.0.orig/debian/patches/33_syscall_ppc_clone.patch +++ qemu-0.9.0/debian/patches/33_syscall_ppc_clone.patch @@ -0,0 +1,18 @@ +#DPATCHLEVEL=0 +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2006-11-05 07:07:28.000000000 +0200 ++++ linux-user/syscall.c 2006-11-05 07:07:32.000000000 +0200 +@@ -1804,11 +1804,7 @@ int do_fork(CPUState *env, unsigned int + if (!newsp) + newsp = env->gpr[1]; + new_env->gpr[1] = newsp; +- { +- int i; +- for (i = 7; i < 32; i++) +- new_env->gpr[i] = 0; +- } ++ new_env->gpr[3] = 0; + #elif defined(TARGET_SH4) + if (!newsp) + newsp = env->gregs[15]; --- qemu-0.9.0.orig/debian/patches/04_do_not_print_rtc_freq_if_ok.patch +++ qemu-0.9.0/debian/patches/04_do_not_print_rtc_freq_if_ok.patch @@ -0,0 +1,21 @@ +#DPATCHLEVEL=1 +Index: qemu-0.8.2/vl.c +=================================================================== +--- qemu-0.8.2.orig/vl.c 2006-08-11 19:30:53.000000000 +0300 ++++ qemu-0.8.2/vl.c 2006-08-11 19:30:56.000000000 +0300 +@@ -898,10 +898,14 @@ static int rtc_fd; + + static int start_rtc_timer(void) + { ++ unsigned long current_rtc_freq = 0; ++ + rtc_fd = open("/dev/rtc", O_RDONLY); + if (rtc_fd < 0) + return -1; +- if (ioctl(rtc_fd, RTC_IRQP_SET, RTC_FREQ) < 0) { ++ ioctl(rtc_fd, RTC_IRQP_READ, ¤t_rtc_freq); ++ if (current_rtc_freq != RTC_FREQ && ++ ioctl(rtc_fd, RTC_IRQP_SET, RTC_FREQ) < 0) { + fprintf(stderr, "Could not configure '/dev/rtc' to have a 1024 Hz timer. This is not a fatal\n" + "error, but for better emulation accuracy either use a 2.6 host Linux kernel or\n" + "type 'echo 1024 > /proc/sys/dev/rtc/max-user-freq' as root.\n"); --- qemu-0.9.0.orig/debian/patches/52_ne2000_return.patch +++ qemu-0.9.0/debian/patches/52_ne2000_return.patch @@ -0,0 +1,13 @@ +Index: qemu-0.8.2/hw/ne2000.c +=================================================================== +--- qemu-0.8.2.orig/hw/ne2000.c 2006-07-22 20:23:34.000000000 +0300 ++++ qemu-0.8.2/hw/ne2000.c 2006-09-25 04:09:07.000000000 +0300 +@@ -220,7 +220,7 @@ static int ne2000_can_receive(void *opaq + NE2000State *s = opaque; + + if (s->cmd & E8390_STOP) +- return 1; ++ return 0; + return !ne2000_buffer_full(s); + } + --- qemu-0.9.0.orig/debian/patches/21_net_soopts.patch +++ qemu-0.9.0/debian/patches/21_net_soopts.patch @@ -0,0 +1,195 @@ +Index: linux-user/syscall.c +=================================================================== +--- linux-user/syscall.c.orig 2007-02-06 01:01:54.000000000 +0200 ++++ linux-user/syscall.c 2007-02-07 11:38:52.000000000 +0200 +@@ -511,6 +511,28 @@ static inline void host_to_target_cmsg(s + msgh->msg_controllen = tswapl(space); + } + ++static inline void host_to_target_linger(target_ulong target_addr, ++ struct linger *host_l) ++{ ++ struct target_linger *target_l; ++ ++ lock_user_struct(target_l, target_addr, 0); ++ target_l->l_onoff = tswapl(host_l->l_onoff); ++ target_l->l_linger = tswapl(host_l->l_linger); ++ unlock_user_struct(target_l, target_addr, 1); ++} ++ ++static inline void target_to_host_linger(struct linger *host_l, ++ target_ulong target_addr) ++{ ++ struct target_linger *target_l; ++ ++ lock_user_struct(target_l, target_addr, 1); ++ host_l->l_onoff = tswapl(target_l->l_onoff); ++ host_l->l_linger = tswapl(target_l->l_linger); ++ unlock_user_struct(target_l, target_addr, 0); ++} ++ + static long do_setsockopt(int sockfd, int level, int optname, + target_ulong optval, socklen_t optlen) + { +@@ -556,7 +578,6 @@ static long do_setsockopt(int sockfd, in + break; + case TARGET_SOL_SOCKET: + switch (optname) { +- /* Options with 'int' argument. */ + case TARGET_SO_DEBUG: + optname = SO_DEBUG; + break; +@@ -613,16 +634,46 @@ static long do_setsockopt(int sockfd, in + case TARGET_SO_SNDTIMEO: + optname = SO_SNDTIMEO; + break; +- break; ++ case TARGET_SO_LINGER: ++ optname = SO_LINGER; ++ break; + default: + goto unimplemented; + } +- if (optlen < sizeof(uint32_t)) +- return -EINVAL; + +- val = tget32(optval); +- ret = get_errno(setsockopt(sockfd, SOL_SOCKET, optname, &val, sizeof(val))); +- break; ++ switch (optname) { ++ /* Options with non-'int' argument. */ ++ case SO_RCVTIMEO: ++ case SO_SNDTIMEO: ++ { ++ struct timeval tval; ++ if(optlen < sizeof(struct target_timeval)) ++ return -EINVAL; ++ target_to_host_timeval(&tval,optval); ++ ret = get_errno(setsockopt(sockfd, level, optname, &tval,sizeof(tval))); ++ } ++ break; ++ case SO_LINGER: ++ { ++ struct linger tmp; ++ if (optlen < sizeof(struct target_linger)) ++ return -EINVAL; ++ optname = SO_LINGER; ++ target_to_host_linger(&tmp,optval); ++ ret = get_errno(setsockopt(sockfd, level, optname, &tmp, sizeof(tmp))); ++ } ++ break; ++ /* All remaning options take an 'int' argument. */ ++ default: ++ { ++ if (optlen < sizeof(uint32_t)) ++ return -EINVAL; ++ ++ val = tget32(optval); ++ ret = get_errno(setsockopt(sockfd, SOL_SOCKET, optname, &val, sizeof(val))); ++ } ++ break; ++ } + default: + unimplemented: + gemu_log("Unsupported setsockopt level=%d optname=%d \n", level, optname); +@@ -640,13 +691,50 @@ static long do_getsockopt(int sockfd, in + case TARGET_SOL_SOCKET: + level = SOL_SOCKET; + switch (optname) { +- case TARGET_SO_LINGER: ++ case TARGET_SO_LINGER: { ++ len=tget32(optlen); ++ if(len < sizeof(struct target_linger)) ++ return -EINVAL; ++ struct linger l; ++ len=sizeof(l); ++ ++ ret = get_errno(getsockopt(sockfd, level, optname, &l, &len)); ++ host_to_target_linger(optval,&l); ++ tput32(optlen, sizeof(struct target_linger)); ++ } ++ break; ++ + case TARGET_SO_RCVTIMEO: +- case TARGET_SO_SNDTIMEO: +- case TARGET_SO_PEERCRED: ++ case TARGET_SO_SNDTIMEO: { ++ len=tget32(optlen); ++ if(len < sizeof(struct target_timeval)) ++ return -EINVAL; ++ struct timeval tval; ++ len=sizeof(tval); ++ ++ ret = get_errno(getsockopt(sockfd, level, optname, &tval, &len)); ++ host_to_target_timeval(optval,&tval); ++ tput32(optlen, sizeof(struct target_timeval)); ++ } ++ break; ++ + case TARGET_SO_PEERNAME: + /* These don't just return a single integer */ + goto unimplemented; ++ case TARGET_SO_PEERCRED: { ++ struct ucred caller; ++ socklen_t optlen = sizeof (caller); ++ ret = get_errno(getsockopt(sockfd, SOL_SOCKET, SO_PEERCRED, ++ &caller, &optlen)); ++ ++ if (optlen != 0 && optval != 0) { ++ tput32(optval + 0, caller.pid); ++ tput32(optval + 4, caller.uid); ++ tput32(optval + 8, caller.gid); ++ } ++ } ++ break; ++ + default: + goto int_case; + } +@@ -841,14 +929,25 @@ static long do_sendrecvmsg(int fd, targe + static long do_accept(int fd, target_ulong target_addr, + target_ulong target_addrlen) + { +- socklen_t addrlen = tget32(target_addrlen); +- void *addr = alloca(addrlen); ++ socklen_t addrlen; ++ void *addr; + long ret; + +- ret = get_errno(accept(fd, addr, &addrlen)); ++ if (target_addrlen != (target_ulong)NULL && ++ target_addr != (target_ulong)NULL) { ++ addrlen = tget32(target_addrlen); ++ addr = alloca(addrlen); ++ ret = get_errno(accept(fd, addr, &addrlen)); ++ } else { ++ ret = get_errno(accept(fd, NULL, NULL)); ++ return ret; ++ } ++ + if (!is_error(ret)) { +- host_to_target_sockaddr(target_addr, addr, addrlen); +- tput32(target_addrlen, addrlen); ++ if (target_addr != (target_ulong)NULL) ++ host_to_target_sockaddr(target_addr, addr, addrlen); ++ if (target_addrlen != (target_ulong)NULL) ++ tput32(target_addrlen, addrlen); + } + return ret; + } +Index: linux-user/syscall_defs.h +=================================================================== +--- linux-user/syscall_defs.h.orig 2007-02-06 01:01:54.000000000 +0200 ++++ linux-user/syscall_defs.h 2007-02-07 11:38:16.000000000 +0200 +@@ -114,6 +114,11 @@ struct target_timespec { + target_long tv_nsec; + }; + ++struct target_linger { ++ target_long l_onoff; ++ target_long l_linger; ++}; ++ + struct target_itimerval { + struct target_timeval it_interval; + struct target_timeval it_value; --- qemu-0.9.0.orig/debian/patches/43_arm_cpustate.patch +++ qemu-0.9.0/debian/patches/43_arm_cpustate.patch @@ -0,0 +1,33 @@ +#DPATCHLEVEL=0 +--- exec.c 2005-12-20 00:51:53.000000000 +0200 ++++ exec.c 2006-03-10 16:43:28.000000000 +0200 +@@ -256,23 +256,17 @@ + + void cpu_exec_init(CPUState *env) + { +- CPUState **penv; +- int cpu_index; +- + if (!code_gen_ptr) { + code_gen_ptr = code_gen_buffer; + page_init(); + io_mem_init(); + } +- env->next_cpu = NULL; +- penv = &first_cpu; +- cpu_index = 0; +- while (*penv != NULL) { +- penv = (CPUState **)&(*penv)->next_cpu; +- cpu_index++; +- } +- env->cpu_index = cpu_index; +- *penv = env; ++ ++ if (first_cpu) ++ env->cpu_index = first_cpu->cpu_index + 1; ++ ++ env->next_cpu = first_cpu; ++ first_cpu = env; + } + + static inline void invalidate_page_bitmap(PageDesc *p) --- qemu-0.9.0.orig/debian/qemu-user.1 +++ qemu-0.9.0/debian/qemu-user.1 @@ -0,0 +1,38 @@ +.\" $Id: qemu-user.1 234 2007-02-07 22:57:18Z guillem $ +.TH qemu\-user 1 2007-02-08 "0.9.0" Debian +.SH NAME +qemu\-user \- QEMU User Emulator +.SH SYNOPSIS +.B qemu\-user +.RI [ options ] +.I program +.RI [ program-arguments... ] +.SH DESCRIPTION +The +.B qemu\-user +emulator can run binaries for other architectures but with the same operating +system as the current one. +.SH OPTIONS +.TP +.BR \-h +Print this help. +.TP +.BR \-g +Wait gdb connection to port 1234. +.TP +.BR \-L " \fI\fP" +Set the elf interpreter prefix (default=\fI/usr/gnemul/qemu\-arm\fP). +.TP +.BR \-s " \fI\fP" +Set the stack size in bytes (default=\fI524288\fP). +.TP +.BR \-d " \fI\fP" +Activate log (logfile=\fI/tmp/qemu.log\fP) +.TP +.BR \-p " \fI\fP" +Set the host page size to 'pagesize'. +.SH SEE ALSO +.BR qemu (1), +.BR qemu\-img (1). +.SH AUTHOR +This manual page was written by Guillem Jover . --- qemu-0.9.0.orig/debian/qemu-make-debian-root.8 +++ qemu-0.9.0/debian/qemu-make-debian-root.8 @@ -0,0 +1,39 @@ +.\" $Id: qemu-make-debian-root.8 175 2006-05-28 13:50:26Z guillem $ +.TH qemu\-make\-debian\-root 8 2006-05-28 "0.0" Debian +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +qemu\-make\-debian\-root \- Create a debian root image for qemu +.SH SYNOPSIS +.B qemu\-make\-debian\-root +.RI [ -k "] " +.I size-in-MiB distrib deburl image +.RI [ files-to-copy-in-/root ] +.SH DESCRIPTION +.B qemu\-make\-debian\-root +is a command to ease the creation of a debian root image for qemu. +The generated image is not bootable by itself, and an external kernel +is needed. It can be run with a command like: +.IP +.nf +.B qemu disk.img -kernel /boot/vmlinuz +.fi +.PP +.SH OPTIONS +.BR \-k +Keep file system. +.SH SEE ALSO +.BR qemu (1), +.BR qemu\-img (1). +.SH AUTHOR +This manual page was written by Guillem Jover . --- qemu-0.9.0.orig/debian/manpages +++ qemu-0.9.0/debian/manpages @@ -0,0 +1,2 @@ +debian/qemu-make-debian-root.8 +debian/qemu-user.1 --- qemu-0.9.0.orig/debian/tundev.c +++ qemu-0.9.0/debian/tundev.c @@ -0,0 +1,90 @@ +/* + * $Id: tundev.c 116 2005-10-30 14:18:08Z guillem $ + */ + +#define _GNU_SOURCE /* asprintf */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Tiny code to open tap/tun device, and hand the fd to qemu. + Run as root, drops to given user. */ +int main(int argc, char *argv[]) +{ + struct ifreq ifr; + struct passwd *p; + unsigned int i; + char *newargs[argc + 1]; + int fd; + + if (argc < 4) { + fprintf(stderr, + "Usage: tundev user logfile qemu ...\n"); + exit(1); + } + + fd = open("/dev/net/tun", O_RDWR); + if (fd < 0) { + perror("Could not open /dev/net/tun"); + exit(1); + } + + memset(&ifr, 0, sizeof(ifr)); + ifr.ifr_flags = IFF_TAP | IFF_NO_PI; + strncpy(ifr.ifr_name, "tun%d", IFNAMSIZ); + if (ioctl(fd, TUNSETIFF, (void *) &ifr) != 0) { + perror("Could not get tun device"); + exit(1); + } + + /* Set userid. */ + p = getpwnam(argv[1]); + if (!p) { + fprintf(stderr, "No user '%s'\n", argv[1]); + exit(1); + } + setgroups(0, NULL); + setgid(p->pw_gid); + if (setuid(p->pw_uid) != 0) { + perror("setting uid"); + exit(1); + } + + /* Insert -tun-fd */ + newargs[0] = argv[3]; + newargs[1] = "-tun-fd"; + asprintf(&newargs[2], "%d", fd); + for (i = 4; i <= argc; i++) + newargs[i-1] = argv[i]; + + if (strcmp(argv[2], "-") == 0) { + execvp(newargs[0], newargs); + exit(1); + } + + switch (fork()) { + case 0: { + close(1); + close(2); + open(argv[2], O_WRONLY|O_APPEND); + open(argv[2], O_WRONLY|O_APPEND); + close(0); + execvp(newargs[0], newargs); + exit(1); + } + case -1: + perror("fork failed"); + exit(1); + } + printf("%s\n", ifr.ifr_name); + exit(0); +} --- qemu-0.9.0.orig/debian/install +++ qemu-0.9.0/debian/install @@ -0,0 +1,3 @@ +debian/qemu-ifup etc/ +debian/qemu-make-debian-root usr/sbin/ +debian/overrides/qemu usr/share/lintian/overrides/ --- qemu-0.9.0.orig/debian/rules +++ qemu-0.9.0/debian/rules @@ -0,0 +1,115 @@ +#!/usr/bin/make -f +# +# $Id: rules 228 2007-02-07 10:52:01Z guillem $ +# + +DEB_HOST_ARCH_OS = $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) + +CC = gcc-3.4 +# WARNING: Removing no-strict-aliasing will make qemu insta-segfault. +CFLAGS = -Wall -g -fno-strict-aliasing + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +ifeq ($(DEB_HOST_ARCH_OS),linux) + conf_arch += --enable-alsa +endif + +D = $(CURDIR)/debian/qemu + +qemu_bios_files = \ + bios.bin \ + vgabios.bin \ + vgabios-cirrus.bin \ + video.x \ + openbios-sparc32 \ + pxe-ne2k_pci.bin \ + pxe-rtl8139.bin \ + pxe-pcnet.bin \ + ppc_rom.bin \ + proll.elf + +qemu_docs = \ + qemu-doc.html \ + qemu-tech.html \ + qemu.1 \ + qemu-img.1 + +include /usr/share/quilt/quilt.make + +config-host.mak: configure + dh_testdir + + CFLAGS="$(CFLAGS)" ./configure \ + --prefix=/usr \ + $(conf_arch) \ + --cc=$(CC) + +build: patch config-host.mak + dh_testdir + + $(MAKE) + $(MAKE) -C pc-bios + +clean: unpatch + dh_testdir + dh_testroot + + -$(MAKE) -C pc-bios clean + -$(MAKE) distclean + + rm -f $(qemu_docs) + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs -a + + # Make qemu's "make install" happy + for i in $(qemu_bios_files); do \ + touch pc-bios/$$i; \ + done + + $(MAKE) DESTDIR=$(D) install + + # Clean up the mess + for i in $(qemu_bios_files); do \ + rm -f pc-bios/$$i $(D)/usr/share/qemu/$$i; \ + done + +binary-indep: +# Nothing to do. + +binary-arch: install + dh_testdir + dh_testroot + dh_install -a + dh_installdebconf -a + dh_installdocs -a + dh_installexamples -a + dh_installlogrotate -a + dh_installman -a + dh_installinfo -a + dh_installchangelogs -a Changelog + dh_link -a + dh_strip -a + dh_compress -a + dh_fixperms -a + chmod a+x $(D)/etc/qemu-ifup + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-indep binary-arch + +.PHONY: build clean binary-indep binary-arch binary install + --- qemu-0.9.0.orig/debian/qemu-make-debian-root +++ qemu-0.9.0/debian/qemu-make-debian-root @@ -0,0 +1,142 @@ +#! /bin/sh +# +# $Id: qemu-make-debian-root 204 2006-11-04 18:16:18Z guillem $ +# +# Script to make a debian root image. +# + +set -e + +which uudecode >/dev/null || { + echo "error: missing sharutils package" >&2 + exit 1 +} + +which debootstrap >/dev/null || { + echo "error: missing debootstrap package" >&2 + exit 1 +} + +KEEPFS=0 +if [ "$1" = "-k" ]; then + KEEPFS=1 + shift +fi + +if [ $# -lt 4 ]; then + echo Usage: "$0 [-k] size-in-MB distrib deburl image [files_to_copy_in_/root]" >&2 + echo "eg $0 150 sid http://proxy:10000/debian qemu" >&2 + exit 1 +fi + +SIZE=$1 +DISTRO=$2 +URL=$3 +IMAGE=$4 +shift 4 + +# now files to copy are in "$@". We don't put them in a variable +# because that would coufuse spaces-in-filenames with +# whitespace-separation. + + +if [ $SIZE -lt 130 ]; then + echo 'Size must be at least 130 megabytes (Debian unstable takes 100)' >&2 + exit 1 +fi + +cleanup() +{ + echo Cleaning up... >&2 + umount -d /tmp/mount.$$ || true + rm -f $IMAGE.ext2 $IMAGE +} + +trap cleanup EXIT + +HEADS=16 +SECTORS=63 +# 512 bytes in a sector: cancel the 512 with one of the 1024s... +CYLINDERS=$(( $SIZE * 1024 * 2 / ($HEADS * $SECTORS) )) + +# Create a filesystem: one track for partition table. +dd bs=$(($SECTORS * 512)) if=/dev/zero of=$IMAGE.ext2 count=$(($CYLINDERS * $HEADS - 1)) +mke2fs -q -m1 -F $IMAGE.ext2 + +# Mount it. +mkdir /tmp/mount.$$ +mount -o loop $IMAGE.ext2 /tmp/mount.$$ + +# Do debian install on it. +#debootstrap --exclude=syslinux,at,exim,mailx,libstdc++2.10-glibc2.2,mbr,setserial,fdutils,info,ipchains,lilo,pcmcia-cs,ppp,pppoe,pppoeconf,pppconfig $DISTRO /tmp/mount.$$ $URL +debootstrap --exclude=syslinux,at,exim,mailx,libstdc++2.10-glibc2.2,mbr,setserial,fdutils,info,ipchains,iptables,lilo,pcmcia-cs,ppp,pppoe,pppoeconf,pppconfig,wget,telnet,cron,logrotate,exim4,exim4-base,exim4-config,exim4-daemon-light,pciutils,modconf,tasksel $DISTRO /tmp/mount.$$ $URL + +# Final configuration. +cat > /tmp/mount.$$/etc/fstab < /tmp/mount.$$/etc/inittab.new +mv /tmp/mount.$$/etc/inittab.new /tmp/mount.$$/etc/inittab + +# Set hostname to base of image name. +basename $IMAGE > /tmp/mount.$$/etc/hostname + +# Create /etc/shadow +chroot /tmp/mount.$$ pwconv + +# Set root password to "root" +sed 's/^root:[^:]*/root:$1$aybpiIGf$cB7iFDNZvViQtQjEZ5HFQ0/' < /tmp/mount.$$/etc/shadow > /tmp/mount.$$/etc/shadow.new +mv /tmp/mount.$$/etc/shadow.new /tmp/mount.$$/etc/shadow + +# Remove packages we don't need +chroot /tmp/mount.$$ /usr/bin/dpkg --remove console-common console-tools console-data base-config man-db manpages +# Try to remove all libraries: some won't be removable. +chroot /tmp/mount.$$ dpkg --remove `chroot /tmp/mount.$$ dpkg --get-selections | sed -n 's/^\(lib[^ \t]*\)[\t ]*install/\1/p'` 2>/dev/null || true + + +# Copy wanted files to /root if asked to +if [ $# -gt 0 ]; then + cp -a "$@" /tmp/mount.$$/root/ +fi +umount -d /tmp/mount.$$ + +# Create file with partition table. +uudecode -o- << "EOF" | gunzip > $IMAGE +begin 664 partition-table.gz +M'XL("*_<##\"`W!A