Talk:Inline Assembly/Examples
Jump to navigation
Jump to search
Rolled back edit by imate900 that added the following lgdt function, which is wrong for many reasons. I just did not have time to fix the example yet.
void *lgdt(void *gdt, int entries) { struct { unsigned short *length, void *base } gdtr_t; gdtr_t *gdtr; gdtr.length = entries; gdtr.base = gdt; asm("lgdt (%0)": : "p" (&gdtr)); asm("mov %ax, 0x10"); asm("mov %ds, %ax"); asm("mov %es, %ax"); asm("mov %fs, %ax"); asm("mov %gs, %ax"); asm("mov %ss, %ax"); goto fix_cs; fix_cs: return; }