Re: Assembly macros with Gcc
Re: Assembly macros with Gcc
- Subject: Re: Assembly macros with Gcc
- From: Jonas Maebe <email@hidden>
- Date: Wed, 4 Feb 2004 22:45:54 +0100
On 4 feb 2004, at 22:02, Brad Post (MACBU) wrote:
Sorry, let me clarify, I am writing assembly code, using a .s file with
GCC, I don't need to know how to do macros with c or cpp files, but
with
assembly files.
Ok. This comes from a 80x86 gnu assembler file, but I guess the syntax
is the same under Mac OS X:
.macro diota_trace_struct_stack_ NAME TYPE OFFSET ADJUST
.globl \NAME
.type \NAME,@function
\NAME:
push ëp
mov %esp,ëp
// Guard against C calling convention
pushf
push êx
push ìx
push íx
// create struct t_mem_access on the stack
// ADDRESS
leal \OFFSET(ëp),êx
// if it is a push, adjust by subtracting LENGTH from ADDRESS
\ADJUST
push êx
[snip]
.size \NAME,.-\NAME
.endm
.macro adjust
sub 12(ëp),êx
.endm
diota_trace_struct_stack_ diota_trace_struct_push_ STORE 16 adjust
diota_trace_struct_stack_ diota_trace_struct_pop_ LOAD 16
Jonas
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.