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 11:48:31 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
6a8653772998e62c2ea012f1f6f5b4023d6c2446
6a865377
2 parents
922cdc55
2b702126
Merge branch 'srs.master'
显示空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
16 行增加
和
0 行删除
trunk/research/st/stk.c
trunk/research/st/stk.c
查看文件 @
6a86537
...
...
@@ -55,12 +55,28 @@ int _st_randomize_stacks = 0;
static
char
*
_st_new_stk_segment
(
int
size
);
/**
The below comments is by winlin:
The stack memory struct:
| REDZONE | stack | extra | REDZONE |
+---------+------------------------+---------+---------+
| 4k | | 4k/0 | 4k |
+---------+------------------------+---------+---------+
vaddr bottom top
When _st_randomize_stacks is on, by st_randomize_stacks(),
the bottom and top will random movided in the extra:
long offset = (random() % extra) & ~0xf;
ts->stk_bottom += offset;
ts->stk_top += offset;
Both REDZONE are protected by mprotect when DEBUG is on.
*/
_st_stack_t
*
_st_stack_new
(
int
stack_size
)
{
_st_clist_t
*
qp
;
_st_stack_t
*
ts
;
int
extra
;
// TODO: WINLIN: remove the stack reuse.
for
(
qp
=
_st_free_stacks
.
next
;
qp
!=
&
_st_free_stacks
;
qp
=
qp
->
next
)
{
ts
=
_ST_THREAD_STACK_PTR
(
qp
);
if
(
ts
->
stk_size
>=
stack_size
)
{
...
...
请
注册
或
登录
后发表评论