From: Jocelyn Mayer <jma@netgem.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Misc patches for qemu
Date: 24 Jun 2003 22:18:42 +0200 [thread overview]
Message-ID: <1056485922.4948.688.camel@jma1.dev.netgem.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]
Hello, Fabrice,
Here's a set of patches that fix some target emulation portability
problems in qemu:
- The most important: Fix target-cpu option display in configure script
- Protect dyngen_exec.h against multiple inclusions. I'm not sure that
it's still needed, but that cannot be bad...
- Add INTxx_MIN & MAX definitions.
- Remove the empty code test in PPC case: there are some various way to
get a nop on PPC, and I feel good to let gcc produce no code for
them rather than checking those cases during code generation phase.
- Fix a bug in PPC disassembly, assuming that the PPC memory is always
big-endian...
- Protect some undefined syscalls for PPC. That may not be the best
patch, but it makes things compile.
- Protect static inline functions in thunk.h:
those function have references on struct_entries
which isn't defined when compilng dyngen.c
It seems that native powerpc-gcc V 3.2 always tries to generate
non inlined versions of thoses functions, which make the link process
fail...
- #ifdef some #include "cpu-i386.h" things
So, nothing really corosive, for now !
More to come (soon), for PPC emulation...
--
Jocelyn Mayer <jma@netgem.com>
[-- Attachment #2: qemu1.diff --]
[-- Type: text/x-patch, Size: 6790 bytes --]
Index: configure
===================================================================
RCS file: /cvsroot/qemu/qemu/configure,v
retrieving revision 1.14
diff -u -d -w -B -b -d -p -r1.14 configure
--- configure 15 Jun 2003 20:25:43 -0000 1.14
+++ configure 24 Jun 2003 19:19:23 -0000
@@ -190,7 +192,7 @@ echo "Standard options:"
echo " --help print this message"
echo " --prefix=PREFIX install in PREFIX [$prefix]"
echo " --interp-prefix=PREFIX where to find shared libraries, etc. [$interp_prefix]"
-echo " --target_cpu=CPU set target cpu (x86 or arm) [$target_cpu]"
+echo " --target-cpu=CPU set target cpu (x86 ppc or arm) [$target_cpu]"
echo ""
echo "Advanced options (experts only):"
echo " --source-path=PATH path of source code [$source_path]"
Index: dyngen-exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v
retrieving revision 1.1
diff -u -d -w -B -b -d -p -r1.1 dyngen-exec.h
--- dyngen-exec.h 15 Jun 2003 19:46:57 -0000 1.1
+++ dyngen-exec.h 24 Jun 2003 19:19:23 -0000
@@ -17,6 +17,9 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#if !defined (__DYNGEN_EXEC_H__)
+#define __DYNGEN_EXEC_H__
+
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
@@ -27,6 +30,19 @@ typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long long int64_t;
+# define INT8_MIN (-128)
+# define INT16_MIN (-32767-1)
+# define INT32_MIN (-2147483647-1)
+# define INT64_MIN (-(int64_t)(9223372036854775807)-1)
+# define INT8_MAX (127)
+# define INT16_MAX (32767)
+# define INT32_MAX (2147483647)
+# define INT64_MAX ((int64_t)(9223372036854775807))
+# define UINT8_MAX (255)
+# define UINT16_MAX (65535)
+# define UINT32_MAX (4294967295U)
+# define UINT64_MAX ((uint64_t)(18446744073709551615))
+
#define bswap32(x) \
({ \
uint32_t __x = (x); \
@@ -153,3 +169,5 @@ extern int __op_param1, __op_param2, __o
#endif
extern int __op_jmp0, __op_jmp1;
+
+#endif /* !defined (__DYNGEN_EXEC_H__) */
Index: dyngen.c
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen.c,v
retrieving revision 1.22
diff -u -d -w -B -b -d -p -r1.22 dyngen.c
--- dyngen.c 15 Jun 2003 22:50:44 -0000 1.22
+++ dyngen.c 24 Jun 2003 19:19:24 -0000
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <fcntl.h>
+#define NO_STATIC_THUNK_FUNC
#include "config.h"
/* elf format definitions. We use these macros to test the CPU to
@@ -456,8 +457,10 @@ void gen_code(const char *name, host_ulo
{
uint8_t *p;
p = (void *)(p_end - 4);
+#if 0
if (p == p_start)
error("empty code for %s", name);
+#endif
if (get32((uint32_t *)p) != 0x4e800020)
error("blr expected at the end of %s", name);
copy_size = p - p_start;
Index: exec.c
===================================================================
RCS file: /cvsroot/qemu/qemu/exec.c,v
retrieving revision 1.9
diff -u -d -w -B -b -d -p -r1.9 exec.c
--- exec.c 24 Jun 2003 13:28:12 -0000 1.9
+++ exec.c 24 Jun 2003 19:19:25 -0000
@@ -26,7 +26,14 @@
#include <inttypes.h>
#include <sys/mman.h>
+#include "config.h"
+#if defined (TARGET_I386)
#include "cpu-i386.h"
+#elif defined (TARGET_ARM)
+#include "cpu-arm.h"
+#elif defined (TARGET_PPC)
+#include "cpu-ppc.h"
+#endif
#include "exec.h"
//#define DEBUG_TB_INVALIDATE
Index: main.c
===================================================================
RCS file: /cvsroot/qemu/qemu/main.c,v
retrieving revision 1.32
diff -u -d -w -B -b -d -p -r1.32 main.c
--- main.c 24 Jun 2003 13:30:31 -0000 1.32
+++ main.c 24 Jun 2003 19:19:25 -0000
@@ -26,7 +26,13 @@
#include "qemu.h"
+#if defined (TARGET_I386)
#include "cpu-i386.h"
+#elif defined (TARGET_ARM)
+#include "cpu-arm.h"
+#elif defined (TARGET_PPC)
+#include "cpu-ppc.h"
+#endif
#define DEBUG_LOGFILE "/tmp/qemu.log"
Index: ppc-dis.c
===================================================================
RCS file: /cvsroot/qemu/qemu/ppc-dis.c,v
retrieving revision 1.1
diff -u -d -w -B -b -d -p -r1.1 ppc-dis.c
--- ppc-dis.c 29 Apr 2003 20:38:27 -0000 1.1
+++ ppc-dis.c 24 Jun 2003 19:19:28 -0000
@@ -3074,7 +3074,8 @@ static int print_insn_powerpc(FILE *, un
int print_insn_ppc (bfd_vma pc, disassemble_info *info)
{
- return print_insn_powerpc (info->stream, *(unsigned *)(long)pc, pc,
+ return print_insn_powerpc (info->stream,
+ (int)bfd_getb32((bfd_byte *)pc), pc,
PPC_OPCODE_PPC | PPC_OPCODE_601);
}
Index: syscall.c
===================================================================
RCS file: /cvsroot/qemu/qemu/syscall.c,v
retrieving revision 1.34
diff -u -d -w -B -b -d -p -r1.34 syscall.c
--- syscall.c 15 Jun 2003 19:56:46 -0000 1.34
+++ syscall.c 24 Jun 2003 19:19:31 -0000
@@ -2116,6 +2125,7 @@ long do_syscall(void *cpu_env, int num,
}
#endif
break;
+#ifdef TARGET_NR_getdents64
case TARGET_NR_getdents64:
{
struct dirent64 *dirp = (void *)arg2;
@@ -2139,6 +2149,7 @@ long do_syscall(void *cpu_env, int num,
}
}
break;
+#endif
case TARGET_NR__newselect:
ret = do_select(arg1, (void *)arg2, (void *)arg3, (void *)arg4,
(void *)arg5);
@@ -2456,12 +2467,18 @@ long do_syscall(void *cpu_env, int num,
case TARGET_NR_setfsgid32:
ret = get_errno(setfsgid(arg1));
break;
+#ifdef TARGET_NR_pivot_root
case TARGET_NR_pivot_root:
goto unimplemented;
+#endif
+#ifdef TARGET_NR_mincore
case TARGET_NR_mincore:
goto unimplemented;
+#endif
+#ifdef TARGET_NR_madvise
case TARGET_NR_madvise:
goto unimplemented;
+#endif
#if TARGET_LONG_BITS == 32
case TARGET_NR_fcntl64:
{
Index: thunk.h
===================================================================
RCS file: /cvsroot/qemu/qemu/thunk.h,v
retrieving revision 1.9
diff -u -d -w -B -b -d -p -r1.9 thunk.h
--- thunk.h 15 Jun 2003 19:52:54 -0000 1.9
+++ thunk.h 24 Jun 2003 19:19:32 -0000
@@ -239,6 +239,7 @@ const argtype *thunk_convert(void *dst,
extern StructEntry struct_entries[];
+#if !defined(NO_STATIC_THUNK_FUNC)
static inline int thunk_type_size(const argtype *type_ptr, int is_host)
{
int type, size;
@@ -311,6 +312,7 @@ static inline int thunk_type_align(const
return -1;
}
}
+#endif /* !defined(NO_STATIC_THUNK_FUNC) */
unsigned int target_to_host_bitmask(unsigned int x86_mask,
bitmask_transtbl * trans_tbl);
next reply other threads:[~2003-06-24 20:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-24 20:18 Jocelyn Mayer [this message]
2003-06-26 13:58 ` [Qemu-devel] Misc patches for qemu Johan Rydberg
2003-06-26 20:38 ` Jocelyn Mayer
2003-06-27 8:18 ` Benjamin Herrenschmidt
2003-06-27 13:55 ` Jocelyn Mayer
2003-06-27 15:29 ` Benjamin Herrenschmidt
2003-06-27 15:49 ` Benjamin Herrenschmidt
2003-06-30 22:41 ` Jocelyn Mayer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1056485922.4948.688.camel@jma1.dev.netgem.com \
--to=jma@netgem.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.