Page 1 of 1

Would this work to get 8 byte alignment

Posted: Fri Nov 28, 2003 12:00 am
by Gandalf
hi

I am using gcc 3.x and want to get an 8 byte alignment for my GDT and IDT.

Will this "C" code work ??


typedef struct
{
  .....
  .....
} GDT;

__asm__(".align 8");

GDT mygdt;

RE:Would this work to get 8 byte alignment

Posted: Fri Nov 28, 2003 12:00 am
by carbonBased
I'm afraid not... at least I don't believe so (someone please correct me if I'm wrong!)

I believe what you're looking for is an __attribute__ option...

typedef struct
{
  .....
  .....
} GDT __attribute__((aligned(8)));

Cheers,
Jeff

RE:Would this work to get 8 byte alignment

Posted: Sun Nov 30, 2003 12:00 am
by Gandalf
Thats perfectly right (atleast if we were to believe GCC 3.x official documentation by Richard Stallman !!!)

Thanks a lot

bye
Gandalf