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