Skip to contentSkip to conversation

testing a new syscall

DISCUSSION Andrew Morton 2 participants 2 messages Mar 22, 2004

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 9 lines · Andrew Morton

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,

Quoted 8 lines
        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);
}
Signature · 6 lines
"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