On Tue, 26 Nov 2002, Adam Sulmicki wrote:
well it always could be intermediate solution. In this way we only have 4 data structures and no functions.
sounds like we need a union, with a tag, and then the descriptors. In the limit, the tag can be TAG_CODE, meaning you have to call the attached data blob:
enum {TAG_CODE, TAG_PCI_CONFIG, TAG_ISA, TAG_CPU} ;
typedef struct { unsigned short vendor, device; u8 function, register; u8 and, or; } pci_config_data;
typedef struct { u16 iobase; u8 and, or; } isa;
typedef struct { unsigned long msr; unsigned long long and, or; } cpu;
// has to be PIC. typedef struct { unsigned long len; char code; } code;
typedef struct { u8 tag; union { pci_config_data pci; isa isa; cpu cpu; code code; } data; };
Would this do it?
ron