Context switching for protected stacks

Utkarsh Rai utkarsh.rai60 at gmail.com
Thu Jun 18 05:17:35 UTC 2020


Hello,
For my GSoC project, I need to set/unset the memory attributes of the
thread stacks on each context switch.
Right now I am making changes to the CPU-specific context switch assembly
code. The arm/../cpu.h file has the Context_Control structure, which is
used to store the relevant registers at each context switch.
 I have been trying to add the stack attributes to this structure from the
'rtems/score/stackmanagement.h' header (This header has been defined by me
and has the stack attributes structure).
 After that, I would initialize the stack attributes in
_CPU_Context_Initialize.
 For unsetting stack memories, I plan on making changes
to _CPU_Context_Switch().
The problem is when I try to include the header in cpu.h it breaks the
build with the following error -

'.......
........
/home/utkarsh/sandbox/rtems/5/arm-rtems5/include/machine/_default_types.h:
Assembler messages:
/home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:42:
Error: junk at end of line, first unrecognized character is `}'
/home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:44:
Error: bad instruction `typedef struct stack_attr_prot'
/home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:45:
Error: junk at end of line, first unrecognized character is `{'
/home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:46:
Error: bad instruction `stack_attr_shared *shared_stacks'
/home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:47:
Error: bad instruction `stack_attr Base'
/home/utkarsh/sandbox/rtems/cpukit/include/rtems/score/stackmanagement.h:48:
Error: bad instruction `_bool current_stack'
{standard input}: Error: invalid operands (*UND* and *ABS* sections) for
`*' when setting `iter'
Makefile:11563: recipe for target 'score/cpu/arm/arm-context-validate.o'
failed
make[4]: *** [score/cpu/arm/arm-context-validate.o] Error 1
'
I have defined the stackmanagement.h header in the cpukit/headers.am and
this is obviously an assembler error.  Can someone point out what is it
that I am doing wrong?

I also would like to verify if the above way of handling context switching
is the appropriate way to proceed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200618/045664a7/attachment-0001.html>


More information about the devel mailing list