# Vault 7: Projects

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

### Protego

# MPLAB XC16 C-Compiler

- 1
- 2
…
- 305
- 306
- 307
- 308
- 309
…
- 365
- 366

Built-in Functions
 2012-2013 Microchip Technology Inc. DS50002071C-page 307
__builtin_dmapage
Description: Obtains the page number of a symbol within DMA memory.
For example:
unsigned int result;
char buffer[256] __attribute__((space(dma)));
result = __builtin_dmapage(&buffer);
Might generate:
mov #dmapage(buffer), w0
Prototype: unsigned int __builtin_dmapage(const void *p);
Argument: *p pointer to DMA address value
Return Value: Returns the page number of a variable located in DMA memory.
Assembler Operator/
Machine Instruction:
dmapage
Error Messages An error message will be displayed if the parameter is not the address of a global symbol.
__builtin_dmaoffset
Description: Obtains the offset of a symbol within DMA memory.
For example:
unsigned int result;
char buffer[256] __attribute__((space(dma)));
result = __builtin_dmaoffset(&buffer);
Might generate:
mov #dmaoffset(buffer), w0
Prototype: unsigned int __builtin_dmaoffset(const void *p);
Argument: *p pointer to DMA address value
Return Value: Returns the offset to a variable located in DMA memory.
Assembler Operator/
Machine Instruction:
dmaoffset
Error Messages An error message will be displayed if the parameter is not the address of a global symbol.
__builtin_ed
Description: Squares sqr, returning it as the result. Also prefetches data for future square operation by
computing **xptr - **yptr and storing the result in *distance.
xincr and yincr may be the literal values: -6, -4, -2, 0, 2, 4, 6 or an integer value.
For example:
volatile register int result asm("A");
int *xmemory, *ymemory;
int distance;
result = __builtin_ed(distance,
&xmemory, 2,
&ymemory, 2,
&distance);
might generate:
ed w4*w4, A, [w8]+=2, [W10]+=2, w4
Prototype: int __builtin_ed(int sqr, int **xptr, int xincr,
int **yptr, int yincr, int *distance);

- 1
- 2
…
- 305
- 306
- 307
- 308
- 309
…
- 365
- 366