Linux IA64 platform development
 help / color / mirror / Atom feed
* testing a new syscall
@ 2004-03-22 10:15 Andrew Morton
  2004-03-22 12:15 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Morton @ 2004-03-22 10:15 UTC (permalink / raw)
  To: linux-ia64


I'm trying to work out how to test the new remap_file_pages() syscall on
ia64 and have conceded defeat.

I got this far, but it segfaults:

#elif __ia64__
#define __NR_sys_remap_file_pages 1259
...
_syscall5(long, sys_remap_file_pages, unsigned long, start, unsigned long, len,
        unsigned long, prot, unsigned long, pgoff, int, flags);

....

#if defined(__ia64__)

asm(
"	.text\n"
"	.global __ia64_syscall#;\n"
"	.align	32;\n"
"	.proc	__ia64_syscall#;\n"
"__ia64_syscall#:\n"
"	.regstk 6,0,0,0\n"
"	mov r15=in5\n"
"	break 0x100000\n"
"	movl r2=errno\n"
"	cmp.eq p6,p7=-1,r10\n"
"	;;\n"
"(p6)	st4 [r2]=r8\n"
"(p6)	mov r8=-1\n"
"	br.ret.sptk.many rp\n"
"	.endp	__ia64_syscall#\n"
);

#endif


What's the magic here?

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: testing a new syscall
  2004-03-22 10:15 testing a new syscall Andrew Morton
@ 2004-03-22 12:15 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2004-03-22 12:15 UTC (permalink / raw)
  To: linux-ia64

On Mon, Mar 22, 2004 at 02:15:55AM -0800, Andrew Morton wrote:
> I'm trying to work out how to test the new remap_file_pages() syscall on
> ia64 and have conceded defeat.
> 
> I got this far, but it segfaults:
> 
> #elif __ia64__
> #define __NR_sys_remap_file_pages 1259
> ...
> _syscall5(long, sys_remap_file_pages, unsigned long, start, unsigned long, len,
>         unsigned long, prot, unsigned long, pgoff, int, flags);
> 
> ....
> 
> #if defined(__ia64__)
> 
> asm(
> "	.text\n"

Argh!  Assembler!  Run away ;-)

Here's the better way to do it (cribbed from manfred's mqueue work):

static inline long remap_file_pages(unsigned long start, unsigned long len,
		unsigned long prot, unsigned long pgoff, int flags)
{
	return syscall(__NR_sys_remap_file_pages, start, len, prot, pgoff,
			flags);
}

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-22 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-22 10:15 testing a new syscall Andrew Morton
2004-03-22 12:15 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox