diff --git a/reactos/boot/freeldr/freeldr/arch/i386/arch.S b/reactos/boot/freeldr/freeldr/arch/i386/arch.S index 9b93f899d0e..200c56e50d9 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/arch.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/arch.S @@ -84,7 +84,7 @@ EXTERN(switch_to_prot) /* Of course CS has to already be valid. */ /* We are currently in real-mode so we */ /* need real-mode segment values. */ - movw $0x0000,%ax + xorw %ax,%ax movw %ax,%ds movw %ax,%es movw %ax,%fs diff --git a/reactos/boot/freeldr/freeldr/arch/i386/int386.S b/reactos/boot/freeldr/freeldr/arch/i386/int386.S index b8504f19266..7069a13aaf3 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/int386.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/int386.S @@ -74,7 +74,12 @@ EXTERN(_Int386) movl 0x0c(%esp),%eax movl %eax,Int386_regsout + /* Save all registers + segment registers */ pushal + pushw %ds + pushw %es + pushw %fs + pushw %gs /* Copy the input regs to our variables */ movl $Int386_REGS,%edi @@ -147,6 +152,11 @@ Int386_vector_opcode: rep movsb + /* Restore segment and all other registers */ + popw %gs + popw %fs + popw %es + popw %ds popal /* Get return value */