I686-elf-gcc «Ошибка: неверный суффикс инструкции для 'push'/'pop'» [закрыто]Linux

Ответить
Anonymous
 I686-elf-gcc «Ошибка: неверный суффикс инструкции для 'push'/'pop'» [закрыто]

Сообщение Anonymous »

Я следую руководству по базовой версии OSDev Wiki и пытаюсь скомпилировать файл kernel.c с помощью
i686-elf-gcc -ffreestanding -O2 -m32 -c kernel.c -o kernel.o

но я постоянно получаю следующие сообщения ассемблера:
/tmp/ccdPCN1Y.s: Assembler messages:
/tmp/ccdPCN1Y.s:7: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:21: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:56: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:59: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:67: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:79: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:88: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:91: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:92: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:104: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:105: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:107: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:117: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:118: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:119: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:127: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:129: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:130: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:131: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:175: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:176: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:177: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:178: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:185: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:187: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:188: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:189: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:240: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:241: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:242: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:243: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:254: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:256: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:257: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:258: Error: invalid instruction suffix for `push'
/tmp/ccdPCN1Y.s:320: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:321: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:322: Error: invalid instruction suffix for `pop'
/tmp/ccdPCN1Y.s:323: Error: invalid instruction suffix for `pop'

Я в замешательстве, потому что точно знаю, что я 1. правильно построил свой компилятор и 2. правильно написал свой код.
Пожалуйста, помогите мне!
РЕДАКТИРОВАТЬ: вывод i686-elf-gcc -ffreestanding -O2 -m32 -S kernel.c -o kernel.s
is:
.file "kernel.c"
.text
.p2align 4
.globl strlen
.type strlen, @function
strlen:
pushl %ebp
xorl %eax, %eax
movl %esp, %ebp
movl 8(%ebp), %edx
cmpb $0, (%edx)
je .L1
.p2align 4
.p2align 4
.p2align 3
.L3:
addl $1, %eax
cmpb $0, (%edx,%eax)
jne .L3
.L1:
popl %ebp
ret
.size strlen, .-strlen
.p2align 4
.globl terminal_initialize
.type terminal_initialize, @function
terminal_initialize:
movl terminal_buffer, %ecx
movb $7, terminal_color
movl $0, terminal_row
movl $0, terminal_column
leal 160(%ecx), %edx
addl $4160, %ecx
.p2align 4
.p2align 3
.L9:
leal -160(%edx), %eax
.p2align 5
.p2align 4
.p2align 3
.L10:
movw $1824, (%eax)
addl $4, %eax
movw $1824, -2(%eax)
cmpl %edx, %eax
jne .L10
leal 160(%eax), %edx
cmpl %ecx, %edx
jne .L9
ret
.size terminal_initialize, .-terminal_initialize
.p2align 4
.globl terminal_setcolor
.type terminal_setcolor, @function
terminal_setcolor:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
popl %ebp
movb %al, terminal_color
ret
.size terminal_setcolor, .-terminal_setcolor
.p2align 4
.globl terminal_putentryat
.type terminal_putentryat, @function
terminal_putentryat:
pushl %ebp
movl %esp, %ebp
movzbl 12(%ebp), %edx
movzbl 8(%ebp), %ecx
movl 20(%ebp), %eax
sall $8, %edx
orl %ecx, %edx
leal (%eax,%eax,4), %eax
movl terminal_buffer, %ecx
sall $4, %eax
addl 16(%ebp), %eax
movw %dx, (%ecx,%eax,2)
popl %ebp
ret
.size terminal_putentryat, .-terminal_putentryat
.p2align 4
.globl terminal_putchar
.type terminal_putchar, @function
terminal_putchar:
movzbl terminal_color, %edx
movl terminal_column, %ecx
pushl %ebp
sall $8, %edx
movl %esp, %ebp
pushl %esi
pushl %ebx
movl terminal_row, %ebx
movzbl 8(%ebp), %esi
leal (%ebx,%ebx,4), %eax
orl %esi, %edx
sall $4, %eax
movl terminal_buffer, %esi
addl %ecx, %eax
movw %dx, (%esi,%eax,2)
cmpl $79, %ecx
je .L19
leal 1(%ecx), %eax
popl %ebx
popl %esi
movl %eax, terminal_column
popl %ebp
ret
.p2align 4,,10
.p2align 3
.L19:
movl $0, terminal_column
leal 1(%ebx), %eax
xorl %edx, %edx
cmpl $24, %ebx
cmove %edx, %eax
popl %ebx
popl %esi
popl %ebp
movl %eax, terminal_row
ret
.size terminal_putchar, .-terminal_putchar
.p2align 4
.globl terminal_write
.type terminal_write, @function
terminal_write:
pushl %ebp
movl %esp, %ebp
pushl %edi
pushl %esi
pushl %ebx
subl $8, %esp
movl 12(%ebp), %eax
testl %eax, %eax
je .L24
movzbl terminal_color, %edx
movl terminal_buffer, %edi
sall $8, %edx
movw %dx, -18(%ebp)
movl 8(%ebp), %edx
addl %edx, %eax
movl %eax, -16(%ebp)
jmp .L30
.p2align 6
.p2align 4,,10
.p2align 3
.L36:
movl %eax, terminal_column
addl $1, %edx
cmpl %edx, -16(%ebp)
je .L24
.L30:
movl terminal_row, %esi
movl terminal_column, %ecx
movzbl (%edx), %ebx
orw -18(%ebp), %bx
leal (%esi,%esi,4), %eax
sall $4, %eax
addl %ecx, %eax
movw %bx, (%edi,%eax,2)
leal 1(%ecx), %eax
cmpl $79, %ecx
jne .L36
movl $0, terminal_column
xorl %ecx, %ecx
leal 1(%esi), %eax
cmpl $24, %esi
cmove %ecx, %eax
addl $1, %edx
movl %eax, terminal_row
cmpl %edx, -16(%ebp)
jne .L30
.L24:
addl $8, %esp
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.size terminal_write, .-terminal_write
.p2align 4
.globl terminal_writestring
.type terminal_writestring, @function
terminal_writestring:
pushl %ebp
movl %esp, %ebp
pushl %edi
pushl %esi
pushl %ebx
subl $8, %esp
movl 8(%ebp), %edx
cmpb $0, (%edx)
je .L37
xorl %eax, %eax
.p2align 4
.p2align 4
.p2align 3
.L39:
addl $1, %eax
cmpb $0, (%edx,%eax)
jne .L39
movzbl terminal_color, %ecx
addl %edx, %eax
movl terminal_buffer, %edi
movl %eax, -16(%ebp)
sall $8, %ecx
movw %cx, -18(%ebp)
jmp .L45
.p2align 6
.p2align 4,,10
.p2align 3
.L49:
movl %eax, terminal_column
addl $1, %edx
cmpl %edx, -16(%ebp)
je .L37
.L45:
movl terminal_row, %esi
movl terminal_column, %ecx
movzbl (%edx), %ebx
orw -18(%ebp), %bx
leal (%esi,%esi,4), %eax
sall $4, %eax
addl %ecx, %eax
movw %bx, (%edi,%eax,2)
leal 1(%ecx), %eax
cmpl $79, %ecx
jne .L49
movl $0, terminal_column
xorl %ecx, %ecx
leal 1(%esi), %eax
cmpl $24, %esi
cmove %ecx, %eax
addl $1, %edx
movl %eax, terminal_row
cmpl %edx, -16(%ebp)
jne .L45
.L37:
addl $8, %esp
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.size terminal_writestring, .-terminal_writestring
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "Hello, World!"
.text
.p2align 4
.globl kernel_main
.type kernel_main, @function
kernel_main:
pushl %ebp
movl %esp, %ebp
pushl %edi
pushl %esi
pushl %ebx
subl $4, %esp
movb $7, terminal_color
movl terminal_buffer, %edi
movl $0, terminal_row
leal 160(%edi), %edx
leal 4160(%edi), %ecx
.p2align 4
.p2align 3
.L51:
leal -160(%edx), %eax
.L52:
movl $1824, %ebx
movl $1824, %esi
addl $4, %eax
movw %bx, -4(%eax)
movw %si, -2(%eax)
cmpl %edx, %eax
jne .L52
leal 160(%eax), %edx
cmpl %ecx, %edx
jne .L51
xorl %eax, %eax
.L53:
addl $1, %eax
cmpb $0, .LC0(%eax)
jne .L53
movl $.LC0, %edx
xorl %ecx, %ecx
xorl %esi, %esi
addl %edx, %eax
movl %eax, -16(%ebp)
jmp .L59
.L65:
movl %eax, terminal_column
addl $1, %edx
cmpl %edx, -16(%ebp)
je .L50
.L66:
movl terminal_row, %esi
movl terminal_column, %ecx
.L59:
movzbl (%edx), %ebx
leal (%esi,%esi,4), %eax
sall $4, %eax
addl %ecx, %eax
orb $7, %bh
movw %bx, (%edi,%eax,2)
leal 1(%ecx), %eax
cmpl $79, %ecx
jne .L65
movl $0, terminal_column
xorl %ecx, %ecx
leal 1(%esi), %eax
cmpl $24, %esi
cmove %ecx, %eax
addl $1, %edx
movl %eax, terminal_row
cmpl %edx, -16(%ebp)
jne .L66
.L50:
addl $4, %esp
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.size kernel_main, .-kernel_main
.globl terminal_buffer
.data
.align 4
.type terminal_buffer, @object
.size terminal_buffer, 4
terminal_buffer:
.long 753664
.globl terminal_color
.section .bss
.type terminal_color, @object
.size terminal_color, 1
terminal_color:
.zero 1
.globl terminal_column
.align 4
.type terminal_column, @object
.size terminal_column, 4
terminal_column:
.zero 4
.globl terminal_row
.align 4
.type terminal_row, @object
.size terminal_row, 4
terminal_row:
.zero 4
.ident "GCC: (GNU) 14.2.0"


Подробнее здесь: https://stackoverflow.com/questions/798 ... r-push-pop
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Linux»