-# See [IA32-v3] section 3.7.6 for a description of the bits in %eax.
-
- movl $0x11007, %eax
- movl $0x11, %ecx
- subl %edi, %edi
-1: movl %eax, %es:(%di)
- movl %eax, %es:LOADER_PHYS_BASE >> 20(%di)
- addw $4, %di
- addl $0x1000, %eax
+# See [IA32-v3] section 3.7.6 for a description of the bits in eax.
+
+# A bug in some versions of GAS prevents us from using the straightforward
+# mov es:[di + LOADER_PHYS_BASE / 1024 / 1024], eax
+# so we calculate the displacement in bx instead.
+
+ mov eax, 0x11007
+ mov ecx, 0x11
+ sub di, di
+ mov ebx, LOADER_PHYS_BASE
+ shr ebx, 20
+1: mov es:[di], eax
+ mov es:[bx + di], eax
+ add di, 4
+ add eax, 0x1000