SVC handlers

Hi Experts,

The RTX code contains SVC handlers named with different names. How this can be best made use of ?

Why the option to select numbering of different svc handlers like _svc(0) ....  __svc(n) ?

Regards,

Techguyz

Parents
  • I can't answer your question about RTX, but I can answer the part regarding svc numbering.

    The numbers would be useful, in case you need more than one functionality.

    For instance, consider you're running your program in user mode, and you need to change a pin of a GPIO port.

    You've decided that svc(3) changes your favourite GPIO-port.

    But you also need the ability to read a sector from a SD-card. For that purpose, you've chosen svc(17)

    ...etc.

    You have 256 different immediate values you can use for this purpose. But in case you need more than that, you could make sub-function numbers.

    Eg. svc(2) might examine what's in r0, and use r0 as a function selector.

    So basically, you have a single handler, which examines the parameters for SVC and uses the parameter as a function selector.

    You could use this to implement system function calls, such as malloc, free, fopen, fseek, fread, fwrite, fclose, etc, etc...

Reply
  • I can't answer your question about RTX, but I can answer the part regarding svc numbering.

    The numbers would be useful, in case you need more than one functionality.

    For instance, consider you're running your program in user mode, and you need to change a pin of a GPIO port.

    You've decided that svc(3) changes your favourite GPIO-port.

    But you also need the ability to read a sector from a SD-card. For that purpose, you've chosen svc(17)

    ...etc.

    You have 256 different immediate values you can use for this purpose. But in case you need more than that, you could make sub-function numbers.

    Eg. svc(2) might examine what's in r0, and use r0 as a function selector.

    So basically, you have a single handler, which examines the parameters for SVC and uses the parameter as a function selector.

    You could use this to implement system function calls, such as malloc, free, fopen, fseek, fread, fwrite, fclose, etc, etc...

Children
More questions in this forum