P*t
2 楼
产生segmentation fault的具体过程是怎样的?
比如是在OS发现要访问virutal memory address为0就报seg fault,
还是会进行到访问页表获取到physical memory address并访问才会报?
比如是在OS发现要访问virutal memory address为0就报seg fault,
还是会进行到访问页表获取到physical memory address并访问才会报?
p*g
4 楼
Linux的gdt表的第一项就是给这个准备的
从书里抄了这么一段
The first entry of the GDT is always set to 0. This ensures the logic
address with a null Segment Selector will be considered invalid, thus
causing a processor exception.
呵呵,要不怎么叫segmentation fault呢
从书里抄了这么一段
The first entry of the GDT is always set to 0. This ensures the logic
address with a null Segment Selector will be considered invalid, thus
causing a processor exception.
呵呵,要不怎么叫segmentation fault呢
p*g
6 楼
至于说linux怎么handle这个exception,就是另外一个topic了
t*t
8 楼
目前几乎所有的32位OS在应用级都是flat memory model, 不怎么用段寄存器的. 所有
的段都是base 0, size=4G.
所以0指针是DS:0, 不是0:0, 跟GDT第一项没关系.
【在 p**********g 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: Linux的gdt表的第一项就是给这个准备的
: 从书里抄了这么一段
: The first entry of the GDT is always set to 0. This ensures the logic
: address with a null Segment Selector will be considered invalid, thus
: causing a processor exception.
: 呵呵,要不怎么叫segmentation fault呢
的段都是base 0, size=4G.
所以0指针是DS:0, 不是0:0, 跟GDT第一项没关系.
【在 p**********g 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: Linux的gdt表的第一项就是给这个准备的
: 从书里抄了这么一段
: The first entry of the GDT is always set to 0. This ensures the logic
: address with a null Segment Selector will be considered invalid, thus
: causing a processor exception.
: 呵呵,要不怎么叫segmentation fault呢
p*g
10 楼
"segmentation fault"是说段错误,说和段映射没有关系似乎说不过去?不过段映射一
般是intel上的。
应用根本看不到内存管理的映射(segment or paging),不过确实有很多不用段映射的
,比如arm,不过没有具体看过linux在arm上的实现以及这个"segmentation fault"
我找找看
般是intel上的。
应用根本看不到内存管理的映射(segment or paging),不过确实有很多不用段映射的
,比如arm,不过没有具体看过linux在arm上的实现以及这个"segmentation fault"
我找找看
D*a
12 楼
this is about null segment selector, not null pointer.
segmentation fault is generally caused by accessing non-existant memory or
denied access.
【在 p**********g 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: Linux的gdt表的第一项就是给这个准备的
: 从书里抄了这么一段
: The first entry of the GDT is always set to 0. This ensures the logic
: address with a null Segment Selector will be considered invalid, thus
: causing a processor exception.
: 呵呵,要不怎么叫segmentation fault呢
segmentation fault is generally caused by accessing non-existant memory or
denied access.
【在 p**********g 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: Linux的gdt表的第一项就是给这个准备的
: 从书里抄了这么一段
: The first entry of the GDT is always set to 0. This ensures the logic
: address with a null Segment Selector will be considered invalid, thus
: causing a processor exception.
: 呵呵,要不怎么叫segmentation fault呢
m*e
14 楼
If you really want to know how Linux virtual memory management works, dive
into copy-on-write.
Last time I looked into it, I found a bug. :-)
【在 p**********g 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: "segmentation fault"是说段错误,说和段映射没有关系似乎说不过去?不过段映射一
: 般是intel上的。
: 应用根本看不到内存管理的映射(segment or paging),不过确实有很多不用段映射的
: ,比如arm,不过没有具体看过linux在arm上的实现以及这个"segmentation fault"
: 我找找看
into copy-on-write.
Last time I looked into it, I found a bug. :-)
【在 p**********g 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: "segmentation fault"是说段错误,说和段映射没有关系似乎说不过去?不过段映射一
: 般是intel上的。
: 应用根本看不到内存管理的映射(segment or paging),不过确实有很多不用段映射的
: ,比如arm,不过没有具体看过linux在arm上的实现以及这个"segmentation fault"
: 我找找看
相关阅读
Secrets of the JavaScript Ninja全球最受欢迎的网站和编程语言有1 分钱关系?<%@ 这么读对吗? Angle bracket percent atjava programmer们不用太悲哀做Big data的前景如何?google,facebook用的什么语言?why Oracle failed to stop Google from using JavaJava大牛推荐一本讲JVM工作原理的入门书吧?java/C++之争就是木匠和瓦匠之争phonegap开发跨平台的手机,咋样?Will phone interview a lao-uh-san and a chinese folk next w (转载)关于王先生的讨论是否可以适可而止在图像算法领域,纯java没戏,用java和c++混合编程很恶心我看大家吵来吵去,最后的结论是?转行CS的Master没有OPT,有可能找到办H1B的CS工作吗? (转载)C++能不能加入一些Matlab的能力呢?全是蜥蜴的错,我提议,蜥蜴应该发包子给大家大牛们讨论一下异步编程吧说几个backend从C++导向Java的知名公司吧师傅们给普及一下jvm