public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sheng Yang <sheng@linux.intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH v2] test: Add IDT framework
Date: Fri, 11 Jun 2010 15:52:04 +0800	[thread overview]
Message-ID: <201006111552.04765.sheng@linux.intel.com> (raw)
In-Reply-To: <1276176614-7347-1-git-send-email-avi@redhat.com>

On Thursday 10 June 2010 21:30:14 Avi Kivity wrote:
> Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> Signed-off-by: Avi Kivity <avi@redhat.com>

Really great work! 

> ---
>  kvm/test/config-x86-common.mak |    2 +
>  kvm/test/config-x86_64.mak     |    2 +-
>  kvm/test/flat.lds              |    7 ++-
>  kvm/test/lib/x86/idt.h         |   19 +++++
>  kvm/test/x86/idt.c             |  154
> ++++++++++++++++++++++++++++++++++++++++ kvm/test/x86/idt_test.c        | 
>  53 ++++++++++++++
>  6 files changed, 235 insertions(+), 2 deletions(-)
>  create mode 100644 kvm/test/lib/x86/idt.h
>  create mode 100644 kvm/test/x86/idt.c
>  create mode 100644 kvm/test/x86/idt_test.c

[...]

> +void do_handle_exception(struct ex_regs *regs)
> +{
> +    struct ex_record *ex;
> +    unsigned ex_val;
> +
> +    printf("exception: vector %ld error %lx rip %lx\n", regs->vector,
> +           regs->error_code, regs->rip);
> +
> +    ex_val = regs->vector | (regs->error_code << 16);
> +
> +    asm("mov %0, %%gs:4" : : "r"(ex_val));
> +
> +    for (ex = &exception_table_start; ex != &exception_table_end; ++ex) {
> +        printf("ex_table: %lx %lx\n", ex->rip, ex->handler);

How about use something like #ifdef VERBOSE? (Well, in fact I didn't use unit test 
much, if you don't mind the format of output, it's also fine.)

> +int test(void)
> +{
> +    int r;
> +
> +    setup_idt();
> +    printf("GP testing: ");
> +    r = test_gp();
> +    report(r == GP_VECTOR, "#GP");
> +    r = test_ud2();
> +    report(r == UD_VECTOR, "#UD");

Miss a "UD testing"?

--
regards
Yang, Sheng

> +    return !nr_fail ? 0 : 1;
> +}
> +
> +int main(void)
> +{
> +    printf("start testing\n");
> +    test();
> +    return 0;
> +}

  reply	other threads:[~2010-06-11  7:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10 13:30 [PATCH v2] test: Add IDT framework Avi Kivity
2010-06-11  7:52 ` Sheng Yang [this message]
2010-06-11  8:03   ` Avi Kivity

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=201006111552.04765.sheng@linux.intel.com \
    --to=sheng@linux.intel.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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