Subject: Re: m68k Asm and C
To: Bill Studenmund <wrstuden@nas.nasa.gov>
From: Andy Finnell <andyf@vei.net>
List: port-mac68k
Date: 06/20/1999 21:14:40
Bill Studenmund wrote:

#define SYSCALL(x)      .even; ENTRY(machdep_sys_ ## x); \
                         movl \#SYS_ ## x,d0; trap \#0; jcs err; rts

> What I was trying to say is that you could just use an inline c routine
> which had the asm in it. So that you're not trying to have the macro
> processer do asm.

Well, that would work if I were defining a single routine.  When you
"invoke" (bad choice of word) the #define, you won't be calling a
function, but *defining* one.  

SYSCALL(pipe)

The above line would define a c function called machdep_sys_pipe() when
the macro expanded.
 
> Another option would be to look at /usr/src/lib/libc/arch/m68k/SYS.h which
> is the macro file used to generate NetBSD syscalls. 

Thanks for the tip, I'll take a look at it.

> Note also that, in
> usr/src/libc/sys/Makefile.inc, the ASM gets fed directly to as, not going
> through cc.

That's the real problem: I'm going through gcc instead of cpp, then into
as.  The "regular" syscall file I've defined has the same macro in it,
and it works fine.  The difference is, when the "regular" syscall file
is made, it is piped through cpp then into as.  The template syscall is
passed straight into gcc.

It is also important to note that you can't remove the # in front of an
integer immediate like I said before in another post.  It'll compile,
but as I found out its not the same, and you get a seg fault.  I've had
to ditch the template for now and explicitly define the syscalls.  It
works, but its a little more work for me.

Thanks for the help,

	-andy