From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDEhH-0004xt-I3 for qemu-devel@nongnu.org; Thu, 09 Jul 2015 12:29:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDEhE-0007gi-5T for qemu-devel@nongnu.org; Thu, 09 Jul 2015 12:29:15 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:35476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDEhE-0007fg-0B for qemu-devel@nongnu.org; Thu, 09 Jul 2015 12:29:12 -0400 Message-ID: <559EA154.30406@codeaurora.org> Date: Thu, 09 Jul 2015 12:29:08 -0400 From: Christopher Covington MIME-Version: 1.0 References: <5592A36A.1090608@imgtec.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH pic32 2/7] Stop simulation when processor is suspended forever by WAIT instruction with interrupts disabled. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Vakulenko , Peter Crosthwaite Cc: Leon Alrae , "qemu-devel@nongnu.org Developers" , Aurelien Jarno On 06/30/2015 09:57 PM, Serge Vakulenko wrote: > Hi Peter and Leon, > > With a bit of thinking, I agree, that the question of session > termination on WAIT instruction is quite complicated in case of > multi-core system, background i/o activity, mipsR6 core etc. So I'm > going to find another solution for the task. What I essentially want > here is to stop the simulator when the target Unix system is halted, > like: > > $ /usr/local/qemu-mips/bin/qemu-system-mipsel -M pic32mx7-max32 > -nographic -monitor none -serial stdio -bios boot-max32.hex -kernel > unix.hex -sd sdcard.img > Board: chipKIT Max32 > Processor: M4K > RAM size: 128 kbytes > Load file: 'boot-max32.hex', 6720 bytes > Load file: 'unix.hex', 144992 bytes > Card0 image 'sdcard.img', 102888 kbytes > [...] > 2.11 BSD UNIX (pic32) (console) > > login: root > Password: > Welcome to RetroBSD! > erase, kill ^U, intr ^C > # halt > killing processes... done > syncing disks... done > halted > $ _ <-- QEMU terminated > > On BSD, the halt command uses reboot(RB_HALT) system call to terminate > the operating system. It essentially results in an endless loop on > wait instruction with interrupts disabled., like "for(;;) { > asm("wait"); }". For pic32 it makes little sense to continue > simulation in this case. > > Fortunately, I've found a solution which does not require modification > of generic code. Everything can be done in the platform-specific part. Why doesn't the OS do more than busy-loop in halt()? For example poke a memory-mapped register, or make a firmware or semihosting call? Chris -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project