Why does this fail, once Masm reaches jmp?
struct gdt_entry
{
unsigned short limit_low;
unsigned short base_low;
unsigned char base_middle;
u
Try to put the following pragma before and after the structure definitions:
#pragma pack(push,1)
struct gdt_entry
{
unsigned short limit_low;
unsigned short base_low;
unsigned char base_middle;
unsigned char access;
unsigned char granularity;
unsigned char base_high;
};
struct gdt_ptr
{
unsigned short limit;
unsigned int base;
};
#pragma pack(pop)
Although it has no effect on gdt_entry
, these instructions change the memory layout of the gdt_ptr
structure. The default behavior of the compiler is to align structures elements on 32 bits. Hence, the previous definition would be equivalent to :
struct gdt_ptr
{
unsigned short limit;
unsigned short unused;
unsigned int base;
};
which is invalid from the processor point of view.