[PATCH] sh: fix SYSCALL_INST_STR macros for SH-2[A] arch.

Paul Mundt lethal at linux-sh.org
Wed Sep 24 13:53:59 UTC 2008


On Wed, Sep 24, 2008 at 03:44:34PM +0200, Carmelo AMOROSO wrote:
> Hi Paul,
> please find attached a patch to make SYSCALL_INST_STR macros working on 
> SH2 too. I've built trunk for sh4 and objdumped some object using 
> INLINE_SYSCALL, and it looks fine.
> 
> Let me know, so I can commit.
> 
> Carmelo

> Index: libc/sysdeps/linux/sh/bits/syscalls.h
> ===================================================================
> --- libc/sysdeps/linux/sh/bits/syscalls.h	(revision 23456)
> +++ libc/sysdeps/linux/sh/bits/syscalls.h	(working copy)
> @@ -140,14 +140,19 @@
>  __syscall_return(type,__sc0); \
>  }
>  
> -#define SYSCALL_INST_STR0	"trapa #0x10\n\t"
> -#define SYSCALL_INST_STR1	"trapa #0x11\n\t"
> -#define SYSCALL_INST_STR2	"trapa #0x12\n\t"
> -#define SYSCALL_INST_STR3	"trapa #0x13\n\t"
> -#define SYSCALL_INST_STR4	"trapa #0x14\n\t"
> -#define SYSCALL_INST_STR5	"trapa #0x15\n\t"
> -#define SYSCALL_INST_STR6	"trapa #0x16\n\t"
> +/* Two level macros for expansion and stringification */
> +#define xstr(s)	str(s)
> +#define str(s)	#s
>  
uClibc has no equivalent of __stringify()? This should probably be in a
generic header somewhere.

> +#define SYSCALL_INST_STR(x)	"trapa #"xstr(__SH_SYSCALL_TRAP_BASE + x)"\n\t"
> +#define SYSCALL_INST_STR0	SYSCALL_INST_STR(0)
> +#define SYSCALL_INST_STR1	SYSCALL_INST_STR(1)
> +#define SYSCALL_INST_STR2	SYSCALL_INST_STR(2)
> +#define SYSCALL_INST_STR3	SYSCALL_INST_STR(3)
> +#define SYSCALL_INST_STR4	SYSCALL_INST_STR(4)
> +#define SYSCALL_INST_STR5	SYSCALL_INST_STR(5)
> +#define SYSCALL_INST_STR6	SYSCALL_INST_STR(6)
> +
>  # ifdef NEED_SYSCALL_INST_PAD
>  #  define SYSCALL_INST_PAD "\
>  	or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0"

The rest obviously looks fine.



More information about the uClibc mailing list