Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

Functions
2012-2013 Microchip Technology Inc. DS50002071C-page 183
Automatic variables are owned by the enclosing function and do not need the secure
attribute. They may be assigned initial values, as shown:
void __attribute__((secure)) chuck_cookies()
{
int hurl;
int them = 55;
char *where = "far";
splat(where);
/* ... */
}
Note that the initial value of where is based on a string literal which is allocated in the
PSV constant section .secure_const. The compiler will set PSVPAG to the correct
value upon entrance to the function. If necessary, the compiler will also restore
PSVPAG after the call to splat().
shadow
The shadow attribute causes the compiler to use the shadow registers rather than the
software stack for saving registers. This attribute is usually used in conjunction with the
interrupt attribute.
void __attribute__ ((interrupt, shadow)) _T1Interrupt (void);
unsupported("message")
This attribute will display a custom message when the object is used.
int foo
__
attribute
__
((unsupported
(This object is unsupported
));
Access to foo will generate a warning message.
unused
This attribute, attached to a function, means that the function is meant to be possibly
unused. The compiler will not produce an unused function warning for this function.
user_init
The user_init attribute may be applied to any non-interrupt function with void
parameter and return types. Applying this attribute will cause default C start-up mod-
ules to call this function before the user main is executed. There is no guarantee of
ordering, so these functions cannot rely on other user_init functions having been
previously run; these functions will be called after PSV and data initialization. A
user_init may still be called by the executing program. For example:
void __attribute__((user_init)) initialize_me(void) {
// perform initalization sequence alpha alpha beta
}
weak
See Section 8.12 Variable Attributes for information on the weak attribute.

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh