how to use a macro's parameter in GAS
Posted: Sat Feb 16, 2013 9:14 am
Hi everybody
I have a problem related with the use of parameters in a macro. The code listed below works perfectly in NASM, but I'm working with GAS and I can't get the correct value of those parameters, code in GAS is listed below.
----------------------------------------------------------------------------
NASM
----------------------------------------------------------------------------
IRQ 0, 32
IRQ 1, 33
IRQ 2, 34
%macro IRQ 2
global irq%1
irq%1:
cli ; Disable interrupts firstly.
push byte 0 ; Push a dummy error code.
push byte %2 ; Push the interrupt number.
jmp irq_common_stub ; Go to our common handler code.
%endmacro
----------------------------------------------------------------------------
GAS
----------------------------------------------------------------------------
IRQ 0, 32
IRQ 1, 33
IRQ 2, 34
.macro IRQ int_nro, int_mask
.global irq\int_nro
irq\int_nro:
cli # Disable interrupts firstly.
pushl $0 # Push a dummy error code.
pushl \int_mask # Push the interrupt number.
jmp irq_common_stub # Go to our common handler code.
.endm
The symbol of tables is generated correctly:
irq32, irq33, irq34
and link correctly but when the program writed in GAS is running I can't get the value 32, 33, 34 of those parameters to pass to my handler, I get values such as: 4026597029 instead of 32.
Is possible write the same code as NASM in GAS or I have to write the 32 macros in GAS?
I was looking in the forum and in book suggested in other topic but I can't get the solution.
Thanks.
I have a problem related with the use of parameters in a macro. The code listed below works perfectly in NASM, but I'm working with GAS and I can't get the correct value of those parameters, code in GAS is listed below.
----------------------------------------------------------------------------
NASM
----------------------------------------------------------------------------
IRQ 0, 32
IRQ 1, 33
IRQ 2, 34
%macro IRQ 2
global irq%1
irq%1:
cli ; Disable interrupts firstly.
push byte 0 ; Push a dummy error code.
push byte %2 ; Push the interrupt number.
jmp irq_common_stub ; Go to our common handler code.
%endmacro
----------------------------------------------------------------------------
GAS
----------------------------------------------------------------------------
IRQ 0, 32
IRQ 1, 33
IRQ 2, 34
.macro IRQ int_nro, int_mask
.global irq\int_nro
irq\int_nro:
cli # Disable interrupts firstly.
pushl $0 # Push a dummy error code.
pushl \int_mask # Push the interrupt number.
jmp irq_common_stub # Go to our common handler code.
.endm
The symbol of tables is generated correctly:
irq32, irq33, irq34
and link correctly but when the program writed in GAS is running I can't get the value 32, 33, 34 of those parameters to pass to my handler, I get values such as: 4026597029 instead of 32.
Is possible write the same code as NASM in GAS or I have to write the 32 macros in GAS?
I was looking in the forum and in book suggested in other topic but I can't get the solution.
Thanks.