Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
7b2dd223
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
1 年多 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7b2dd223
编写于
2月 15, 2011
作者:
R
Rich Felker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
finish unifying thread register handling in preparation for porting
上级
0b2006c8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
53 deletion
+34
-53
Makefile
Makefile
+1
-1
arch/i386/pthread_arch.h
arch/i386/pthread_arch.h
+6
-0
src/internal/pthread_impl.h
src/internal/pthread_impl.h
+2
-8
src/thread/__set_thread_area.c
src/thread/__set_thread_area.c
+0
-9
src/thread/clone.c
src/thread/clone.c
+0
-26
src/thread/i386/__set_thread_area.s
src/thread/i386/__set_thread_area.s
+22
-0
src/thread/pthread_self.c
src/thread/pthread_self.c
+3
-9
未找到文件。
Makefile
浏览文件 @
7b2dd223
...
...
@@ -22,7 +22,7 @@ GENH = include/bits/alltypes.h
CFLAGS
=
-Os
-nostdinc
-ffreestanding
-std
=
c99
-D_XOPEN_SOURCE
=
700
-pipe
LDFLAGS
=
-nostdlib
-shared
-Wl
,-Bsymbolic
INC
=
-I
./include
-I
./src/internal
INC
=
-I
./include
-I
./src/internal
-I
./arch/
$(ARCH)
PIC
=
-fPIC
AR
=
$(CROSS_COMPILE)
ar
RANLIB
=
$(CROSS_COMPILE)
ranlib
...
...
arch/i386/pthread_arch.h
0 → 100644
浏览文件 @
7b2dd223
static
inline
struct
pthread
*
__pthread_self
()
{
struct
pthread
*
self
;
__asm__
(
"movl %%gs:0,%0"
:
"=r"
(
self
)
);
return
self
;
}
src/internal/pthread_impl.h
浏览文件 @
7b2dd223
...
...
@@ -38,19 +38,13 @@ struct pthread {
pthread_attr_t
attr
;
};
static
inline
struct
pthread
*
__pthread_self
()
{
struct
pthread
*
self
;
__asm__
(
"movl %%gs:0,%0"
:
"=r"
(
self
)
);
return
self
;
}
#include "pthread_arch.h"
#define SIGCANCEL 32
#define SIGSYSCALL 33
#define SIGTIMER 32
/* ?? */
int
__set_thread_area
(
unsigned
long
*
);
int
__set_pthread_self
(
void
*
);
int
__set_thread_area
(
void
*
);
int
__libc_sigaction
(
int
,
const
struct
sigaction
*
,
struct
sigaction
*
);
int
__libc_sigprocmask
(
int
,
const
sigset_t
*
,
sigset_t
*
);
void
__lock
(
volatile
int
*
);
...
...
src/thread/__set_thread_area.c
浏览文件 @
7b2dd223
#include "syscall.h"
int
__set_thread_area
(
unsigned
long
*
desc
)
{
if
(
syscall1
(
__NR_set_thread_area
,
(
long
)
desc
)
<
0
)
return
-
1
;
__asm__
__volatile__
(
"movw %w0,%%gs"
:
:
"r"
(
desc
[
0
]
*
8
+
3
)
);
return
0
;
}
src/thread/clone.c
浏览文件 @
7b2dd223
#if 0
int clone(int (*start)(void *), void *stack, int flags, void *arg,
pid_t *ptid, struct user_desc *tls, pid_t *ctid)
{
int ret;
__asm__(
"andl $-16,%%ecx \n\t"
"xchgl %%ebx,%2 \n\t"
"movl %%ebx,(%%ecx) \n\t"
"int $0x80 \n\t"
"testl %%eax,%%eax \n\t"
"jnz 1f \n\t"
"xorl %%ebp,%%ebp \n\t"
"call *%%ebx \n\t"
"\n1: \n\t"
"xchgl %%ebx,%2 \n\t"
: "=a" (ret)
: "a" (__NR_clone), "m" (flags), "c"(stack), "d"(ptid),
"S" (tls), "D" (ctid)
: "memory"
);
return __syscall_ret(ret);
}
#endif
src/thread/i386/__set_thread_area.s
0 → 100644
浏览文件 @
7b2dd223
.
text
.
global
__set_thread_area
.
type
__set_thread_area
,%
function
__set_thread_area
:
pushl
%
ebx
movl
8
(%
esp
),%
ecx
movl
$
-
1
,
4
(%
ecx
)
movl
%
ecx
,
8
(%
ecx
)
movl
$
0xfffff
,
12
(%
ecx
)
movl
$
0x51
,
16
(%
ecx
)
leal
4
(%
ecx
),%
ebx
movl
$
243
,%
eax
int
$
128
popl
%
ebx
testl
%
eax
,%
eax
jnz
1
f
movl
4
(%
ecx
),%
ecx
leal
3
(,%
ecx
,
8
),%
ecx
movw
%
cx
,%
gs
1
:
ret
.
size
__set_thread_area
,.-
__set_thread_area
src/thread/pthread_self.c
浏览文件 @
7b2dd223
...
...
@@ -5,27 +5,21 @@ static struct pthread main_thread;
#undef errno
static
int
*
errno_location
()
{
return
pthread_self
()
->
errno_ptr
;
return
__
pthread_self
()
->
errno_ptr
;
}
static
int
init_main_thread
()
{
main_thread
.
tlsdesc
[
0
]
=
-
1
;
main_thread
.
tlsdesc
[
1
]
=
(
long
)
&
main_thread
;
main_thread
.
tlsdesc
[
2
]
=
SIZE_MAX
/
PAGE_SIZE
;
main_thread
.
tlsdesc
[
3
]
=
0x51
;
main_thread
.
self
=
&
main_thread
;
main_thread
.
errno_ptr
=
__errno_location
();
if
(
__set_thread_area
(
main_thread
.
tlsdesc
)
<
0
)
if
(
__set_thread_area
(
&
main_thread
)
<
0
)
return
-
1
;
syscall1
(
__NR_set_tid_address
,
(
long
)
&
main_thread
.
tid
);
main_thread
.
errno_ptr
=
__errno_location
();
libc
.
errno_location
=
errno_location
;
main_thread
.
tid
=
main_thread
.
pid
=
getpid
();
return
0
;
}
#undef pthread_self
pthread_t
pthread_self
()
{
static
int
init
,
failed
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录