|
@@ -308,6 +308,31 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
308
|
308
|
( ( unsigned int ) ( table_end ( table ) - \
|
309
|
309
|
table_start ( table ) ) )
|
310
|
310
|
|
|
311
|
+/**
|
|
312
|
+ * Get index of entry within linker table
|
|
313
|
+ *
|
|
314
|
+ * @v table Linker table
|
|
315
|
+ * @v entry Table entry
|
|
316
|
+ *
|
|
317
|
+ * Example usage:
|
|
318
|
+ *
|
|
319
|
+ * @code
|
|
320
|
+ *
|
|
321
|
+ * #define FROBNICATORS __table ( struct frobnicator, "frobnicators" )
|
|
322
|
+ *
|
|
323
|
+ * #define __frobnicator __table_entry ( FROBNICATORS, 01 )
|
|
324
|
+ *
|
|
325
|
+ * struct frobnicator my_frob __frobnicator = {
|
|
326
|
+ * ...
|
|
327
|
+ * };
|
|
328
|
+ *
|
|
329
|
+ * unsigned int my_frob_idx = table_index ( FROBNICATORS, &my_frob );
|
|
330
|
+ *
|
|
331
|
+ * @endcode
|
|
332
|
+ */
|
|
333
|
+#define table_index( table, entry ) \
|
|
334
|
+ ( ( unsigned int ) ( (entry) - table_start ( table ) ) )
|
|
335
|
+
|
311
|
336
|
/**
|
312
|
337
|
* Iterate through all entries within a linker table
|
313
|
338
|
*
|