P***t 发帖数: 165 | 1 产生segmentation fault的具体过程是怎样的?
比如是在OS发现要访问virutal memory address为0就报seg fault,
还是会进行到访问页表获取到physical memory address并访问才会报? |
p**********g 发帖数: 9558 | 2 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 发帖数: 9558 | 3 至于说linux怎么handle这个exception,就是另外一个topic了 |
t****t 发帖数: 6806 | 4 目前几乎所有的32位OS在应用级都是flat memory model, 不怎么用段寄存器的. 所有
的段都是base 0, size=4G.
所以0指针是DS:0, 不是0:0, 跟GDT第一项没关系.
【在 p**********g 的大作中提到】 : 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 发帖数: 9558 | 5 "segmentation fault"是说段错误,说和段映射没有关系似乎说不过去?不过段映射一
般是intel上的。
应用根本看不到内存管理的映射(segment or paging),不过确实有很多不用段映射的
,比如arm,不过没有具体看过linux在arm上的实现以及这个"segmentation fault"
我找找看 |
D*******a 发帖数: 3688 | 6 this is about null segment selector, not null pointer.
segmentation fault is generally caused by accessing non-existant memory or
denied access.
【在 p**********g 的大作中提到】 : 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 发帖数: 9558 | 7 是我搞错了
【在 D*******a 的大作中提到】 : this is about null segment selector, not null pointer. : segmentation fault is generally caused by accessing non-existant memory or : denied access.
|
m*****e 发帖数: 4193 | 8 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 的大作中提到】 : "segmentation fault"是说段错误,说和段映射没有关系似乎说不过去?不过段映射一 : 般是intel上的。 : 应用根本看不到内存管理的映射(segment or paging),不过确实有很多不用段映射的 : ,比如arm,不过没有具体看过linux在arm上的实现以及这个"segmentation fault" : 我找找看
|
z***e 发帖数: 5393 | 9 现在到底还有没有segment的概念啊?我看到OS里面介绍也是说某段区域给user mode,
某段区域给别的什么什么,但是看起来都是在连续空间分配。
一直不明白386/486时期那个segment到底是什么意思。
【在 t****t 的大作中提到】 : 目前几乎所有的32位OS在应用级都是flat memory model, 不怎么用段寄存器的. 所有 : 的段都是base 0, size=4G. : 所以0指针是DS:0, 不是0:0, 跟GDT第一项没关系.
|
T*****9 发帖数: 2484 | 10 vma 为0的时候是page fault
然后系统试图load page,如果load fail, 就会报seg fault
【在 P***t 的大作中提到】 : 产生segmentation fault的具体过程是怎样的? : 比如是在OS发现要访问virutal memory address为0就报seg fault, : 还是会进行到访问页表获取到physical memory address并访问才会报?
|