This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

why the wrapper function is used for rt_free_box in RTX

I'm confused about the wrapper function used for rt_free_box in RTX...

CMx reversion implements rt_free_box with exclusive access,LDREX/STREX,then it is intrinsically reentrant and thread-safe. The wrapper function is here.

 /*--------------------------- _free_box -------------------------------------*/

__asm int _free_box (void *box_mem, void *box) {
   /* Function wrapper for Unprivileged/Privileged mode. */
        LDR     R12,=__cpp(rt_free_box)
        MRS     R3,IPSR
        LSLS    R3,#24
        BXNE    R12
        MRS     R3,CONTROL
        LSLS    R3,#31
        BXEQ    R12
        SVC     0
        BX      LR

        ALIGN
}

.

why the wrapper forces it executes in an exception,or call SVC ? Privileged mode do be necessary for it ? it seems that rt_free_box could be well in Unprivileged mode and Thread mode

Any idea ?