linux-user/mmap.c: Use end instead of real_end in target_mmap
PATCH 1/1 linux-user/mmap.c: Use end instead of real_end in target_mmap
From: Chen Gang <[email protected]>
In this case, real_end is larger than end, which may cause mmap_frag process the incorrect memory region.
--- linux-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/mmap.c +1 -1
@@ -536,7 +536,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,/* handle the end of the mapping */ if (end < real_end) { ret =mmap_frag (real_end - qemu_host_page_size, - real_end - qemu_host_page_size, real_end, + real_end - qemu_host_page_size, end, prot, flags, fd, offset + real_end - qemu_host_page_size - start);if (ret ==-1 )
Signature · 1 line
1.9.1
Hello all:
After this patch, the i386 wine notepad.exe can be bootup and run under sw_64 host.
- The initialization is very very slow (about 10 minutes), it is mainly running in find_vma_reserved (consume more than 95% time resource). I guess, it can be optimized.
- After initialization, for real using, the performance is acceptable!! :-)
- Next, I shall try the real Windows XP notepad.exe.
I guess, we need not softmmu, at least, for wine, it is true (wine will mmap all memory areas during initializing, and manage them by itself when real running).
Welcome any suggestions, ideas, and completions.
BTW: Merry Christmas! :-)
Thanks.
Quoted 24 lines · On 2015年12月24日 09:07, [email protected] wrote:
From: Chen Gang <[email protected]>
In this case,
real_endis larger than end, which may causemmap_fragprocess the incorrect memory region.Signed-off-by Chen Gang <[email protected]>--- linux-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)linux-user/mmap.c +1
-1@@ -536,7 +536,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,/* handle the end of the mapping */ if (end < real_end) { ret =mmap_frag (real_end - qemu_host_page_size, - real_end - qemu_host_page_size, real_end, + real_end - qemu_host_page_size, end, prot, flags, fd, offset + real_end - qemu_host_page_size - start);if (ret ==-1 )
Signature · 3 lines
Chen Gang (陈刚) Open, share, and attitude like air, water, and life which God blessed
Quoted 16 lines · Le 24/12/2015 02:07, [email protected] a écrit :
From: Chen Gang <[email protected]>
In this case,
real_endis larger than end, which may causemmap_fragprocess the incorrect memory region.Signed-off-by Chen Gang <[email protected]>--- linux-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)linux-user/mmap.c +0
-0
linux-user/mmap.c abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, · line 542
Quoted 8 lines
linux-user/mmap.c +1
-1@@ -536,7 +536,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,/* handle the end of the mapping */ if (end < real_end) { ret =mmap_frag (real_end - qemu_host_page_size, - real_end - qemu_host_page_size, real_end, + real_end - qemu_host_page_size, end, prot, flags, fd, offset + real_end - qemu_host_page_size - start);if (ret ==-1 )
The fragment must effectively be mapped only to "end" not to "real_end" (which is a host page aligned address, and thus this is not a fragment). It is consistent with what it is done in the case of one single page.
Quoted 31 lines · Laurent Vivier
Quoted 16 lines · Le 24/12/2015 02:07, [email protected] a écrit :
From: Chen Gang <[email protected]>
In this case,
real_endis larger than end, which may causemmap_fragprocess the incorrect memory region.Signed-off-by Chen Gang <[email protected]>--- linux-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)linux-user/mmap.c +0
-0linux-user/mmap.c abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, · line 542
Quoted 8 lines
linux-user/mmap.c +1
-1@@ -536,7 +536,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,/* handle the end of the mapping */ if (end < real_end) { ret =mmap_frag (real_end - qemu_host_page_size, - real_end - qemu_host_page_size, real_end, + real_end - qemu_host_page_size, end, prot, flags, fd, offset + real_end - qemu_host_page_size - start);if (ret ==-1 )The fragment must effectively be mapped only to "end" not to "
real_end" (which is a host page aligned address, and thus this is not a fragment). It is consistent with what it is done in the case of one single page.
Quoted 1 line
Reviewed-by Laurent Vivier <[email protected]>
Thank you for your comments. I only met this issue, and knew it should be fixed in this way, but really don't know the related details.
Thanks.
Signature · 3 lines
Chen Gang Open, share, and attitude like air, water, and life which God blessed
Quoted 7 lines · Laurent Vivier
Quoted 5 lines · Le 24/12/2015 02:07, [email protected] a écrit :
From: Chen Gang <[email protected]>
In this case,
real_endis larger than end, which may causemmap_fragprocess the incorrect memory region.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Chen Gang <[email protected]>--- ...
The fragment must effectively be mapped only to "end" not to "
real_end" (which is a host page aligned address, and thus this is not a fragment). It is consistent with what it is done in the case of one single page.Reviewed-by Laurent Vivier <[email protected]>
Applied with changing the patch comment to Laurent's explanation.
Riku