SVC is not permitted on this architecture

Bug #1449610 reported by cfriedt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

The spec clearly states in section A6.7.68 that SVC is, indeed, permitted.

https://silver.arm.com/download/download.tm?pv=1102513

pre-processed asm:

.text; .align 0; .globl _foo; .thumb; .syntax unified; .type _foo,#function; _foo: .fnstart;
    mov lr, r2
    ldr r7, =(0 + 91)
    svc #0
    mov r0, lr
    ldr r7, =(0 + 1)
    svc #0
    mov r0, #0
    ldr r0, [r0]
.fnend; .size _foo, .-_foo;

Assembler messages:
Error: SVC is not permitted on this architecture
Error: SVC is not permitted on this architecture

Revision history for this message
cfriedt (chrisfriedt) wrote :

I believe this is "solved" by specifying "-march=armv6s-m -mthumb" rather than "-march=armv6-m -mthumb", although the presence or lack of presence of an operating system should have little sway over what instructions are "permitted" to be generated by the assembler.

The concept of permission to generate an instruction is a completely unnecessary obstacle that is not specified by ARM, afaik. Therefore, this problem should not have to be "solved" in the first place.

Corollary via inconsistence: why would "-march=armv7-m" enable the assembler to always be "permitted" to generate svc?

Revision history for this message
Tony Liu (mrtoniliu) wrote :

Hi,

The unprivileged/privileged extension is optional for armv6-m architecture implementation.[1] Without this extension, it will not support Supervisor Call (SVC). If you want to use SVC, you need to specify the target of -march=armv6s-m.

It will also be better to use -mcpu=cortex-m0 rather than -march=armv6-m, because CPUs like Cortex-m0, Coetex-m0+ are implemented with the unprivileged/privileged extension.

BR,
Tony

[1]You can find more information about such extension in the section A1.2 and A4.9 in the ARMv6m Architecture Reference Manual.

Revision history for this message
cfriedt (chrisfriedt) wrote : Re: [Bug 1449610] Re: SVC is not permitted on this architecture

The specification says that SVC is supported in all versions of the Thumb
instruction set in the section I referenced earlier.

Furthermore, if you had thoroughly read the section you referenced, you
would have seen the note:

[quote]
In an ARMv6-M implementation that does not include the
Unprivileged/Privileged Extension,
execution is always privileged.

[emphasis added] However in such an implementation, application code might
use
supervisor calls to maintain a software hierarchy with a system
kernel.[/emphasis added]
[/quote]

Shall I file the bug upstream as well?

Thank you.

C

On Apr 30, 2015 3:05 AM, "Tony Liu" <email address hidden> wrote:
> The unprivileged/privileged extension is optional for armv6-m
> architecture implementation.[1] Without this extension, it will not
> support Supervisor Call (SVC). If you want to use SVC, you need to
> specify the target of -march=armv6s-m.
>
> It will also be better to use -mcpu=cortex-m0 rather than
> -march=armv6-m, because CPUs like Cortex-m0, Coetex-m0+ are implemented
> with the unprivileged/privileged extension.
>
> BR,
> Tony
>
> [1]You can find more information about such extension in the section
> A1.2 and A4.9 in the ARMv6m Architecture Reference Manual.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1449610
>
> Title:
> SVC is not permitted on this architecture
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gcc-arm-embedded/+bug/1449610/+subscriptions

Revision history for this message
cfriedt (chrisfriedt) wrote :

Just to clarify, if it isn't already in the spec somewhere else, if a
particular hardware implementation does not support the privilege
extension, it should interpret SVC as a NOP.

Compiler vendors (such as GNU) should use the extension "-march=armv6s-m"
(or equivalent) for optimizing-out SVC if such a level of optimization is
requested (e.g. "-O3").

Revision history for this message
cfriedt (chrisfriedt) wrote :

Alternatively, leave it implementation defined as to whether the
instruction generates an UNDEFINED or NOPs.

Revision history for this message
cfriedt (chrisfriedt) wrote :

At most, GCC should issue a warning for "-march=armv6-m" upon SVC.
Preferably with "-Wall".

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.