exec.c: refactor function flatview_add_to_dispatch()
commit494d199727ba248c96326b4e1c97f86eb11a5ec7
authorWei Yang <richardw.yang@linux.intel.com>
Mon, 11 Mar 2019 05:42:52 +0000 (11 13:42 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 11 Mar 2019 15:51:42 +0000 (11 16:51 +0100)
treea17cbb6a37f783da806280537e5c2ae4e72ba92f
parente6c165f364c669b1357f15602ae3bd1d12357135
exec.c: refactor function flatview_add_to_dispatch()

flatview_add_to_dispatch() registers page based on the condition of
*section*, which may looks like this:

    |s|PPPPPPP|s|

where s stands for subpage and P for page.

The procedure of this function could be described as:

    - register first subpage
    - register page
    - register last subpage

This means the procedure could be simplified into these three steps
instead of a loop iteration.

This patch refactors the function into three corresponding steps and
adds some comment to clarify it.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190311054252.6094-1-richardw.yang@linux.intel.com>
[Paolo: move exit before adjustment of remain.offset_within_*,
 otherwise int128_get64 fails when a region is 2^64 bytes long]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec.c