compile that .o with both compilers, and use objdump -D to disassemble and compare. That might help see what's going on. ron
Here is the side-by-side diff
obj/vgabios.o: file format elf32-i386 | /build/xfer/vgabios.o: file format elf32-i386
Disassembly of section .text: Disassembly of section .text:
00000000 <real_mode_switch_call_vga>: 00000000 <real_mode_switch_call_vga>: 0: 55 push %ebp 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 1: 89 e5 mov %esp,%ebp 3: 89 25 0b 00 00 00 mov %esp,0xb 3: 89 25 0b 00 00 00 mov %esp,0xb 5: R_386_32 .text 5: R_386_32 .text 9: eb 04 jmp f <__stack+0x4> 9: eb 04 jmp f <__stack+0x4>
0000000b <__stack>: 0000000b <__stack>: b: 00 00 add %al,(%eax) b: 00 00 add %al,(%eax) d: 00 00 add %al,(%eax) d: 00 00 add %al,(%eax) f: ea 16 00 00 00 28 00 ljmp $0x28,$0x16 f: ea 16 00 00 00 28 00 ljmp $0x28,$0x16 10: R_386_32 .text 10: R_386_32 .text
00000016 <__rms_16bit>: 00000016 <__rms_16bit>: 16: b8 30 00 8e d8 mov $0xd88e0030,%eax 16: b8 30 00 8e d8 mov $0xd88e0030,%eax 1b: 8e c0 mov %eax,%es 1b: 8e c0 mov %eax,%es 1d: 8e e0 mov %eax,%fs 1d: 8e e0 mov %eax,%fs 1f: 8e e8 mov %eax,%gs 1f: 8e e8 mov %eax,%gs 21: 8e d0 mov %eax,%ss 21: 8e d0 mov %eax,%ss 23: 0f 20 c0 mov %cr0,%eax 23: 0f 20 c0 mov %cr0,%eax 26: 66 83 e0 fe and $0xfffffffe,%ax 26: 66 83 e0 fe and $0xfffffffe,%ax 2a: 0f 22 c0 mov %eax,%cr0 2a: 0f 22 c0 mov %eax,%cr0 2d: ea 32 00 00 00 b8 00 ljmp $0xb8,$0x32 2d: ea 32 00 00 00 b8 00 ljmp $0xb8,$0x32 2e: R_386_16 .text 2e: R_386_16 .text
00000032 <__rms_real>: 00000032 <__rms_real>: 32: b8 00 00 8e d0 mov $0xd08e0000,%eax 32: b8 00 00 8e d0 mov $0xd08e0000,%eax 37: 66 b8 00 10 mov $0x1000,%ax 37: 66 b8 00 10 mov $0x1000,%ax 3b: 00 00 add %al,(%eax) 3b: 00 00 add %al,(%eax) 3d: 66 89 c4 mov %ax,%sp 3d: 66 89 c4 mov %ax,%sp 40: b0 11 mov $0x11,%al 40: b0 11 mov $0x11,%al 42: e6 80 out %al,$0x80 42: e6 80 out %al,$0x80 44: 31 c0 xor %eax,%eax 44: 31 c0 xor %eax,%eax 46: 8e d8 mov %eax,%ds 46: 8e d8 mov %eax,%ds 48: 8e c0 mov %eax,%es 48: 8e c0 mov %eax,%es 4a: 8e e0 mov %eax,%fs 4a: 8e e0 mov %eax,%fs 4c: 8e e8 mov %eax,%gs 4c: 8e e8 mov %eax,%gs 4e: 9a 03 00 00 c0 b0 55 lcall $0x55b0,$0xc0000003 4e: 9a 03 00 00 c0 b0 55 lcall $0x55b0,$0xc0000003 55: e6 80 out %al,$0x80 55: e6 80 out %al,$0x80 57: 0f 20 c0 mov %cr0,%eax 57: 0f 20 c0 mov %cr0,%eax 5a: 66 83 c8 01 or $0x1,%ax 5a: 66 83 c8 01 or $0x1,%ax 5e: 0f 22 c0 mov %eax,%cr0 5e: 0f 22 c0 mov %eax,%cr0 61: 66 ea 69 00 00 00 ljmpw $0x0,$0x69 61: 66 ea 69 00 00 00 ljmpw $0x0,$0x69 63: R_386_32 .text 63: R_386_32 .text 67: 10 00 adc %al,(%eax) 67: 10 00 adc %al,(%eax)
00000069 <vgarestart>: 00000069 <vgarestart>: 69: 66 b8 18 00 mov $0x18,%ax 69: 66 b8 18 00 mov $0x18,%ax 6d: 8e d8 mov %eax,%ds 6d: 8e d8 mov %eax,%ds 6f: 8e c0 mov %eax,%es 6f: 8e c0 mov %eax,%es 71: 8e e0 mov %eax,%fs 71: 8e e0 mov %eax,%fs 73: 8e e8 mov %eax,%gs 73: 8e e8 mov %eax,%gs 75: 8e d0 mov %eax,%ss 75: 8e d0 mov %eax,%ss 77: 8b 25 0b 00 00 00 mov 0xb,%esp 77: 8b 25 0b 00 00 00 mov 0xb,%esp 79: R_386_32 .text 79: R_386_32 .text 7d: 5d pop %ebp 7d: 5d pop %ebp 7e: c3 ret 7e: c3 ret
0000007f <unsupportint_recover>: | 0000007f <real_mode_switch_end>: 7f: 55 push %ebp | 7f: 90 nop 80: 89 e5 mov %esp,%ebp | 82: eb e5 jmp 69 <vgarestart> | 00000080 <unsupportint_recover>: 84: 5d pop %ebp | 80: 55 push %ebp 85: c3 ret | 81: 89 e5 mov %esp,%ebp | 83: eb e4 jmp 69 <vgarestart> 00000086 <do_vgabios>: | 85: 5d pop %ebp 86: 55 push %ebp | 86: c3 ret 87: 89 e5 mov %esp,%ebp | 87: 90 nop 89: 53 push %ebx | 8a: 6a 00 push $0x0 | 00000088 <do_vgabios>: 8c: 68 00 00 03 00 push $0x30000 | 88: 55 push %ebp 91: e8 fc ff ff ff call 92 <do_vgabios+0xc> | 89: 89 e5 mov %esp,%ebp 92: R_386_PC32 pci_find_class | 8b: 56 push %esi 96: 89 c2 mov %eax,%edx | 8c: 53 push %ebx 98: 85 d2 test %edx,%edx | 8d: 53 push %ebx 9a: 58 pop %eax | 8e: 53 push %ebx 9b: 59 pop %ecx | 8f: 6a 00 push $0x0 9c: 0f 84 91 00 00 00 je 133 <do_vgabios+0xad> | 91: 68 00 00 03 00 push $0x30000 a2: 0f b7 42 1e movzwl 0x1e(%edx),%eax | 96: e8 fc ff ff ff call 97 <do_vgabios+0xf> a6: 50 push %eax | 97: R_386_PC32 pci_find_class a7: 0f b7 42 1c movzwl 0x1c(%edx),%eax | 9b: 89 c2 mov %eax,%edx ab: 50 push %eax | 9d: 83 c4 10 add $0x10,%esp ac: 68 00 00 00 00 push $0x0 | a0: 85 d2 test %edx,%edx ad: R_386_32 .rodata.str1.1 | a2: 75 14 jne b8 <do_vgabios+0x30> b1: 6a 07 push $0x7 | a4: 51 push %ecx b3: e8 fc ff ff ff call b4 <do_vgabios+0x2e> | a5: 51 push %ecx b4: R_386_PC32 do_printk | a6: 68 00 00 00 00 push $0x0 b8: 83 c4 10 add $0x10,%esp | a7: R_386_32 .rodata bb: 80 3d 00 00 fe ff 55 cmpb $0x55,0xfffe0000 | ab: 6a 07 push $0x7 c2: 74 24 je e8 <do_vgabios+0x62> | ad: e8 fc ff ff ff call ae <do_vgabios+0x26> c4: 0f b6 05 01 00 fe ff movzbl 0xfffe0001,%eax | ae: R_386_PC32 do_printk cb: 50 push %eax | b2: e9 90 00 00 00 jmp 147 <do_vgabios+0xbf> cc: 0f b6 05 00 00 fe ff movzbl 0xfffe0000,%eax | b7: 90 nop d3: 50 push %eax | b8: 0f b7 42 1e movzwl 0x1e(%edx),%eax d4: 68 1b 00 00 00 push $0x1b | bc: 50 push %eax d5: R_386_32 .rodata.str1.1 | bd: 0f b7 42 1c movzwl 0x1c(%edx),%eax d9: 6a 07 push $0x7 | c1: 50 push %eax db: e8 fc ff ff ff call dc <do_vgabios+0x56> | c2: 68 0e 00 00 00 push $0xe dc: R_386_PC32 do_printk | c3: R_386_32 .rodata e0: 83 c4 10 add $0x10,%esp | c7: 6a 07 push $0x7 e3: 8b 5d fc mov 0xfffffffc(%ebp),%ebx | c9: e8 fc ff ff ff call ca <do_vgabios+0x42> e6: c9 leave | ca: R_386_PC32 do_printk e7: c3 ret | ce: 83 c4 10 add $0x10,%esp e8: c6 05 01 00 fe ff aa movb $0xaa,0xfffe0001 | d1: 80 3d 00 00 fe ff 55 cmpb $0x55,0xfffe0000 ef: 68 00 00 01 00 push $0x10000 | d8: be 00 00 fe ff mov $0xfffe0000,%esi f4: 68 00 00 fe ff push $0xfffe0000 | dd: 75 49 jne 128 <do_vgabios+0xa0> f9: 68 00 00 0c 00 push $0xc0000 | df: c6 05 01 00 fe ff aa movb $0xaa,0xfffe0001 fe: e8 fc ff ff ff call ff <do_vgabios+0x79> | e6: 52 push %edx ff: R_386_PC32 memcpy | e7: 68 00 00 01 00 push $0x10000 103: 31 db xor %ebx,%ebx | ec: 56 push %esi 105: e8 fc ff ff ff call 106 <do_vgabios+0x80> | ed: 68 00 00 0c 00 push $0xc0000 106: R_386_PC32 write_protect_vgabios | f2: e8 fc ff ff ff call f3 <do_vgabios+0x6b> 10a: 83 c4 0c add $0xc,%esp | f3: R_386_PC32 memcpy 10d: 0f b6 83 00 00 fe ff movzbl 0xfffe0000(%ebx),%eax | f7: e8 fc ff ff ff call f8 <do_vgabios+0x70> 114: 50 push %eax | f8: R_386_PC32 write_protect_vgabios 115: 68 34 00 00 00 push $0x34 | fc: 31 db xor %ebx,%ebx 116: R_386_32 .rodata.str1.1 | fe: 83 c4 10 add $0x10,%esp 11a: 6a 07 push $0x7 | 101: 8d 76 00 lea 0x0(%esi),%esi 11c: 43 inc %ebx | 104: 50 push %eax 11d: e8 fc ff ff ff call 11e <do_vgabios+0x98> | 105: 0f b6 04 33 movzbl (%ebx,%esi,1),%eax 11e: R_386_PC32 do_printk | 109: 50 push %eax 122: 83 c4 0c add $0xc,%esp | 10a: 68 29 00 00 00 push $0x29 125: 83 fb 0f cmp $0xf,%ebx | 10b: R_386_32 .rodata 128: 7e e3 jle 10d <do_vgabios+0x87> | 10f: 6a 07 push $0x7 12a: 8b 5d fc mov 0xfffffffc(%ebp),%ebx | 111: 43 inc %ebx 12d: c9 leave | 112: e8 fc ff ff ff call 113 <do_vgabios+0x8b> 12e: e9 cd fe ff ff jmp 0 <real_mode_switch_ca | 113: R_386_PC32 do_printk 133: 68 3a 00 00 00 push $0x3a | 117: 83 c4 10 add $0x10,%esp 134: R_386_32 .rodata.str1.1 | 11a: 83 fb 0f cmp $0xf,%ebx 138: 6a 07 push $0x7 | 11d: 7e e5 jle 104 <do_vgabios+0x7c> 13a: e8 fc ff ff ff call 13b <do_vgabios+0xb5> | 11f: e8 dc fe ff ff call 0 <real_mode_switch_ca 13b: R_386_PC32 do_printk | 124: eb 21 jmp 147 <do_vgabios+0xbf> 13f: eb a2 jmp e3 <do_vgabios+0x5d> | 126: 89 f6 mov %esi,%esi > 128: 0f b6 05 01 00 fe ff movzbl 0xfffe0001,%eax > 12f: 50 push %eax > 130: 0f b6 05 00 00 fe ff movzbl 0xfffe0000,%eax > 137: 50 push %eax > 138: 68 2f 00 00 00 push $0x2f > 139: R_386_32 .rodata > 13d: 6a 07 push $0x7 > 13f: e8 fc ff ff ff call 140 <do_vgabios+0xb8> > 140: R_386_PC32 do_printk > 144: 83 c4 10 add $0x10,%esp > 147: 8d 65 f8 lea 0xfffffff8(%ebp),%esp > 14a: 5b pop %ebx > 14b: 5e pop %esi > 14c: 5d pop %ebp > 14d: c3 ret Disassembly of section .data: Disassembly of section .data:
00000000 <rcsid>: 00000000 <rcsid>: 0: 24 49 and $0x49,%al 0: 24 49 and $0x49,%al 2: 64 3a 20 cmp %fs:(%eax),%ah 2: 64 3a 20 cmp %fs:(%eax),%ah 5: 76 67 jbe 6e <vgarestart+0x5> 5: 76 67 jbe 6e <vgarestart+0x5> 7: 61 popa 7: 61 popa 8: 62 69 6f bound %ebp,0x6f(%ecx) 8: 62 69 6f bound %ebp,0x6f(%ecx) b: 73 2e jae 3b <__rms_real+0x9> b: 73 2e jae 3b <__rms_real+0x9> d: 63 2c 76 arpl %bp,(%esi,%esi,2) d: 63 2c 76 arpl %bp,(%esi,%esi,2) 10: 20 31 and %dh,(%ecx) 10: 20 31 and %dh,(%ecx) 12: 2e 31 30 xor %esi,%cs:(%eax) 12: 2e 31 30 xor %esi,%cs:(%eax) 15: 20 32 and %dh,(%edx) 15: 20 32 and %dh,(%edx) 17: 30 30 xor %dh,(%eax) 17: 30 30 xor %dh,(%eax) 19: 33 2f xor (%edi),%ebp 19: 33 2f xor (%edi),%ebp 1b: 30 37 xor %dh,(%edi) 1b: 30 37 xor %dh,(%edi) 1d: 2f das 1d: 2f das 1e: 32 32 xor (%edx),%dh 1e: 32 32 xor (%edx),%dh 20: 20 32 and %dh,(%edx) 20: 20 32 and %dh,(%edx) 22: 32 3a xor (%edx),%bh 22: 32 3a xor (%edx),%bh 24: 31 33 xor %esi,(%ebx) 24: 31 33 xor %esi,(%ebx) 26: 3a 30 cmp (%eax),%dh 26: 3a 30 cmp (%eax),%dh 28: 35 20 64 61 73 xor $0x73616420,%eax 28: 35 20 64 61 73 xor $0x73616420,%eax 2d: 68 20 45 78 70 push $0x70784520 2d: 68 20 45 78 70 push $0x70784520 32: 20 24 00 and %ah,(%eax,%eax,1) 32: 20 24 00 and %ah,(%eax,%eax,1) Disassembly of section .rodata.str1.1: | Disassembly of section .note:
00000000 <.rodata.str1.1>: | 00000000 <.note>: 0: 66 6f outsw %ds:(%esi),(%dx) | 0: 08 00 or %al,(%eax) 2: 75 6e jne 72 <vgarestart+0x9> | 2: 00 00 add %al,(%eax) 4: 64 20 56 47 and %dl,%fs:0x47(%esi) | 4: 00 00 add %al,(%eax) 8: 41 inc %ecx | 6: 00 00 add %al,(%eax) 9: 3a 20 cmp (%eax),%ah | 8: 01 00 add %eax,(%eax) b: 76 69 jbe 76 <vgarestart+0xd> | a: 00 00 add %al,(%eax) d: 64 fs | c: 30 31 xor %dh,(%ecx) e: 3d 25 78 2c 20 cmp $0x202c7825,%eax | e: 2e 30 31 xor %dh,%cs:(%ecx) 13: 64 69 64 3d 25 78 0a imul $0x42000a78,%fs:0x25(% | 11: 00 00 add %al,(%eax) 1a: 00 42 | ... 1c: 41 inc %ecx | Disassembly of section .rodata: 1d: 44 inc %esp | 1e: 20 53 49 and %dl,0x49(%ebx) | 00000000 <.rodata>: 21: 47 inc %edi | 0: 4e dec %esi 22: 4e dec %esi | 1: 4f dec %edi 23: 41 inc %ecx | 2: 20 56 47 and %dl,0x47(%esi) 24: 54 push %esp | 5: 41 inc %ecx 25: 55 push %ebp | 6: 20 46 4f and %al,0x4f(%esi) 26: 52 push %edx | 9: 55 push %ebp 27: 45 inc %ebp | a: 4e dec %esi 28: 20 30 and %dh,(%eax) | b: 44 inc %esp > c: 0a 00 or (%eax),%al > e: 66 6f outsw %ds:(%esi),(%dx) > 10: 75 6e jne 80 <unsupportint_recov > 12: 64 20 56 47 and %dl,%fs:0x47(%esi) > 16: 41 inc %ecx > 17: 3a 20 cmp (%eax),%ah > 19: 76 69 jbe 84 <unsupportint_recov > 1b: 64 fs > 1c: 3d 25 78 2c 20 cmp $0x202c7825,%eax > 21: 64 69 64 3d 25 78 0a imul $0x30000a78,%fs:0x25(% > 28: 00 30 2a: 78 25 js 51 <__rms_real+0x1f> 2a: 78 25 js 51 <__rms_real+0x1f> 2c: 78 20 js 4e <__rms_real+0x1c> 2c: 78 20 js 4e <__rms_real+0x1c> 2e: 30 78 25 xor %bh,0x25(%eax) | 2e: 00 42 41 add %al,0x41(%edx) 31: 78 0a js 3d <.rodata.str1.1+0x3 | 31: 44 inc %esp 33: 00 30 add %dh,(%eax) | 32: 20 53 49 and %dl,0x49(%ebx) 35: 78 25 js 5c <__rms_real+0x2a> | 35: 47 inc %edi 37: 78 20 js 59 <__rms_real+0x27> | 36: 4e dec %esi 39: 00 4e 4f add %cl,0x4f(%esi) | 37: 41 inc %ecx 3c: 20 56 47 and %dl,0x47(%esi) | 38: 54 push %esp 3f: 41 inc %ecx | 39: 55 push %ebp 40: 20 46 4f and %al,0x4f(%esi) | 3a: 52 push %edx 43: 55 push %ebp | 3b: 45 inc %ebp 44: 4e dec %esi | 3c: 20 30 and %dh,(%eax) 45: 44 inc %esp | 3e: 78 25 js 65 <__rms_real+0x33> 46: 0a 00 or (%eax),%al | 40: 78 20 js 62 <__rms_real+0x30> > 42: 30 78 25 xor %bh,0x25(%eax) > 45: 78 0a js 51 <__rms_real+0x1f> > ... Disassembly of section .comment: Disassembly of section .comment:
00000000 <.comment>: 00000000 <.comment>: 0: 00 47 43 add %al,0x43(%edi) 0: 00 47 43 add %al,0x43(%edi) 3: 43 inc %ebx 3: 43 inc %ebx 4: 3a 20 cmp (%eax),%ah 4: 3a 20 cmp (%eax),%ah 6: 28 47 4e sub %al,0x4e(%edi) 6: 28 47 4e sub %al,0x4e(%edi) 9: 55 push %ebp 9: 55 push %ebp a: 29 20 sub %esp,(%eax) a: 29 20 sub %esp,(%eax) c: 33 2e xor (%esi),%ebp | c: 32 2e xor (%esi),%ch e: 32 2e xor (%esi),%ch | e: 39 36 cmp %esi,(%esi) 10: 33 00 xor (%eax),%eax | 10: 20 32 and %dh,(%edx) > 12: 30 30 xor %dh,(%eax) > 14: 30 30 xor %dh,(%eax) > 16: 37 aaa > 17: 33 31 xor (%ecx),%esi > 19: 20 28 and %ch,(%eax) > 1b: 52 push %edx > 1c: 65 64 20 48 61 and %cl,%fs:%gs:0x61(%eax) > 21: 74 20 je 43 <__rms_real+0x11> > 23: 4c dec %esp > 24: 69 6e 75 78 20 37 2e imul $0x2e372078,0x75(%esi) > 2b: 32 20 xor (%eax),%ah > 2d: 32 2e xor (%esi),%ch > 2f: 39 36 cmp %esi,(%esi) > 31: 2d 31 31 32 2e sub $0x2e323131,%eax > 36: 37 aaa > 37: 2e 31 29 xor %ebp,%cs:(%ecx) > ...
The left side is the failure side, the right side is the working side.
Right side has nops in between functions, don't know if that matters.
-Dave