Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
snikeguo opened this issue Mar 26, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@snikeguo
Copy link

snikeguo commented Mar 26, 2024

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.

@snikeguo snikeguo added the enhancement New feature or request label Mar 26, 2024
@Skptak
Copy link
Member

Skptak commented Mar 26, 2024

What port are you using?
The ARMv7-M and ARMv8-M architectures only support an 8 bit SVC value.
Link to the ARMv7M Architecture doc
Link to the ARMv8M Architecture Download page, the relevant section is C2.4.242 SVC
image

As this is a Hardware Limitation this request isn't a feature that FreeRTOS can support

@snikeguo
Copy link
Author

@Skptak I have made changes to the implementation. Please refresh the page to view my ideas.

@Skptak
Copy link
Member

Skptak commented Mar 26, 2024

Your proposed change is a larger design change, and more of a feature request. Can you open a post on the FreeRTOS Forums to discuss it there please?

@aggarg
Copy link
Member

aggarg commented Mar 26, 2024

As @Skptak suggested, please open a forum issue. I am closing this one.

@aggarg aggarg closed this as completed Mar 26, 2024
laroche pushed a commit to laroche/FreeRTOS-Kernel that referenced this issue Apr 18, 2024
Also, fix the broken tests by that PR.

Signed-off-by: Gaurav Aggarwal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants