Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
11ddeea9
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
11ddeea9
编写于
9月 26, 2011
作者:
A
Anthony Liguori
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging
上级
1ce9ce6a
fc9c5412
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
579 addition
and
220 deletion
+579
-220
linux-user/elfload.c
linux-user/elfload.c
+54
-2
linux-user/main.c
linux-user/main.c
+459
-215
linux-user/qemu.h
linux-user/qemu.h
+6
-0
linux-user/syscall.c
linux-user/syscall.c
+60
-3
未找到文件。
linux-user/elfload.c
浏览文件 @
11ddeea9
...
...
@@ -332,6 +332,49 @@ enum
ARM_HWCAP_ARM_VFPv3D16
=
1
<<
13
,
};
#define TARGET_HAS_GUEST_VALIDATE_BASE
/* We want the opportunity to check the suggested base */
bool
guest_validate_base
(
unsigned
long
guest_base
)
{
unsigned
long
real_start
,
test_page_addr
;
/* We need to check that we can force a fault on access to the
* commpage at 0xffff0fxx
*/
test_page_addr
=
guest_base
+
(
0xffff0f00
&
qemu_host_page_mask
);
/* Note it needs to be writeable to let us initialise it */
real_start
=
(
unsigned
long
)
mmap
((
void
*
)
test_page_addr
,
qemu_host_page_size
,
PROT_READ
|
PROT_WRITE
,
MAP_ANONYMOUS
|
MAP_PRIVATE
|
MAP_ANONYMOUS
,
-
1
,
0
);
/* If we can't map it then try another address */
if
(
real_start
==
-
1ul
)
{
return
0
;
}
if
(
real_start
!=
test_page_addr
)
{
/* OS didn't put the page where we asked - unmap and reject */
munmap
((
void
*
)
real_start
,
qemu_host_page_size
);
return
0
;
}
/* Leave the page mapped
* Populate it (mmap should have left it all 0'd)
*/
/* Kernel helper versions */
__put_user
(
5
,
(
uint32_t
*
)
g2h
(
0xffff0ffcul
));
/* Now it's populated make it RO */
if
(
mprotect
((
void
*
)
test_page_addr
,
qemu_host_page_size
,
PROT_READ
))
{
perror
(
"Protecting guest commpage"
);
exit
(
-
1
);
}
return
1
;
/* All good */
}
#define ELF_HWCAP (ARM_HWCAP_ARM_SWP | ARM_HWCAP_ARM_HALF \
| ARM_HWCAP_ARM_THUMB | ARM_HWCAP_ARM_FAST_MULT \
| ARM_HWCAP_ARM_FPA | ARM_HWCAP_ARM_VFP \
...
...
@@ -1309,6 +1352,14 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
return
sp
;
}
#ifndef TARGET_HAS_GUEST_VALIDATE_BASE
/* If the guest doesn't have a validation function just agree */
bool
guest_validate_base
(
unsigned
long
guest_base
)
{
return
1
;
}
#endif
static
void
probe_guest_base
(
const
char
*
image_name
,
abi_ulong
loaddr
,
abi_ulong
hiaddr
)
{
...
...
@@ -1345,7 +1396,9 @@ static void probe_guest_base(const char *image_name,
if
(
real_start
==
(
unsigned
long
)
-
1
)
{
goto
exit_perror
;
}
if
(
real_start
==
host_start
)
{
guest_base
=
real_start
-
loaddr
;
if
((
real_start
==
host_start
)
&&
guest_validate_base
(
guest_base
))
{
break
;
}
/* That address didn't work. Unmap and try a different one.
...
...
@@ -1368,7 +1421,6 @@ static void probe_guest_base(const char *image_name,
qemu_log
(
"Relocating guest address space from 0x"
TARGET_ABI_FMT_lx
" to 0x%lx
\n
"
,
loaddr
,
real_start
);
guest_base
=
real_start
-
loaddr
;
}
return
;
...
...
linux-user/main.c
浏览文件 @
11ddeea9
此差异已折叠。
点击以展开。
linux-user/qemu.h
浏览文件 @
11ddeea9
...
...
@@ -202,6 +202,12 @@ int get_osversion(void);
void
fork_start
(
void
);
void
fork_end
(
int
child
);
/* Return true if the proposed guest_base is suitable for the guest.
* The guest code may leave a page mapped and populate it if the
* address is suitable.
*/
bool
guest_validate_base
(
unsigned
long
guest_base
);
#include "qemu-log.h"
/* strace.c */
...
...
linux-user/syscall.c
浏览文件 @
11ddeea9
...
...
@@ -70,6 +70,9 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
#ifdef CONFIG_EPOLL
#include <sys/epoll.h>
#endif
#ifdef CONFIG_ATTR
#include <attr/xattr.h>
#endif
#define termios host_termios
#define winsize host_winsize
...
...
@@ -796,6 +799,15 @@ abi_long do_brk(abi_ulong new_brk)
MAP_ANON
|
MAP_PRIVATE
,
0
,
0
));
if
(
mapped_addr
==
brk_page
)
{
/* Heap contents are initialized to zero, as for anonymous
* mapped pages. Technically the new pages are already
* initialized to zero since they *are* anonymous mapped
* pages, however we have to take care with the contents that
* come from the remaining part of the previous page: it may
* contains garbage data due to a previous heap usage (grown
* then shrunken). */
memset
(
g2h
(
target_brk
),
0
,
brk_page
-
target_brk
);
target_brk
=
new_brk
;
brk_page
=
HOST_PAGE_ALIGN
(
target_brk
);
DEBUGF_BRK
(
"%#010x (mapped_addr == brk_page)
\n
"
,
target_brk
);
...
...
@@ -7632,22 +7644,67 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#endif
break
;
#endif
#ifdef CONFIG_ATTR
#ifdef TARGET_NR_setxattr
case
TARGET_NR_setxattr
:
case
TARGET_NR_lsetxattr
:
case
TARGET_NR_fsetxattr
:
case
TARGET_NR_getxattr
:
case
TARGET_NR_lgetxattr
:
case
TARGET_NR_fgetxattr
:
case
TARGET_NR_listxattr
:
case
TARGET_NR_llistxattr
:
case
TARGET_NR_flistxattr
:
case
TARGET_NR_removexattr
:
case
TARGET_NR_lremovexattr
:
case
TARGET_NR_fremovexattr
:
ret
=
-
TARGET_EOPNOTSUPP
;
break
;
case
TARGET_NR_setxattr
:
{
void
*
p
,
*
n
,
*
v
;
p
=
lock_user_string
(
arg1
);
n
=
lock_user_string
(
arg2
);
v
=
lock_user
(
VERIFY_READ
,
arg3
,
arg4
,
1
);
if
(
p
&&
n
&&
v
)
{
ret
=
get_errno
(
setxattr
(
p
,
n
,
v
,
arg4
,
arg5
));
}
else
{
ret
=
-
TARGET_EFAULT
;
}
unlock_user
(
p
,
arg1
,
0
);
unlock_user
(
n
,
arg2
,
0
);
unlock_user
(
v
,
arg3
,
0
);
}
break
;
case
TARGET_NR_getxattr
:
{
void
*
p
,
*
n
,
*
v
;
p
=
lock_user_string
(
arg1
);
n
=
lock_user_string
(
arg2
);
v
=
lock_user
(
VERIFY_WRITE
,
arg3
,
arg4
,
0
);
if
(
p
&&
n
&&
v
)
{
ret
=
get_errno
(
getxattr
(
p
,
n
,
v
,
arg4
));
}
else
{
ret
=
-
TARGET_EFAULT
;
}
unlock_user
(
p
,
arg1
,
0
);
unlock_user
(
n
,
arg2
,
0
);
unlock_user
(
v
,
arg3
,
arg4
);
}
break
;
case
TARGET_NR_removexattr
:
{
void
*
p
,
*
n
;
p
=
lock_user_string
(
arg1
);
n
=
lock_user_string
(
arg2
);
if
(
p
&&
n
)
{
ret
=
get_errno
(
removexattr
(
p
,
n
));
}
else
{
ret
=
-
TARGET_EFAULT
;
}
unlock_user
(
p
,
arg1
,
0
);
unlock_user
(
n
,
arg2
,
0
);
}
break
;
#endif
#endif
/* CONFIG_ATTR */
#ifdef TARGET_NR_set_thread_area
case
TARGET_NR_set_thread_area
:
#if defined(TARGET_MIPS)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录