From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HeISl-0005O8-G3 for qemu-devel@nongnu.org; Wed, 18 Apr 2007 18:17:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HeISj-0005Nw-5N for qemu-devel@nongnu.org; Wed, 18 Apr 2007 18:17:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HeISi-0005Nt-W2 for qemu-devel@nongnu.org; Wed, 18 Apr 2007 18:17:17 -0400 Received: from wr-out-0506.google.com ([64.233.184.232]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HeINq-00038o-0m for qemu-devel@nongnu.org; Wed, 18 Apr 2007 18:12:14 -0400 Received: by wr-out-0506.google.com with SMTP id i20so563411wra for ; Wed, 18 Apr 2007 15:12:13 -0700 (PDT) Message-ID: Date: Thu, 19 Apr 2007 00:12:12 +0200 From: "andrzej zaborowski" Sender: balrogg@gmail.com Subject: Re: [Qemu-devel] Saving and restoring CPU state In-Reply-To: <200704181711.36981.rob@landley.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <461E5B63.8040906@wisc.edu> <200704181711.36981.rob@landley.net> Reply-To: balrogg@gmail.com, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: eady On 18/04/07, Rob Landley wrote: > On Thursday 12 April 2007 12:16 pm, eady wrote: > > I'm still looking for any suggestions on how to save and restore the > > target cpu state from within a custom instruction in op.c. I basically > > want a custom instruction to save the cpu state to a data structure and > > then continue on normally, a second custom instruction would then be > > used to restore the cpu state from the saved data structure at a later > > time thereby rolling back the execution of the cpu. I've tried saving > > and restoring env->eip within my custom instructions but this has no effect. > > How do you roll back all the writes to memory and interactions with devices > the processor may have done? > > Saving and restoring _just_ the processor state is what setjmp/longjmp does, > and there's all sorts of restrictions on its' use... Saving and restoring just (part of) the processor state kindof is done by i386 instructions like syscall/sysret, sysenter/sysexit, SMM/RSM stuff and other instructions. Have a look at target-i386/helper.c HTH, Andrzej