From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2] test: Add IDT framework Date: Fri, 11 Jun 2010 11:03:47 +0300 Message-ID: <4C11EDE3.8040102@redhat.com> References: <1276176614-7347-1-git-send-email-avi@redhat.com> <201006111552.04765.sheng@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Marcelo Tosatti To: Sheng Yang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:18450 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752868Ab0FKIDv (ORCPT ); Fri, 11 Jun 2010 04:03:51 -0400 In-Reply-To: <201006111552.04765.sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/11/2010 10:52 AM, Sheng Yang wrote: > > >> +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.) > That was just debugging code I forgot to remove. It shouldn't be there except for the unhandled exception case. > >> +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"? > Yeah :( -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.