nlr_push - should it include the floating point registers?

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

nlr_push - should it include the floating point registers?

Post by jickster » Tue Oct 31, 2017 6:10 pm

Looking at the teensy port compile options, I see that -mfloat-abi=hard is used.

Therefore, in nlr_push(), why aren't the floating point registers saved?

My pre-processed nlr_push code is this

Code: Select all

__attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) {

    __asm volatile (
    "str    r4, [r0, #12]       \n" // store r4 into nlr_buf
    "str    r5, [r0, #16]       \n" // store r5 into nlr_buf
    "str    r6, [r0, #20]       \n" // store r6 into nlr_buf
    "str    r7, [r0, #24]       \n" // store r7 into nlr_buf
# 62 "../py/nlrthumb.c"
    "str    r8, [r0, #28]       \n" // store r8 into nlr_buf
    "str    r9, [r0, #32]       \n" // store r9 into nlr_buf
    "str    r10, [r0, #36]      \n" // store r10 into nlr_buf
    "str    r11, [r0, #40]      \n" // store r11 into nlr_buf
    "str    r13, [r0, #44]      \n" // store r13=sp into nlr_buf
    "str    lr, [r0, #8]        \n" // store lr into nlr_buf
# 76 "../py/nlrthumb.c"
    "b      nlr_push_tail       \n" // do the rest in C

    );

    return 0; // needed to silence compiler warning
}
I'm new to ARM but someone told me that the S-registers need to be saved if hard floating point is enabled and indeed, google yields this ARM page http://infocenter.arm.com/help/index.js ... DEEJE.html showing the S registers.

Post Reply