[lkml]   [2010]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 01/10] x86/iommu: Add IOMMU_INIT macros, .iommu_table section, and iommu_table_entry structure.
On 08/26/2010 11:19 AM, Sam Ravnborg wrote:
> So we have yet another magic section in
> A nice comemnt that expalins what this is used for and why
> it is discardable etc. would be nice.
> Lots of magic sections in same file miss this,
> but thats not an example to follwow.

Honestly, I think we this kind of problem -- a mergeable table -- often
enough that we should implement a generic facility for it. It obviously
has to be based on sections, but I think we could automate its creation.
The gPXE people have done that, and this is more or less a summary of
their technique.

Basically, you have a set of sections with names like:


... then the linker script looks something like:

.table : {

use SORT_BY_NAME() in the linker script. To get the start and end
symbols, we define them as solo symbols inside sections designed to sort
first and last (written by hand into email, so adjustments may be
needed, void where prohibited):

#define TABLE(name, priority) \
__section(".table." ## name ## "." ## priority)

#define DECLARE_TABLE(type, name) \
extern type __table ## name ## _start[0]; \
extern type __table ## name ## _end[0];

#define DEFINE_TABLE(type, name) \
type __table ## name ## _start[0] TABLE(name, 0); \
type __table ## name ## _end[0] TABLE(name, 9);

Here "priority" is a digit from 1 (first) to 8 (last); 0 and 9 are used
for the capstones.

Presumably we need a few different flavors for init tables and so on,
but this would make it a generic mechanism.


 \ /
  Last update: 2010-08-26 21:51    [W:0.116 / U:5.172 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site