Received: from eggs.gnu.org ([208.118.235.92]:43752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S38Y3-0002V0-Bb for qemu-devel@nongnu.org; Thu, 01 Mar 2012 11:08:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S38Xe-0007Bf-Fe for qemu-devel@nongnu.org; Thu, 01 Mar 2012 11:08:06 -0500 Received: from indium.canonical.com ([91.189.90.7]:42467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S38Xe-0007BV-71 for qemu-devel@nongnu.org; Thu, 01 Mar 2012 11:07:42 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1S38Xc-0004IQ-IC for ; Thu, 01 Mar 2012 16:07:40 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 76BD52E8590 for ; Thu, 1 Mar 2012 16:01:39 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Thu, 01 Mar 2012 15:52:20 -0000 From: Oleksiy Bondarenko <657006@bugs.launchpad.net> Sender: bounces@canonical.com References: <20101008180054.4876.62094.malonedeb@palladium.canonical.com> Message-Id: <20120301155220.15141.175.malone@gac.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 657006] Re: arm v7M - svc insn doesn't trigger PendSV handler Reply-To: Bug 657006 <657006@bugs.launchpad.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org >From the manual DDI0403C_arm_architecture_v7m_reference_manual_errata_marku= p_2_0.pdf A6.7.97 POP Pop Multiple Registers loads a subset (or possibly all) of the general-purp= ose registers R0-R12 and the PC or the LR from the stack. If the registers loaded include the PC, the word loaded for the PC is treat= ed as an address or an exception return value and a branch occurs. Bit<0> complies with the ARM architecture= interworking rules for branches to Thumb state execution and must be 1. If bit<0> is 0, a UsageFau= lt exception occurs. And even more if we will look into Yiu, Joseph. The definitive guide to th= e ARM Cortex-M3 / Joseph Yiu. chapter 9 Interrupt behavior we will see how actually processor pushes data= and in real I thin it does not uses pop and push instructions, we just sim= ulate real behavior with this instructions. -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/657006 Title: arm v7M - svc insn doesn't trigger PendSV handler Status in QEMU: New Bug description: The svc instruction doesn't work as expected. -> qemu 0.13.0 rc1 (git) Test : demo with freeRTOS (for example FreeRTOS-6.0.5/Demo/CORTEX_LM3S811_GCC) with the card lm3s811evb. If we start the scheduler, it will call that function (__attribute__ (( naked ))) : void vPortStartFirstTask( void ) { __asm volatile( " ldr r0, =3D0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. */ " ldr r0, [r0] \n" " ldr r0, [r0] \n" " msr msp, r0 \n" /* Set the msp back to the start of the stack. */ " svc 0 \n" /* System call to start first task. */ ); } The 4 first lines in asm work fine. The scv 0 call will rise the right in= terrupt in qemu (line 151, in arm_gic.c, best_irq =3D 15). However, it will= never call the PendSV Handler (xPortPendSVHandler here). This function is = recorded in the nvic vector. Next, (after the svc), the processor will execute the line after in code = (this is a naked function) so the next function written after vPortStartFir= stTask in the code. = command line : console 1 : qemu-system-arm -M lm3s6965evb -kernel gcc/RTOSDemo.axf -s -S console 2 : arm-none-eabi-gdb -ex "target remote localhost:1234" gcc/RTOS= Demo.axf arm-none-eabi from http://www.codesourcery.com/sgpp/lite/arm/portal/relea= se1294 Same error with another project with arm-elf processor : arm cortex m3 host : gentoo (2.6.35-r9) (without kqemu) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/657006/+subscriptions