浏览代码

Prevent NULL from ever pointing to some real code or data. (This was

causing the serial console to ignore input, because it happened to end up
linked with serial_ischar() at address 0, which core/console.c decided was
invalid).
tags/v0.9.3
Michael Brown 18 年前
父节点
当前提交
43d976edd0
共有 2 个文件被更改,包括 10 次插入0 次删除
  1. 4
    0
      src/arch/i386/scripts/i386-kir.lds
  2. 6
    0
      src/arch/i386/scripts/i386.lds

+ 4
- 0
src/arch/i386/scripts/i386-kir.lds 查看文件

64
     . = _text16_link_addr;
64
     . = _text16_link_addr;
65
     _text16 = .;
65
     _text16 = .;
66
 
66
 
67
+    . += 1;			/* Prevent NULL being valid */
68
+
67
     .text16 : AT ( _text16_load_offset + __text16 ) {
69
     .text16 : AT ( _text16_load_offset + __text16 ) {
68
 	__text16 = .;
70
 	__text16 = .;
69
 	*(.text.null_trap)
71
 	*(.text.null_trap)
80
     . = _data16_link_addr;
82
     . = _data16_link_addr;
81
     _data16 = .;
83
     _data16 = .;
82
 
84
 
85
+    . += 1;			/* Prevent NULL being valid */
86
+
83
     .rodata16 : AT ( _data16_load_offset + __rodata16 ) {
87
     .rodata16 : AT ( _data16_load_offset + __rodata16 ) {
84
 	__rodata16 = .;
88
 	__rodata16 = .;
85
 	*(.rodata16)
89
 	*(.rodata16)

+ 6
- 0
src/arch/i386/scripts/i386.lds 查看文件

65
     . = _text16_link_addr;
65
     . = _text16_link_addr;
66
     _text16 = .;
66
     _text16 = .;
67
 
67
 
68
+    . += 1;			/* Prevent NULL being valid */
69
+
68
     .text16 : AT ( _text16_load_offset + __text16 ) {
70
     .text16 : AT ( _text16_load_offset + __text16 ) {
69
 	__text16 = .;
71
 	__text16 = .;
70
 	*(.text16)
72
 	*(.text16)
78
     . = _data16_link_addr;
80
     . = _data16_link_addr;
79
     _data16 = .;
81
     _data16 = .;
80
 
82
 
83
+    . += 1;			/* Prevent NULL being valid */
84
+
81
     .rodata16 : AT ( _data16_load_offset + __rodata16 ) {
85
     .rodata16 : AT ( _data16_load_offset + __rodata16 ) {
82
 	__rodata16 = .;
86
 	__rodata16 = .;
83
 	*(.rodata16)
87
 	*(.rodata16)
115
 
119
 
116
     _text = .;
120
     _text = .;
117
 
121
 
122
+    . += 1;			/* Prevent NULL being valid */
123
+
118
     .text : AT ( _textdata_load_offset + __text ) {
124
     .text : AT ( _textdata_load_offset + __text ) {
119
 	__text = .;
125
 	__text = .;
120
 	*(.text.null_trap)
126
 	*(.text.null_trap)

正在加载...
取消
保存