From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] kvm: testsuite: Add test for 'call near absolute' Date: Tue, 09 Sep 2008 16:39:08 +0300 Message-ID: <48C67C7C.7000808@qumranet.com> References: <20080908184616.GA31824@mohd-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Mohammed Gamal Return-path: Received: from il.qumranet.com ([212.179.150.194]:38728 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbYIINjK (ORCPT ); Tue, 9 Sep 2008 09:39:10 -0400 In-Reply-To: <20080908184616.GA31824@mohd-laptop> Sender: kvm-owner@vger.kernel.org List-ID: Mohammed Gamal wrote: > Add test for 'call near abolsute' instruction to the real mode test harness > > > +void test_call(struct regs *inregs, struct regs *outregs) > +{ > + MK_INSN(call1, "mov $0x4000, %eax \n\t" > + "call *%eax\n\t"); > + > + exec_in_big_real_mode(inregs, outregs, > + insn_call1, > + insn_call1_end - insn_call1); > Please test registers for damage (using regs_equal). > +} > + > +void line_out() > +{ > + /* Just output a blank line */ > + asm(".org 0x4000 \n\t" > + "mov $10, %al \n\t" > + "out %al, $0xf1 \n\t"); > +} > When the code grows and occupies address 0x4000, this will break. I suggest: void test_function(void); asm ("test_function: mov $1234, %eax; ret"); This sets up a register to see that the call actually did something, and avoids the gcc function prologue/epilogue which may clobber registers. -- error compiling committee.c: too many arguments to function