Browse Source

console.c uses the generic table mechanism

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
3e5bf5fb06
3 changed files with 8 additions and 10 deletions
  1. 4
    7
      src/arch/i386/scripts/i386.lds
  2. 2
    2
      src/core/console.c
  3. 2
    1
      src/include/console.h

+ 4
- 7
src/arch/i386/scripts/i386.lds View File

@@ -141,7 +141,10 @@ SECTIONS {
141 141
 	*(.data)
142 142
 	*(.data.*)
143 143
 
144
-	/* Various tables */
144
+	/* Various tables.  See include/tables.h for an explanation. */
145
+	*(SORT(.tbl.*))	
146
+
147
+
145 148
 	device_drivers = .;
146 149
 	*(.drivers.device)
147 150
 	device_drivers_end = .;
@@ -154,15 +157,9 @@ SECTIONS {
154 157
 	type_drivers = .;
155 158
 	*(.drivers.type)
156 159
 	type_drivers_end = .;
157
-	console_drivers = .;
158
-	*(.drivers.console)
159
-	console_drivers_end = .;
160 160
 	post_reloc_fns = .;
161 161
 	*(SORT(.post_reloc_fns.*))
162 162
 	post_reloc_fns_end = .;
163
-	init_fns = .;
164
-	*(SORT(.init_fns.*))
165
-	init_fns_end = .;
166 163
 
167 164
 	_progbits_end = .;
168 165
     }

+ 2
- 2
src/core/console.c View File

@@ -18,8 +18,8 @@
18 18
  */
19 19
 #include "bios.h"
20 20
 
21
-extern struct console_driver console_drivers[];
22
-extern struct console_driver console_drivers_end[];
21
+static struct console_driver console_drivers[0] __table_start ( console );
22
+static struct console_driver console_drivers_end[0] __table_end ( console );
23 23
 
24 24
 /*****************************************************************************
25 25
  * putchar : write a single character to each console

+ 2
- 1
src/include/console.h View File

@@ -3,6 +3,7 @@
3 3
 
4 4
 #include "stdint.h"
5 5
 #include "vsprintf.h"
6
+#include "tables.h"
6 7
 
7 8
 /*
8 9
  * Consoles that cannot be used before their INIT_FN() has completed
@@ -18,7 +19,7 @@ struct console_driver {
18 19
 };
19 20
 
20 21
 #define __console_driver \
21
-	__attribute__ (( used, __section__ ( ".drivers.console" ) ))
22
+	__attribute__ (( used, __table_section ( console, 01 ) ))
22 23
 
23 24
 /* Function prototypes */
24 25
 

Loading…
Cancel
Save