.globl setGdt gdtr: .word 0 # For limit storage .long 0 # For base storage setGdt: movw 4(%esp), %ax # Move the word at [esp + 4] into AX movw %ax, gdtr # Move AX into gdtr movl 8(%esp), %eax # Move the double word at [esp + 8] into EAX movl %eax, gdtr + 2 # Move EAX into gdtr + 2 lgdt gdtr # Load the GDT ret