@@ -193,29 +193,14 @@ typedef struct GuestPhysListener {
193
193
MemoryListener listener ;
194
194
} GuestPhysListener ;
195
195
196
- static void guest_phys_blocks_region_add ( MemoryListener * listener ,
196
+ static void guest_phys_block_add_section ( GuestPhysListener * g ,
197
197
MemoryRegionSection * section )
198
198
{
199
- GuestPhysListener * g ;
200
- uint64_t section_size ;
201
- hwaddr target_start , target_end ;
202
- uint8_t * host_addr ;
203
- GuestPhysBlock * predecessor ;
204
-
205
- /* we only care about RAM */
206
- if (!memory_region_is_ram (section -> mr ) ||
207
- memory_region_is_ram_device (section -> mr ) ||
208
- memory_region_is_nonvolatile (section -> mr )) {
209
- return ;
210
- }
211
-
212
- g = container_of (listener , GuestPhysListener , listener );
213
- section_size = int128_get64 (section -> size );
214
- target_start = section -> offset_within_address_space ;
215
- target_end = target_start + section_size ;
216
- host_addr = memory_region_get_ram_ptr (section -> mr ) +
217
- section -> offset_within_region ;
218
- predecessor = NULL ;
199
+ const hwaddr target_start = section -> offset_within_address_space ;
200
+ const hwaddr target_end = target_start + int128_get64 (section -> size );
201
+ uint8_t * host_addr = memory_region_get_ram_ptr (section -> mr ) +
202
+ section -> offset_within_region ;
203
+ GuestPhysBlock * predecessor = NULL ;
219
204
220
205
/* find continuity in guest physical address space */
221
206
if (!QTAILQ_EMPTY (& g -> list -> head )) {
@@ -261,6 +246,20 @@ static void guest_phys_blocks_region_add(MemoryListener *listener,
261
246
#endif
262
247
}
263
248
249
+ static void guest_phys_blocks_region_add (MemoryListener * listener ,
250
+ MemoryRegionSection * section )
251
+ {
252
+ GuestPhysListener * g = container_of (listener , GuestPhysListener , listener );
253
+
254
+ /* we only care about RAM */
255
+ if (!memory_region_is_ram (section -> mr ) ||
256
+ memory_region_is_ram_device (section -> mr ) ||
257
+ memory_region_is_nonvolatile (section -> mr )) {
258
+ return ;
259
+ }
260
+ guest_phys_block_add_section (g , section );
261
+ }
262
+
264
263
void guest_phys_blocks_append (GuestPhysBlockList * list )
265
264
{
266
265
GuestPhysListener g = { 0 };
0 commit comments