Commit 5286db75a80d4a4bcee3d0b0790daf85ce460d13
1 parent
917f95fd
convert mmap flags (alpha fix)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@208 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
30 additions
and
2 deletions
linux-user/syscall.c
@@ -958,6 +958,18 @@ StructEntry struct_termios_def = { | @@ -958,6 +958,18 @@ StructEntry struct_termios_def = { | ||
958 | .align = { __alignof__(struct target_termios), __alignof__(struct host_termios) }, | 958 | .align = { __alignof__(struct target_termios), __alignof__(struct host_termios) }, |
959 | }; | 959 | }; |
960 | 960 | ||
961 | +static bitmask_transtbl mmap_flags_tbl[] = { | ||
962 | + { TARGET_MAP_SHARED, TARGET_MAP_SHARED, MAP_SHARED, MAP_SHARED }, | ||
963 | + { TARGET_MAP_PRIVATE, TARGET_MAP_PRIVATE, MAP_PRIVATE, MAP_PRIVATE }, | ||
964 | + { TARGET_MAP_FIXED, TARGET_MAP_FIXED, MAP_FIXED, MAP_FIXED }, | ||
965 | + { TARGET_MAP_ANONYMOUS, TARGET_MAP_ANONYMOUS, MAP_ANONYMOUS, MAP_ANONYMOUS }, | ||
966 | + { TARGET_MAP_GROWSDOWN, TARGET_MAP_GROWSDOWN, MAP_GROWSDOWN, MAP_GROWSDOWN }, | ||
967 | + { TARGET_MAP_DENYWRITE, TARGET_MAP_DENYWRITE, MAP_DENYWRITE, MAP_DENYWRITE }, | ||
968 | + { TARGET_MAP_EXECUTABLE, TARGET_MAP_EXECUTABLE, MAP_EXECUTABLE, MAP_EXECUTABLE }, | ||
969 | + { TARGET_MAP_LOCKED, TARGET_MAP_LOCKED, MAP_LOCKED, MAP_LOCKED }, | ||
970 | + { 0, 0, 0, 0 } | ||
971 | +}; | ||
972 | + | ||
961 | #ifdef TARGET_I386 | 973 | #ifdef TARGET_I386 |
962 | 974 | ||
963 | /* NOTE: there is really one LDT for all the threads */ | 975 | /* NOTE: there is really one LDT for all the threads */ |
@@ -1744,7 +1756,9 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | @@ -1744,7 +1756,9 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | ||
1744 | v4 = tswap32(vptr[3]); | 1756 | v4 = tswap32(vptr[3]); |
1745 | v5 = tswap32(vptr[4]); | 1757 | v5 = tswap32(vptr[4]); |
1746 | v6 = tswap32(vptr[5]); | 1758 | v6 = tswap32(vptr[5]); |
1747 | - ret = get_errno(target_mmap(v1, v2, v3, v4, v5, v6)); | 1759 | + ret = get_errno(target_mmap(v1, v2, v3, |
1760 | + target_to_host_bitmask(v4, mmap_flags_tbl), | ||
1761 | + v5, v6)); | ||
1748 | } | 1762 | } |
1749 | break; | 1763 | break; |
1750 | #endif | 1764 | #endif |
@@ -1753,7 +1767,9 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | @@ -1753,7 +1767,9 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | ||
1753 | #else | 1767 | #else |
1754 | case TARGET_NR_mmap: | 1768 | case TARGET_NR_mmap: |
1755 | #endif | 1769 | #endif |
1756 | - ret = get_errno(target_mmap(arg1, arg2, arg3, arg4, arg5, | 1770 | + ret = get_errno(target_mmap(arg1, arg2, arg3, |
1771 | + target_to_host_bitmask(arg4, mmap_flags_tbl), | ||
1772 | + arg5, | ||
1757 | arg6 << TARGET_PAGE_BITS)); | 1773 | arg6 << TARGET_PAGE_BITS)); |
1758 | break; | 1774 | break; |
1759 | case TARGET_NR_munmap: | 1775 | case TARGET_NR_munmap: |
syscall-i386.h
@@ -780,6 +780,18 @@ struct target_modify_ldt_ldt_s { | @@ -780,6 +780,18 @@ struct target_modify_ldt_ldt_s { | ||
780 | }; | 780 | }; |
781 | 781 | ||
782 | 782 | ||
783 | +#define TARGET_MAP_SHARED 0x01 /* Share changes */ | ||
784 | +#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ | ||
785 | +#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ | ||
786 | +#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ | ||
787 | +#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ | ||
788 | + | ||
789 | +#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ | ||
790 | +#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ | ||
791 | +#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | ||
792 | +#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ | ||
793 | +#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ | ||
794 | + | ||
783 | /* vm86 defines */ | 795 | /* vm86 defines */ |
784 | 796 | ||
785 | #define TARGET_BIOSSEG 0x0f000 | 797 | #define TARGET_BIOSSEG 0x0f000 |