linux-0.11,任务1的用户态堆栈,copy-on-write之后的堆栈!
2013-01-25 07:34
260 查看
下面是copy-on-write之后和之前的内存页,copy-on-write之前0x401ee50位于user_stack[]数组内。user_stack地址:0x1de6c。0x1ee5c处的地址0x5412既head.s中L6的地址:$L6。
copy-on-write之后位于0xffd000-0xffe000对应的内存页中。
下面是copy-on-write之前和之后页表项的变化:
看来Linus Torvalds的main.c中注释是不正确的。
/*
* linux/init/main.c
*
* (C) 1991 Linus Torvalds
*/
#define __LIBRARY__
#include <unistd.h>
#include <time.h>
/*
* we need this inline - forking from kernel space will result
* in NO COPY ON WRITE (!!!), until an execve is executed. This
* is no problem, but for the stack. This is handled by not letting
* main() use the stack at all after fork(). Thus, no function
* calls - which means inline code for fork too, as otherwise we
* would use the stack upon exit from 'fork()'.
*
* Actually only pause and fork are needed inline, so that there
* won't be any messing with the stack from main(), but we define
* some others too.
*/
copy-on-write之后位于0xffd000-0xffe000对应的内存页中。
下面是copy-on-write之前和之后页表项的变化:
看来Linus Torvalds的main.c中注释是不正确的。
/*
* linux/init/main.c
*
* (C) 1991 Linus Torvalds
*/
#define __LIBRARY__
#include <unistd.h>
#include <time.h>
/*
* we need this inline - forking from kernel space will result
* in NO COPY ON WRITE (!!!), until an execve is executed. This
* is no problem, but for the stack. This is handled by not letting
* main() use the stack at all after fork(). Thus, no function
* calls - which means inline code for fork too, as otherwise we
* would use the stack upon exit from 'fork()'.
*
* Actually only pause and fork are needed inline, so that there
* won't be any messing with the stack from main(), but we define
* some others too.
*/
相关文章推荐
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- 【转】Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)及fork、vfork流程介绍
- Linux写时拷贝技术(copy-on-write)
- Linux写时复制技术(copy-on-write)
- linux 的任务堆栈,以及用户态和内核态的切换
- linux-0.11内核中任务的堆栈切换
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)
- Linux写时拷贝技术(copy-on-write)