qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH pic32 2/7] Stop simulation when processor is sus


From: Serge Vakulenko
Subject: Re: [Qemu-devel] [PATCH pic32 2/7] Stop simulation when processor is suspended forever by WAIT instruction with interrupts disabled.
Date: Fri, 10 Jul 2015 22:35:50 -0700

2015-07-09 9:29 GMT-07:00 Christopher Covington <address@hidden>:
> On 06/30/2015 09:57 PM, Serge Vakulenko wrote:
>>
>> $ /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?

Typically, halt instruction, i.e. reboot(RB_HALT) system call is used
by administrator to stop the device before shutting the power off. All
the activity is stopped before the busy-loop. It makes little sense to
do anything but wait in a loop. There is no firmware to call on pic32
microcontroller. No semihosting is assumed: this is a final kernel
binary, intended to be programmed into the flash memory of a
microcontroller.

Regards,
--Serge


> Chris
>
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project



reply via email to

[Prev in Thread] Current Thread [Next in Thread]