xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Tim Deegan <Tim.Deegan@citrix.com>, xen-devel@lists.xensource.com
Subject: Re: [PATCH 6 of 8] Xen: remove run_in_exception_handler() and recode its only caller
Date: Mon, 07 Mar 2011 15:15:44 +0000	[thread overview]
Message-ID: <C99AA722.14417%keir.xen@gmail.com> (raw)
In-Reply-To: <C99AA4B8.143F7%keir.xen@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]

On 07/03/2011 15:05, "Keir Fraser" <keir.xen@gmail.com> wrote:

> On 07/03/2011 11:26, "Tim Deegan" <Tim.Deegan@citrix.com> wrote:
> 
>> (dump_execution_state()) as its own bug-trap.
>> 
>> This is needed to compile xen with clang, which can't handle using a
>> function name in an asm immediate.
> 
> Actually run_in_exception_handler() does have another user, in ns16550.c.
> Although non-essential, it makes the 'd' debug key much more useful when
> running the UART in polled mode.
> 
> So I suggest we keep run_in_exception_handler but modify it to pass the
> function pointer in (say) rAX.

Like the attached patch (against latest tip).

 -- Keir

> I think we won't easily be able to use
> BUG_STR() logic but r_i_e_h is only used (directly or indirectly) in a few
> places so the BUG_STR optimisation is unimportant. The only other
> disadvantage is that rAX is less interesting in the state dump, but any
> value the function pointer displaces can still be found in the stack dump,
> albeit with likely a little extra effort.
> 
> Sound good?
> 
>  -- Keir 
> 
>> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
>> 
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
> 
> 


[-- Attachment #2: 00-reintroduce-run-in-exc-handler --]
[-- Type: application/octet-stream, Size: 1884 bytes --]

diff -r 076b63b74cf6 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Mon Mar 07 11:34:09 2011 +0000
+++ b/xen/arch/x86/traps.c	Mon Mar 07 15:14:22 2011 +0000
@@ -909,9 +909,10 @@
 
     id = bug.id & 3;
 
-    if ( id == BUGFRAME_state )
+    if ( id == BUGFRAME_run_fn )
     {
-        show_execution_state(regs);
+        void (*fn)(struct cpu_user_regs *) = (void *)regs->eax;
+        (*fn)(regs);
         regs->eip = (unsigned long)eip;
         return;
     }
diff -r 076b63b74cf6 xen/include/asm-x86/bug.h
--- a/xen/include/asm-x86/bug.h	Mon Mar 07 11:34:09 2011 +0000
+++ b/xen/include/asm-x86/bug.h	Mon Mar 07 15:14:22 2011 +0000
@@ -13,15 +13,16 @@
     unsigned short id; /* BUGFRAME_??? */
 } __attribute__((packed));
 
-#define BUGFRAME_state  0
+#define BUGFRAME_run_fn 0
 #define BUGFRAME_warn   1
 #define BUGFRAME_bug    2
 #define BUGFRAME_assert 3
 
-#define dump_execution_state()                     \
+#define run_in_exception_handler(fn)               \
     asm volatile (                                 \
         "ud2 ; ret %0"                             \
-        : : "i" (BUGFRAME_state) )
+        : : "i" (BUGFRAME_run_fn),                 \
+            "a" (fn) )
 
 #define WARN()                                     \
     asm volatile (                                 \
diff -r 076b63b74cf6 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h	Mon Mar 07 11:34:09 2011 +0000
+++ b/xen/include/asm-x86/processor.h	Mon Mar 07 15:14:22 2011 +0000
@@ -542,6 +542,7 @@
 void show_stack_overflow(unsigned int cpu, unsigned long esp);
 void show_registers(struct cpu_user_regs *regs);
 void show_execution_state(struct cpu_user_regs *regs);
+#define dump_execution_state() run_in_exception_handler(show_execution_state)
 void show_page_walk(unsigned long addr);
 asmlinkage void fatal_trap(int trapnr, struct cpu_user_regs *regs);
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2011-03-07 15:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07 11:26 [PATCH 0 of 8] Allow building xen with clang/llvm Tim Deegan
2011-03-07 11:26 ` [PATCH 1 of 8] x86: make spinlock's 16-bit asm operand explicitly 16-bit Tim Deegan
2011-03-07 11:26 ` [PATCH 2 of 8] x86: add explicit size suffixes to some assembly instructions Tim Deegan
2011-03-08  9:27   ` Jan Beulich
2011-03-08 10:44     ` Tim Deegan
2011-03-08 11:01       ` Jan Beulich
2011-03-08 16:29         ` Keir Fraser
2011-03-07 11:26 ` [PATCH 3 of 8] x86: redefine a few empty macros as explicit nops Tim Deegan
2011-03-07 11:26 ` [PATCH 4 of 8] xen: adjust cpumask initializers to suit clang's incomplete gccisms Tim Deegan
2011-03-07 11:26 ` [PATCH 5 of 8] credit2: remove two nested functions, replacing them with static ones Tim Deegan
2011-03-07 15:22   ` George Dunlap
2011-03-07 11:26 ` [PATCH 6 of 8] Xen: remove run_in_exception_handler() and recode its only caller Tim Deegan
2011-03-07 15:05   ` Keir Fraser
2011-03-07 15:15     ` Keir Fraser [this message]
2011-03-07 15:38       ` Tim Deegan
2011-03-07 15:44         ` Keir Fraser
2011-03-07 15:49           ` Keir Fraser
2011-03-07 15:56         ` Tim Deegan
2011-03-07 16:00           ` Keir Fraser
2011-03-07 16:06             ` Tim Deegan
2011-03-07 11:26 ` [PATCH 7 of 8] x86: redefine REX64_PREFIX for clang, which doesn't like 'rex64/' Tim Deegan
2011-03-07 11:26 ` [PATCH 8 of 8] xen: add "clang=y" option to build Xen with clang/llvm instead of gcc Tim Deegan
2011-03-07 14:54   ` Ian Campbell
2011-03-07 16:29     ` Tim Deegan
2011-03-07 17:01       ` Keir Fraser
2011-03-08 10:29         ` Tim Deegan
2011-03-08 10:00       ` Ian Campbell
2011-03-07 12:03 ` [PATCH 0 of 8] Allow building xen with clang/llvm Keir Fraser

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=C99AA722.14417%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=Tim.Deegan@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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).