Region expression
Syntax
region-operand|region-expr|region-operand|region-expr-region-operand|region-expr®ion-operand
where region-operand is one of:
(region-expr)region-nameregion-literalempty-region
where region-name is a region, see define region directive
where region-literal is a region literal, see Region literal
and where empty-region is an empty region, see Empty region.
Description
Normally, a region consists of one memory range, which means a region literal is sufficient to express it. When a region contains several ranges, it is instead necessary to use a region expression to express it. Region expressions are actually set expressions on sets of memory ranges.
To create region expressions, three operators are available: union (|), intersection (&), and difference (-). These operators work as in set theory. For example, if you have the sets A and B, then the result of the operators would be:
A | B: all elements in either set A or set BA & B: all elements in both set A and BA - B: all elements in set A but not in B.
Example
/* Resulting in a range starting at 1000 and ending at 2FFF */ [from 0x1000 to 0x1FFF] | [from 0x1500 to 0x2FFF] /* Resulting in a range starting at 1500 and ending at 1FFF */ [from 0x1000 to 0x1FFF] & [from 0x1500 to 0x2FFF] /* Resulting in a range starting at 1000 and ending at 14FF */ [from 0x1000 to 0x1FFF] - [from 0x1500 to 0x2FFF] /* Resulting in two ranges, the first starting at 1000 and ending at 1FFF, the second starting at 2501 and ending at 2FFF */ [from 0x1000 to 0x2FFF] - [from 0x2000 to 0x24FF]