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

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

18
  */
18
  */
19
 #include "bios.h"
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
  * putchar : write a single character to each console
25
  * putchar : write a single character to each console

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

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

Loading…
Cancel
Save