Revision b41aac4f exec.c
b/exec.c | ||
---|---|---|
107 | 107 |
|
108 | 108 |
static MemoryRegionSection *phys_sections; |
109 | 109 |
static unsigned phys_sections_nb, phys_sections_nb_alloc; |
110 |
static uint16_t phys_section_unassigned;
|
|
111 |
static uint16_t phys_section_notdirty;
|
|
112 |
static uint16_t phys_section_rom;
|
|
113 |
static uint16_t phys_section_watch;
|
|
110 |
#define PHYS_SECTION_UNASSIGNED 0
|
|
111 |
#define PHYS_SECTION_NOTDIRTY 1
|
|
112 |
#define PHYS_SECTION_ROM 2
|
|
113 |
#define PHYS_SECTION_WATCH 3
|
|
114 | 114 |
|
115 | 115 |
/* Simple allocator for PhysPageEntry nodes */ |
116 | 116 |
static PhysPageEntry (*phys_map_nodes)[L2_SIZE]; |
... | ... | |
168 | 168 |
if (level == 0) { |
169 | 169 |
for (i = 0; i < L2_SIZE; i++) { |
170 | 170 |
p[i].is_leaf = 1; |
171 |
p[i].ptr = phys_section_unassigned;
|
|
171 |
p[i].ptr = PHYS_SECTION_UNASSIGNED;
|
|
172 | 172 |
} |
173 | 173 |
} |
174 | 174 |
} else { |
... | ... | |
207 | 207 |
|
208 | 208 |
for (i = P_L2_LEVELS - 1; i >= 0 && !lp.is_leaf; i--) { |
209 | 209 |
if (lp.ptr == PHYS_MAP_NODE_NIL) { |
210 |
return &phys_sections[phys_section_unassigned];
|
|
210 |
return &phys_sections[PHYS_SECTION_UNASSIGNED];
|
|
211 | 211 |
} |
212 | 212 |
p = phys_map_nodes[lp.ptr]; |
213 | 213 |
lp = p[(index >> (i * L2_BITS)) & (L2_SIZE - 1)]; |
... | ... | |
717 | 717 |
iotlb = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK) |
718 | 718 |
+ xlat; |
719 | 719 |
if (!section->readonly) { |
720 |
iotlb |= phys_section_notdirty;
|
|
720 |
iotlb |= PHYS_SECTION_NOTDIRTY;
|
|
721 | 721 |
} else { |
722 |
iotlb |= phys_section_rom;
|
|
722 |
iotlb |= PHYS_SECTION_ROM;
|
|
723 | 723 |
} |
724 | 724 |
} else { |
725 | 725 |
iotlb = section - phys_sections; |
... | ... | |
732 | 732 |
if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) { |
733 | 733 |
/* Avoid trapping reads of pages with a write breakpoint. */ |
734 | 734 |
if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) { |
735 |
iotlb = phys_section_watch + paddr;
|
|
735 |
iotlb = PHYS_SECTION_WATCH + paddr;
|
|
736 | 736 |
*address |= TLB_MMIO; |
737 | 737 |
break; |
738 | 738 |
} |
... | ... | |
1656 | 1656 |
printf("%s: %p base " TARGET_FMT_plx " len %08x %d\n", __func__, |
1657 | 1657 |
mmio, base, TARGET_PAGE_SIZE, subpage_memory); |
1658 | 1658 |
#endif |
1659 |
subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, phys_section_unassigned);
|
|
1659 |
subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, PHYS_SECTION_UNASSIGNED);
|
|
1660 | 1660 |
|
1661 | 1661 |
return mmio; |
1662 | 1662 |
} |
... | ... | |
1698 | 1698 |
|
1699 | 1699 |
static void core_begin(MemoryListener *listener) |
1700 | 1700 |
{ |
1701 |
uint16_t n; |
|
1702 |
|
|
1701 | 1703 |
phys_sections_clear(); |
1702 |
phys_section_unassigned = dummy_section(&io_mem_unassigned); |
|
1703 |
phys_section_notdirty = dummy_section(&io_mem_notdirty); |
|
1704 |
phys_section_rom = dummy_section(&io_mem_rom); |
|
1705 |
phys_section_watch = dummy_section(&io_mem_watch); |
|
1704 |
n = dummy_section(&io_mem_unassigned); |
|
1705 |
assert(n == PHYS_SECTION_UNASSIGNED); |
|
1706 |
n = dummy_section(&io_mem_notdirty); |
|
1707 |
assert(n == PHYS_SECTION_NOTDIRTY); |
|
1708 |
n = dummy_section(&io_mem_rom); |
|
1709 |
assert(n == PHYS_SECTION_ROM); |
|
1710 |
n = dummy_section(&io_mem_watch); |
|
1711 |
assert(n == PHYS_SECTION_WATCH); |
|
1706 | 1712 |
} |
1707 | 1713 |
|
1708 | 1714 |
static void tcg_commit(MemoryListener *listener) |
Also available in: Unified diff