Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
eb51d102
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看板
提交
eb51d102
编写于
5月 14, 2003
作者:
B
bellard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
better locks
git-svn-id:
svn://svn.savannah.nongnu.org/qemu/trunk@169
c046a42c-6fe2-441c-8c8c-71466251a162
上级
25eb4484
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
104 addition
and
0 deletion
+104
-0
cpu-i386.h
cpu-i386.h
+100
-0
exec.c
exec.c
+4
-0
未找到文件。
cpu-i386.h
浏览文件 @
eb51d102
...
...
@@ -542,4 +542,104 @@ static inline TranslationBlock *tb_find(TranslationBlock ***pptb,
#define offsetof(type, field) ((size_t) &((type *)0)->field)
#endif
#ifdef __powerpc__
static
inline
int
testandset
(
int
*
p
)
{
int
ret
;
__asm__
__volatile__
(
"0: lwarx %0,0,%1 ;"
" xor. %0,%3,%0;"
" bne 1f;"
" stwcx. %2,0,%1;"
" bne- 0b;"
"1: "
:
"=&r"
(
ret
)
:
"r"
(
p
),
"r"
(
1
),
"r"
(
0
)
:
"cr0"
,
"memory"
);
return
ret
;
}
#endif
#ifdef __i386__
static
inline
int
testandset
(
int
*
p
)
{
char
ret
;
long
int
readval
;
__asm__
__volatile__
(
"lock; cmpxchgl %3, %1; sete %0"
:
"=q"
(
ret
),
"=m"
(
*
p
),
"=a"
(
readval
)
:
"r"
(
1
),
"m"
(
*
p
),
"a"
(
0
)
:
"memory"
);
return
ret
;
}
#endif
#ifdef __s390__
static
inline
int
testandset
(
int
*
p
)
{
int
ret
;
__asm__
__volatile__
(
"0: cs %0,%1,0(%2)
\n
"
" jl 0b"
:
"=&d"
(
ret
)
:
"r"
(
1
),
"a"
(
p
),
"0"
(
*
p
)
:
"cc"
,
"memory"
);
return
ret
;
}
#endif
#ifdef __alpha__
int
testandset
(
int
*
p
)
{
int
ret
;
unsigned
long
one
;
__asm__
__volatile__
(
"0: mov 1,%2
\n
"
" ldl_l %0,%1
\n
"
" stl_c %2,%1
\n
"
" beq %2,1f
\n
"
".subsection 2
\n
"
"1: br 0b
\n
"
".previous"
:
"=r"
(
ret
),
"=m"
(
*
p
),
"=r"
(
one
)
:
"m"
(
*
p
));
return
ret
;
}
#endif
#ifdef __sparc__
static
inline
int
testandset
(
int
*
p
)
{
int
ret
;
__asm__
__volatile__
(
"ldstub [%1], %0"
:
"=r"
(
ret
)
:
"r"
(
p
)
:
"memory"
);
return
(
ret
?
1
:
0
);
}
#endif
typedef
int
spinlock_t
;
#define SPIN_LOCK_UNLOCKED 0
static
inline
void
spin_lock
(
spinlock_t
*
lock
)
{
while
(
testandset
(
lock
));
}
static
inline
void
spin_unlock
(
spinlock_t
*
lock
)
{
*
lock
=
0
;
}
static
inline
int
spin_trylock
(
spinlock_t
*
lock
)
{
return
!
testandset
(
lock
);
}
extern
spinlock_t
tb_lock
;
#endif
/* CPU_I386_H */
exec.c
浏览文件 @
eb51d102
...
...
@@ -42,6 +42,8 @@
TranslationBlock
tbs
[
CODE_GEN_MAX_BLOCKS
];
TranslationBlock
*
tb_hash
[
CODE_GEN_HASH_SIZE
];
int
nb_tbs
;
/* any access to the tbs or the page table must use this lock */
spinlock_t
tb_lock
=
SPIN_LOCK_UNLOCKED
;
uint8_t
code_gen_buffer
[
CODE_GEN_BUFFER_SIZE
];
uint8_t
*
code_gen_ptr
;
...
...
@@ -172,6 +174,7 @@ void page_set_flags(unsigned long start, unsigned long end, int flags)
end
=
TARGET_PAGE_ALIGN
(
end
);
if
(
flags
&
PAGE_WRITE
)
flags
|=
PAGE_WRITE_ORG
;
spin_lock
(
&
tb_lock
);
for
(
addr
=
start
;
addr
<
end
;
addr
+=
TARGET_PAGE_SIZE
)
{
p
=
page_find_alloc
(
addr
>>
TARGET_PAGE_BITS
);
/* if the write protection is set, then we invalidate the code
...
...
@@ -183,6 +186,7 @@ void page_set_flags(unsigned long start, unsigned long end, int flags)
}
p
->
flags
=
flags
;
}
spin_unlock
(
&
tb_lock
);
}
void
cpu_x86_tblocks_init
(
void
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录