What exactly happens if the class b complementary check is interrupted?
To protect variables in a class b application a redundant complementary variable is stored in a separate memory location. The idea is to check if the exclusive or of those 2 variables is 0xFF before using them. My question is what exactly happens if the comparison is interrupted and the value is changed in the meantime? Following is a short example:
1013 ; 374 if ((spl_state_u8 ^ spl_state_inv_u8) == 0xFFU)
1015 0287 b60c ld a,L71_spl_state_u8
1016 0289 b80d xor a,L12_spl_state_inv_u8
1017 028b a1ff cp a,#255
1018 028d 2704ac2a032a jrne L134
The value L71_spl_state_u8 is loaded into register a (1015), then a hypothetical interrupt occurs which changes the value of L71_spl_state_u8 and the complementary value L12_spl_state_inv_u8. After the interrupt the register a is restored from the stack but the new value of L12_spl_state_inv_u8 is taken for comparison (1016). This will fail and the application will exit. Is my interpretation correct? Or did i miss something? Because that is exactly how the class b library is implemented by st.
