On Thursday 10 June 2010 21:30:14 Avi Kivity wrote:
> Signed-off-by: Sheng Yang <[email protected]>
> Signed-off-by: Avi Kivity <[email protected]>
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;
> +}
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html