qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Maria Zabolotnaya" <maria.zabolotnaya@gmail.com>
To: qemu-devel@nongnu.org, pmiscml@gmail.com
Subject: [Qemu-devel] [PATCH] Patches from PyQemu project
Date: Sun, 2 Sep 2007 16:50:50 +0300	[thread overview]
Message-ID: <1aa37d910709020650v7c491985r761886db64435ac0@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1069 bytes --]

Please see previous message for general PyQemu project description. Here are
the patches developed during the project:

1-qemu-override-mtype.patch
Add -mtype command line option to let override ARM MTYPE passed to the
kernel (useful for initial testing, prototyping, and debugging of new
machine).

2-qemu-mplugin.patch
Add -mplugin switch to allow loading of shared library and registering a
machine declared in it.

3-qemu-build-so.patch
Build QEMU as a shared library.

4-qemu-no-statics.patch
Remove static declaration from some QEMU symbols, so they were exported from
shared library.

5-qemu-gccxml-friendly.patch
This is auxiliary patch to make QEMY header C++ friendly, which is required
by gccxml, which in turn is required by ctypes utility h2xml to
automatically generate Python interface files from C headers.

6-qemu-extra-sdstate-accessors.patch
Few extra accessors for SDState structure (as was required to develop
emulation of ASIC3 SD controller). Alternative approach would be to make the
structure itself public.



Best regards,
Maria Zabolotnaya.

[-- Attachment #1.2: Type: text/html, Size: 1146 bytes --]

[-- Attachment #2: 1-qemu-override-mtype.patch --]
[-- Type: text/x-diff, Size: 2839 bytes --]

Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.323
diff -u -r1.323 vl.c
--- vl.c	29 Jul 2007 17:57:25 -0000	1.323
+++ vl.c	19 Aug 2007 01:31:31 -0000
@@ -196,6 +197,7 @@
 const char *option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
 int semihosting_enabled = 0;
+int override_mtype = 0;
 int autostart = 1;
 #ifdef TARGET_ARM
 int old_param = 0;
@@ -6590,6 +6592,9 @@
            "\n"
            "Standard options:\n"
            "-M machine      select emulated machine (-M ? for list)\n"
+#ifdef TARGET_ARM
+           "-mtype machid   set ARM machine type for generic machines\n"
+#endif
            "-cpu cpu        select CPU (-cpu ? for list)\n"
            "-fda/-fdb file  use 'file' as floppy disk 0/1 image\n"
            "-hda/-hdb file  use 'file' as IDE hard disk 0/1 image\n"
@@ -6805,6 +6811,7 @@
     QEMU_OPTION_name,
     QEMU_OPTION_prom_env,
     QEMU_OPTION_old_param,
+    QEMU_OPTION_mtype,
 };
 
 typedef struct QEMUOption {
@@ -6901,6 +6909,7 @@
     { "option-rom", HAS_ARG, QEMU_OPTION_option_rom },
 #if defined(TARGET_ARM) || defined(TARGET_M68K)
     { "semihosting", 0, QEMU_OPTION_semihosting },
+    { "mtype", HAS_ARG, QEMU_OPTION_mtype },
 #endif
     { "name", HAS_ARG, QEMU_OPTION_name },
 #if defined(TARGET_SPARC)
@@ -7684,6 +7694,12 @@
                 nb_prom_envs++;
                 break;
 #endif
+            case QEMU_OPTION_mtype:
+                {
+                    const char *p = optarg;
+                    override_mtype = strtol(p, (char **)&p, 0);
+                }
+                break;
 #ifdef TARGET_ARM
             case QEMU_OPTION_old_param:
                 old_param = 1;
Index: vl.h
===================================================================
RCS file: /sources/qemu/qemu/vl.h,v
retrieving revision 1.260
diff -u -r1.260 vl.h
--- vl.h	16 Aug 2007 19:56:27 -0000	1.260
+++ vl.h	19 Aug 2007 01:31:31 -0000
@@ -171,6 +171,8 @@
 extern const char *option_rom[MAX_OPTION_ROMS];
 extern int nb_option_roms;
 
+extern int override_mtype;
+
 #ifdef TARGET_SPARC
 #define MAX_PROM_ENVS 128
 extern const char *prom_envs[MAX_PROM_ENVS];
Index: hw/arm_boot.c
===================================================================
RCS file: /sources/qemu/qemu/hw/arm_boot.c,v
retrieving revision 1.8
diff -u -r1.8 arm_boot.c
--- hw/arm_boot.c	27 Jul 2007 22:08:46 -0000	1.8
+++ hw/arm_boot.c	19 Aug 2007 01:31:31 -0000
@@ -169,6 +169,8 @@
         env->kernel_filename = kernel_filename;
         env->kernel_cmdline = kernel_cmdline;
         env->initrd_filename = initrd_filename;
+        if (override_mtype)
+            board_id = override_mtype;
         env->board_id = board_id;
         env->loader_start = loader_start;
         qemu_register_reset(main_cpu_reset, env);

[-- Attachment #3: 2-qemu-mplugin.patch --]
[-- Type: text/x-diff, Size: 2825 bytes --]

Index: osdep.h
===================================================================
RCS file: /sources/qemu/qemu/osdep.h,v
retrieving revision 1.10
diff -u -r1.10 osdep.h
--- osdep.h	7 Jun 2007 23:09:47 -0000	1.10
+++ osdep.h	19 Aug 2007 01:31:30 -0000
@@ -28,4 +28,14 @@
 #define qemu_gettimeofday(tp) gettimeofday(tp, NULL);
 #endif /* !_WIN32 */
 
+#ifdef _WIN32
+#define qemu_dlopen(name, flags) LoadLibrary(name)
+#define qemu_dlsym(handle, name) ((void*)GetProcAddress(handle, name))
+#define qemu_dlerror() "DLL load error"
+#else
+#define qemu_dlopen(name, flags) dlopen(name, flags)
+#define qemu_dlsym(handle, name) dlsym(handle, name)
+#define qemu_dlerror() dlerror()
+#endif /* !_WIN32 */
+
 #endif
Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.323
diff -u -r1.323 vl.c
--- vl.c	29 Jul 2007 17:57:25 -0000	1.323
+++ vl.c	19 Aug 2007 01:31:31 -0000
@@ -42,6 +42,7 @@
 #include <netinet/in.h>
 #include <dirent.h>
 #include <netdb.h>
+#include <dlfcn.h>
 #ifdef _BSD
 #include <sys/stat.h>
 #ifndef __APPLE__
@@ -6712,6 +6713,7 @@
 #ifdef TARGET_SPARC
            "-prom-env variable=value  set OpenBIOS nvram variables\n"
 #endif
+           "-mplugin machine.so  load machine plugin\n"
            "\n"
            "During emulation, the following keys are useful:\n"
            "ctrl-alt-f      toggle full screen\n"
@@ -6810,6 +6812,7 @@
     QEMU_OPTION_prom_env,
     QEMU_OPTION_old_param,
     QEMU_OPTION_mtype,
+    QEMU_OPTION_machine_plugin,
 };
 
 typedef struct QEMUOption {
@@ -6915,6 +6918,7 @@
 #if defined(TARGET_ARM)
     { "old-param", 0, QEMU_OPTION_old_param },
 #endif
+    { "mplugin", HAS_ARG, QEMU_OPTION_machine_plugin },
     { NULL },
 };
 
@@ -7690,6 +7694,27 @@
                 nb_prom_envs++;
                 break;
 #endif
+            case QEMU_OPTION_machine_plugin:
+                {
+                    void *handle;
+                    QEMUMachine *machine;
+ 
+                    handle = qemu_dlopen(optarg, RTLD_NOW | RTLD_GLOBAL);
+                    if (!handle) {
+                        fprintf(stderr, "Cannot load plugin: %s\n", qemu_dlerror());
+                        exit(1);
+                    }
+                    machine = qemu_dlsym(handle, "machine");
+                    if (!machine) {
+                        fprintf(stderr, "Cannot find machine in plugin\n");
+                        exit(1);
+                    }
+                    if (qemu_register_machine(machine)) {
+                        fprintf(stderr, "Cannot register machine\n");
+                        exit(1);
+                    }
+                }
+                break;
             case QEMU_OPTION_mtype:
                 {
                     const char *p = optarg;

[-- Attachment #4: 3-qemu-build-so.patch --]
[-- Type: text/x-diff, Size: 1045 bytes --]

Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.191
diff -u -r1.191 Makefile.target
--- Makefile.target	31 Jul 2007 23:44:21 -0000	1.191
+++ Makefile.target	19 Aug 2007 01:31:30 -0000
@@ -519,6 +519,12 @@
 VL_LDFLAGS+=-p
 endif
 
+ifdef CONFIG_WIN32
+VL_LIBS+=-Wl,--out-implib,libqemu-system-$(TARGET_ARCH2).dll.a
+else
+VL_LIBS+=-ldl
+endif
+
 ifeq ($(ARCH),ia64)
 VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
 endif
@@ -535,7 +541,10 @@
 endif
 
 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
-	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
+	$(CC) -Wl,--export-dynamic $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
+
+qemu-system-$(TARGET_ARCH2).so: $(VL_OBJS) libqemu.a
+	$(CC) --shared -Wl,--export-dynamic $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
 
 cocoa.o: cocoa.m
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<

[-- Attachment #5: 4-qemu-no-statics.patch --]
[-- Type: text/x-diff, Size: 1752 bytes --]

Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.323
diff -u -r1.323 vl.c
--- vl.c	29 Jul 2007 17:57:25 -0000	1.323
+++ vl.c	19 Aug 2007 01:31:31 -0000
@@ -146,7 +147,7 @@
 /* point to the block driver where the snapshots are managed */
 BlockDriverState *bs_snapshots;
 int vga_ram_size;
-static DisplayState display_state;
+DisplayState display_state;
 int nographic;
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
@@ -910,7 +912,7 @@
     }
 }
 
-static void init_timers(void)
+void init_timers(void)
 {
     init_get_clock();
     ticks_per_sec = QEMU_TIMER_BASE;
@@ -943,7 +945,7 @@
     }
 }
 
-static void timer_save(QEMUFile *f, void *opaque)
+void timer_save(QEMUFile *f, void *opaque)
 {
     if (cpu_ticks_enabled) {
         hw_error("cannot save state if virtual timers are running");
@@ -953,7 +955,7 @@
     qemu_put_be64s(f, &cpu_clock_offset);
 }
 
-static int timer_load(QEMUFile *f, void *opaque, int version_id)
+int timer_load(QEMUFile *f, void *opaque, int version_id)
 {
     if (version_id != 1 && version_id != 2)
         return -EINVAL;
@@ -1063,7 +1065,7 @@
 
 #endif /* !defined(_WIN32) */
 
-static void init_timer_alarm(void)
+void init_timer_alarm(void)
 {
 #ifdef _WIN32
     {
@@ -6016,7 +6018,7 @@
     inflateEnd(&s->zstream);
 }
 
-static void ram_save(QEMUFile *f, void *opaque)
+void ram_save(QEMUFile *f, void *opaque)
 {
     int i;
     RamCompressState s1, *s = &s1;
@@ -6060,7 +6062,7 @@
     ram_compress_close(s);
 }
 
-static int ram_load(QEMUFile *f, void *opaque, int version_id)
+int ram_load(QEMUFile *f, void *opaque, int version_id)
 {
     RamDecompressState s1, *s = &s1;
     uint8_t buf[10];

[-- Attachment #6: 5-qemu-gccxml-friendly.patch --]
[-- Type: text/x-diff, Size: 1397 bytes --]

Index: cpu-all.h
===================================================================
RCS file: /sources/qemu/qemu/cpu-all.h,v
retrieving revision 1.74
diff -u -r1.74 cpu-all.h
--- cpu-all.h	29 Jul 2007 17:57:24 -0000	1.74
+++ cpu-all.h	19 Aug 2007 01:31:30 -0000
@@ -416,7 +416,7 @@
 {
     uint32_t a,b;
     a = ldl_be_p(ptr);
-    b = ldl_be_p(ptr+4);
+    b = ldl_be_p((char*)ptr+4);
     return (((uint64_t)a<<32)|b);
 }
 
@@ -453,7 +453,7 @@
 static inline void stq_be_p(void *ptr, uint64_t v)
 {
     stl_be_p(ptr, v >> 32);
-    stl_be_p(ptr + 4, v);
+    stl_be_p((char*)ptr + 4, v);
 }
 
 /* float access */
@@ -482,7 +482,7 @@
 {
     CPU_DoubleU u;
     u.l.upper = ldl_be_p(ptr);
-    u.l.lower = ldl_be_p(ptr + 4);
+    u.l.lower = ldl_be_p((char*)ptr + 4);
     return u.d;
 }
 
@@ -491,7 +491,7 @@
     CPU_DoubleU u;
     u.d = v;
     stl_be_p(ptr, u.l.upper);
-    stl_be_p(ptr + 4, u.l.lower);
+    stl_be_p((char*)ptr + 4, u.l.lower);
 }
 
 #else
Index: audio/audio.h
===================================================================
RCS file: /sources/qemu/qemu/audio/audio.h,v
retrieving revision 1.9
diff -u -r1.9 audio.h
--- audio/audio.h	17 Feb 2007 22:19:29 -0000	1.9
+++ audio/audio.h	19 Aug 2007 01:31:31 -0000
@@ -144,7 +144,7 @@
 
 static inline void *advance (void *p, int incr)
 {
-    uint8_t *d = p;
+    uint8_t *d = (uint8_t*)p;
     return (d + incr);
 }
 

[-- Attachment #7: 6-qemu-extra-sdstate-accessors.patch --]
[-- Type: text/x-diff, Size: 964 bytes --]

Index: hw/sd.c
===================================================================
RCS file: /sources/qemu/qemu/hw/sd.c,v
retrieving revision 1.2
diff -u -r1.2 sd.c
--- hw/sd.c	30 Jul 2007 23:54:51 -0000	1.2
+++ hw/sd.c	19 Aug 2007 01:31:31 -0000
@@ -1507,3 +1507,13 @@
 {
     return sd->state == sd_sendingdata_state;
 }
+
+int sd_get_card_status(SDState *sd)
+{
+    return sd->card_status;
+}
+        
+int sd_get_state(SDState *sd)
+{
+    return sd->state;
+}
Index: hw/sd.h
===================================================================
RCS file: /sources/qemu/qemu/hw/sd.h,v
retrieving revision 1.2
diff -u -r1.2 sd.h
--- hw/sd.h	30 Jul 2007 23:54:51 -0000	1.2
+++ hw/sd.h	19 Aug 2007 01:31:31 -0000
@@ -78,5 +78,7 @@
                void (*readonly_cb)(void *, int),
                void (*inserted_cb)(void *, int));
 int sd_data_ready(SDState *sd);
+int sd_get_card_status(SDState *sd); 
+int sd_get_state(SDState *sd); 
 
 #endif	/* __hw_sd_h */

             reply	other threads:[~2007-09-02 13:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-02 13:50 Maria Zabolotnaya [this message]
2007-09-03 15:41 ` [Qemu-devel] [PATCH] Patches from PyQemu project Blue Swirl
2007-09-03 20:44   ` Anthony Liguori
2007-09-04 19:40     ` [Qemu-devel] Re: qemu device emulation libraries (was [PATCH] Patches from the PyQemu project) Hollis Blanchard
2007-09-04 20:04       ` Paul Brook
2007-09-04 20:21         ` Hollis Blanchard
2007-09-04 20:38           ` Paul Brook
2007-09-04 23:38             ` [kvm-devel] " Jimi Xenidis
2007-09-04 20:52         ` Anthony Liguori
2007-09-04 19:57     ` [Qemu-devel] Re: [PATCH] Patches from PyQemu project Brian Johnson
2007-09-04 20:56       ` Anthony Liguori
2007-09-04 22:27       ` Thiemo Seufer
2007-09-04 23:34         ` Anthony Liguori
2007-09-04 23:45         ` Anthony Liguori
2007-09-05 10:08           ` Fabrice Bellard
2007-09-04 22:13     ` [Qemu-devel] " Paul Sokolovsky

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=1aa37d910709020650v7c491985r761886db64435ac0@mail.gmail.com \
    --to=maria.zabolotnaya@gmail.com \
    --cc=pmiscml@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).