Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-11-10 10:21:05 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ac1a4ec0a345e76d4e2aefc6a9ff05ecfdc7b983
ac1a4ec0
1 parent
845c1e93
research st, always alloc on stack.
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
3 行增加
和
24 行删除
trunk/research/st/sched.c
trunk/research/st/stk.c
trunk/research/st/sched.c
查看文件 @
ac1a4ec
...
...
@@ -557,7 +557,7 @@ _st_thread_t *st_thread_create(void *(*start)(void *arg), void *arg, int joinabl
}
stack
->
sp
=
sp
-
_ST_STACK_PAD_SIZE
;
#else
#error Unknown
OS
#error Unknown
Stack Grown
#endif
memset
(
thread
,
0
,
sizeof
(
_st_thread_t
));
...
...
trunk/research/st/stk.c
查看文件 @
ac1a4ec
...
...
@@ -122,28 +122,7 @@ static char *_st_new_stk_segment(int size)
#ifdef MALLOC_STACK
void
*
vaddr
=
malloc
(
size
);
#else
static
int
zero_fd
=
-
1
;
int
mmap_flags
=
MAP_PRIVATE
;
void
*
vaddr
;
#if defined (MD_USE_SYSV_ANON_MMAP)
if
(
zero_fd
<
0
)
{
if
((
zero_fd
=
open
(
"/dev/zero"
,
O_RDWR
,
0
))
<
0
)
{
return
NULL
;
}
fcntl
(
zero_fd
,
F_SETFD
,
FD_CLOEXEC
);
}
#elif defined (MD_USE_BSD_ANON_MMAP)
mmap_flags
|=
MAP_ANON
;
#else
#error Unknown OS
#endif
vaddr
=
mmap
(
NULL
,
size
,
PROT_READ
|
PROT_WRITE
,
mmap_flags
,
zero_fd
,
0
);
if
(
vaddr
==
(
void
*
)
MAP_FAILED
)
{
return
NULL
;
}
#error Unknown Stack Malloc
#endif
return
(
char
*
)
vaddr
;
...
...
@@ -156,7 +135,7 @@ void _st_delete_stk_segment(char *vaddr, int size)
#ifdef MALLOC_STACK
free(vaddr);
#else
(void) munmap(vaddr, size);
#error Unknown Stack Malloc
#endif
}
#endif
...
...
请
注册
或
登录
后发表评论