Quellcode durchsuchen

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 vor 18 Jahren
Ursprung
Commit
43d976edd0
2 geänderte Dateien mit 10 neuen und 0 gelöschten Zeilen
  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 Datei anzeigen

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

+ 6
- 0
src/arch/i386/scripts/i386.lds Datei anzeigen

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

Laden…
Abbrechen
Speichern