qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <gcosta@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm-devel@lists.sourceforge.net
Subject: [Qemu-devel] [PATCH 01/13] [PATCH] make cpu_exec_init symmetric
Date: Thu, 15 May 2008 11:09:21 -0300	[thread overview]
Message-ID: <12108605813076-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <12108605731805-git-send-email-gcosta@redhat.com>

we put all the code that needs to be executed only at cpu0
out of cpu_exec_init(), in exec_init(). It is executed
before machine_init(), and only once. With this change,
code cpu_exec_init() is completely symmetric.
---
 exec-all.h |    1 +
 exec.c     |   15 +++++++++------
 vl.c       |    1 +
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/exec-all.h b/exec-all.h
index d8c6c33..8c32858 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -82,6 +82,7 @@ int cpu_restore_state_copy(struct TranslationBlock *tb,
                            void *puc);
 void cpu_resume_from_signal(CPUState *env1, void *puc);
 void cpu_exec_init(CPUState *env);
+void exec_init(void);
 int page_unprotect(target_ulong address, unsigned long pc, void *puc);
 void tb_invalidate_phys_page_range(target_phys_addr_t start, target_phys_addr_t end,
                                    int is_cpu_write_access);
diff --git a/exec.c b/exec.c
index 2fd0078..5384460 100644
--- a/exec.c
+++ b/exec.c
@@ -327,17 +327,20 @@ static void tlb_unprotect_code_phys(CPUState *env, ram_addr_t ram_addr,
                                     target_ulong vaddr);
 #endif
 
+/* Must be called once before any of attempts to call cpu_init */
+void exec_init(void)
+{
+    cpu_gen_init();
+    code_gen_ptr = code_gen_buffer;
+    page_init();
+    io_mem_init();
+}
+
 void cpu_exec_init(CPUState *env)
 {
     CPUState **penv;
     int cpu_index;
 
-    if (!code_gen_ptr) {
-        cpu_gen_init();
-        code_gen_ptr = code_gen_buffer;
-        page_init();
-        io_mem_init();
-    }
     env->next_cpu = NULL;
     penv = &first_cpu;
     cpu_index = 0;
diff --git a/vl.c b/vl.c
index 67712f0..5999b37 100644
--- a/vl.c
+++ b/vl.c
@@ -8576,6 +8576,7 @@ int main(int argc, char **argv)
         }
     }
 
+    exec_init();
     machine->init(ram_size, vga_ram_size, boot_devices, ds,
                   kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
 
-- 
1.5.5

  reply	other threads:[~2008-05-15 14:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15 14:09 [Qemu-devel] [PATCH 0/13] New shot at QEMUAccel Glauber Costa
2008-05-15 14:09 ` Glauber Costa [this message]
2008-05-15 14:09   ` [Qemu-devel] [PATCH 02/13] [PATCH] split kqemu_init into two Glauber Costa
2008-05-15 14:09     ` [Qemu-devel] [PATCH 03/13] [PATCH] introduce QEMUAccel and fill it with interrupt specific driver Glauber Costa
2008-05-15 14:09       ` [Qemu-devel] [PATCH 04/13] [PATCH] init env made accel driver Glauber Costa
2008-05-15 14:09         ` [Qemu-devel] [PATCH 05/13] [PATCH] wrap cache flushing functions into accel drivers Glauber Costa
2008-05-15 14:09           ` [Qemu-devel] [PATCH 06/13] [PATCH] turn info kqemu into generic info accelerator Glauber Costa
2008-05-15 14:09             ` [Qemu-devel] [PATCH 07/13] [PATCH] separate accelerator part of info profiler Glauber Costa
2008-05-15 14:09               ` [Qemu-devel] [PATCH 08/13] [PATCH] move kqemu externs to kqemu.h Glauber Costa
2008-05-15 14:09                 ` [Qemu-devel] [PATCH 09/13] [PATCH] move disabling code to kqemu.c instead of vl.c Glauber Costa
2008-05-15 14:09                   ` [Qemu-devel] [PATCH 10/13] [PATCH] set_notdirty goes through accel wrapper Glauber Costa
2008-05-15 14:09                     ` [Qemu-devel] [PATCH 11/13] [PATCH] wrap modify_page through accel calls Glauber Costa
2008-05-15 14:09                       ` [Qemu-devel] [PATCH 12/13] [PATCH] remove kqemu reference from hw/pc.c Glauber Costa
2008-05-15 14:09                         ` [Qemu-devel] [PATCH 13/13] [PATCH] build list of available accelerators Glauber Costa

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=12108605813076-git-send-email-gcosta@redhat.com \
    --to=gcosta@redhat.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --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).