Would this work to get 8 byte alignment

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Gandalf

Would this work to get 8 byte alignment

Post 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;
carbonBased

RE:Would this work to get 8 byte alignment

Post 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
Gandalf

RE:Would this work to get 8 byte alignment

Post by Gandalf »

Thats perfectly right (atleast if we were to believe GCC 3.x official documentation by Richard Stallman !!!)

Thanks a lot

bye
Gandalf
Post Reply