From: Fokkema DOT DBRA AT delorie DOT com, 1043730 Newsgroups: comp.os.msdos.djgpp Subject: struct problem Date: Thu, 21 Oct 1999 09:39:54 GMT Organization: Fac. Wiskunde & Informatica, VU, Amsterdam Lines: 45 Message-ID: <7umn1a$q3o@cs.vu.nl> NNTP-Posting-Host: galjas.cs.vu.nl X-Newsreader: TIN [version 1.2 PL2] X-Poster-Key: sha1:yFdLDUjm4mfCdhxPnI1yGTdcEhs= Cancel-Lock: sha1:velrk1+BLrnf3nTj0FkejoVCavo= To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi there! I've got a nasty (so it seems to me) problem with structs. I have this nice kernel with some descriptors in the gdt describing some tss and in that tss (which is, of course, a struct) I define eip as &isr00 which is a pointer to a function. No problem at all, so I thought that the following code should also work: extern struct tsslayout tssexception00; struct sdescriptor gdt[] = { sizeof(tss) - 1, (long) &tssexception00, 0x21, SDTTSSNB0, GDXU1B32, 0x00, }; So the baselow is a pointer to a struct. By this I hoped to initialize a tss inside the kernel space and let the gdt descriptor point to that. To me, there doesn't seem to be any problem since structs are defined in the .data-section as _tssexception00 followed by a lot of words and dwords. So to get the offset and use that seems not difficult to me. However, I get the following error message: gdt.c:48: initializer element for `gdt[6].baselow' is not computable at load time Well, gdt[6] is my tss descriptor (see above) and baselow obviously is (long) &tssexception00. So the address of my struct is somehow not computable from the respect of gcc. Can someone help me out please? I can't imagine I am the only one trying to define a tss inside the kernel address space and use a pointer to reference it in the gdt. By the way, it doesn't matter if my tss struct is not extern but included in gdt.c. Hmm.. I see that I made some other mistakes, too. Obviously, the pointer to tssexception00 is 32bits and doesn't fit in baselow. So I have to split it. Any help here? In other words, does someone have a sample c program with tss's and stuff? Thanx in advance, David