Skip to content

[Feature Request] The number of system calls needs to support the sizeof(uintptr_t) #1015

Closed
@snikeguo

Description

@snikeguo

Is your feature request related to a problem? Please describe.
I need to add a custom SystemCall instruction to execute a custom function.
However, the maximum number of system call instructions is 255.

Describe the solution you'd like

....
#define SYSTEM_CALL_User   80
#define SYSTEM_CALL_xUartSend   10001 
....
PRIVILEGED_DATA UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ] =
{
 ...
 xUartSendImpl,
}


...
BaseType_t MPU_xUartSend(..... )
{
__asm volatile
(
    " .syntax unified                                       \n"
                " .extern MPU_xUartSendImpl                            \n"
                "                                                       \n"
                " push {r0}                                             \n"
                " mrs r0, control                                       \n"
                " tst r0, #1                                            \n"
                " pop {r0}                                              \n"
                " bne MPU_xUartSend_Unpriv                             \n"
                " MPU_xUartSend_Priv:                                  \n"
                "     b MPU_xUartSendImpl                              \n"
                " MPU_xUartSend_Unpriv                                 \n"
                "     svc %0                                            \n"
                "                                                       \n"
               pc+x : "i" ( SYSTEM_CALL_User ) : "memory" 
                pc+y : "i" ( .word SYSTEM_CALL_xUartSend   ) : "memory"  //define a word :system call id I am not familiar with assembly syntax.
);
} 
...
void vSystemCallEnter( uint32_t * pulTaskStack,
                           uint32_t ulLR,
                           uint8_t ucSystemCallNumber ) 
{
....
ulSystemCallLocation = pulTaskStack[ portOFFSET_TO_PC ];
if( ( ulSystemCallLocation >= ( uint32_t ) __syscalls_flash_start__ ) &&
            ( ulSystemCallLocation <= ( uint32_t ) __syscalls_flash_end__ ) &&
            ( pxMpuSettings->xSystemCallStackInfo.pulTaskStack == NULL ) &&
            ( uxSystemCallImplementations[ ucSystemCallNumber ] != ( UBaseType_t ) 0 ) )
{
...
 uint32_t systemCallId=*(pulTaskStack[ portOFFSET_TO_PC ]+x);//get user system call id
if( systemCallId>=SYSTEM_CALL_User )
{
    systemCallId=*(pulTaskStack[ portOFFSET_TO_PC ]+y); 
}
.....
 ......
...
}
....
}



Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

How many devices will this feature impact?
Expected volume for your product.

What are your project timelines?
Timeline for milestones such as design completion, testing and validation, and production.

Additional context
Add any other context or screenshots about the feature request here.

If you have the same (or similar) feature request, please upvote this issue with thumbs up 👍
and use the comments section to provide answers to the questions above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions