diff -ru arla-0.36pre29/configure.in /usr/src/arla-0.36pre29/configure.in --- arla-0.36pre29/configure.in 2003-03-12 17:09:10.000000000 +0100 +++ /usr/src/arla-0.36pre29/configure.in 2003-04-28 00:51:09.000000000 +0200 @@ -487,6 +487,9 @@ ia64*) LINUX_IA64=yes KERNEL_CC=${KERNEL_CC:-$CC} ;; + x86_64|amd_64) + SHLIB_CFLAGS="${SHLIB_CFLAGS} -fPIC" + KERNEL_CFLAGS="${KERNEL_CFLAGS} -mcmodel=kernel" ;; *) KERNEL_CC=${KERNEL_CC:-$CC} ;; esac diff -ru arla-0.36pre29/lwp/Makefile.in /usr/src/arla-0.36pre29/lwp/Makefile.in --- arla-0.36pre29/lwp/Makefile.in 2002-06-04 14:02:12.000000000 +0200 +++ /usr/src/arla-0.36pre29/lwp/Makefile.in 2003-04-26 23:44:06.000000000 +0200 @@ -43,6 +43,7 @@ process.ppc.S \ process.rios.S \ process.sparc.S \ + process.x86_64.S \ process.vax.S diff -ru arla-0.36pre29/lwp/make-process.o.sh.in /usr/src/arla-0.36pre29/lwp/make-process.o.sh.in --- arla-0.36pre29/lwp/make-process.o.sh.in 2002-11-29 20:48:14.000000000 +0100 +++ /usr/src/arla-0.36pre29/lwp/make-process.o.sh.in 2003-04-26 23:46:36.000000000 +0200 @@ -55,6 +55,7 @@ rs6000) PROCESS_S="process.rios.S" ;; vax) PROCESS_S="process.vax.S" ;; s390*) PROCESS_S="process.s390.S" ;; + x86_64|amd_64) PROCESS_S="process.x86_64.S" ;; f301) ;; *) echo "Unknown host_cpu, good luck" ;; esac diff -ru arla-0.36pre29/lwp/rw.c /usr/src/arla-0.36pre29/lwp/rw.c --- arla-0.36pre29/lwp/rw.c 2002-06-02 14:12:35.000000000 +0200 +++ /usr/src/arla-0.36pre29/lwp/rw.c 2003-04-27 03:31:48.000000000 +0200 @@ -219,7 +219,7 @@ interval = (argc >= 3 ? atoi(*++argv)*1000 : 50000); - if (argc == 4) lwp_debug = 1; + if (argc == 4) lwp_debug = atoi(*++argv); LWP_InitializeProcessSupport(0, &master); printf("[Support initialized]\n"); tv.tv_sec = 0; diff -ru arla-0.36pre29/nnpfs/linux/Makefile.in /usr/src/arla-0.36pre29/nnpfs/linux/Makefile.in --- arla-0.36pre29/nnpfs/linux/Makefile.in 2003-02-14 13:45:58.000000000 +0100 +++ /usr/src/arla-0.36pre29/nnpfs/linux/Makefile.in 2003-04-28 00:52:20.000000000 +0200 @@ -32,6 +32,8 @@ NNPFS_BIN = $(MODULE) DEFS = @DEFS@ @KERNEL_CFLAGS@ @KERNEL_CPPFLAGS@ -DDEBUG +SHLIB_CFLAGS = @SHLIB_CFLAGS@ -DDEBUG + INC = -I$(srcdir)/../include \ -I../../include \ -I$(srcdir)/../../include @@ -112,7 +114,7 @@ $(KERNEL_CC) -c $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) $(CFLAGS) $< getcwd.o: getcwd.c - $(CC) -c $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) $(CFLAGS) $< + $(CC) -c $(CPPFLAGS) $(SHLIB_CFLAGS) -I. -I$(srcdir) $(CFLAGS) $< Makefile: Makefile.in ../../config.status cd ../..; CONFIG_FILES=nnpfs/linux/Makefile CONFIG_HEADERS= $(SHELL) config.status diff -ru arla-0.36pre29/nnpfs/linux/nnpfs_syscalls-lossage.c /usr/src/arla-0.36pre29/nnpfs/linux/nnpfs_syscalls-lossage.c --- arla-0.36pre29/nnpfs/linux/nnpfs_syscalls-lossage.c 2003-02-10 21:25:58.000000000 +0100 +++ /usr/src/arla-0.36pre29/nnpfs/linux/nnpfs_syscalls-lossage.c 2003-04-27 19:49:00.000000000 +0200 @@ -67,7 +67,7 @@ #ifndef HAVE_KERNEL_SYS_CALL_TABLE #include -#include +/*#include */ #include #endif @@ -140,7 +140,11 @@ #else /* !HAVE_KERNEL_KALLSYMS_ADDRESS_TO_SYMBOL */ - ptr = (nnpfs_sys_call_function *)&init_mm; + /* ptr = (nnpfs_sys_call_function *)&init_mm;*/ + ptr = (nnpfs_sys_call_function *)&tasklist_lock; + printk("Symbol tasklist_lock is at %p\n", ptr); + ptr = ptr - 4 * 1024; + printk("Starting to search at %p\n", ptr); datalen = 16 * 1024; #endif /* HAVE_KERNEL_KALLSYMS_ADDRESS_TO_SYMBOL */ diff -ru arla-0.36pre29/nnpfs/linux/nnpfs_syscalls.c /usr/src/arla-0.36pre29/nnpfs/linux/nnpfs_syscalls.c --- arla-0.36pre29/nnpfs/linux/nnpfs_syscalls.c 2003-02-16 01:57:49.000000000 +0100 +++ /usr/src/arla-0.36pre29/nnpfs/linux/nnpfs_syscalls.c 2003-04-27 23:51:39.000000000 +0200 @@ -762,7 +762,7 @@ } #endif -asmlinkage int +asmlinkage long sys_afs (int operation, char *a_pathP, int a_opcode, @@ -790,6 +790,10 @@ old_afs_syscall = sys_call_table[__NR_afs_syscall]; sys_call_table[__NR_afs_syscall] = (nnpfs_sys_call_function)&sys_afs; + printk("Installing syscall %d at addr %p function %p\n", + __NR_afs_syscall, + &(sys_call_table[__NR_afs_syscall]), + &sys_afs); #ifdef NEED_VICEIOCTL32 old_afs_syscall32 = sys_call_table32[__NR_afs_syscall]; sys_call_table32[__NR_afs_syscall] = (uint32_t)&sys32_afs; --- /dev/null 2002-03-22 01:21:14.000000000 +0100 +++ /usr/src/arla-0.36pre29/lwp/process.x86_64.S 2003-04-27 12:08:27.000000000 +0200 @@ -0,0 +1,163 @@ +/* $Id:$ */ + +/* + * Copyright (c) 2003 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#undef RCSID + +/* x86_64 Assembly + * + * By Harald Barth after looking + * at Derek Atkins' i386 routines and realizing that + * there were some differences and it was not enough + * just renaming the registers. + */ + +#ifdef HAVE_MACHINE_ASM_H +#include +#endif + +#include + + .file "process.s" + .data + .text + +/* + * struct savearea { + * char *topstack; + * } + */ + + .set topstack,0 + +/* + * savecontext(int (*f)(), struct savearea *area1, char *newsp) + */ + +/* + * In spite of passing arguments in registers, gcc first copies the content of the + * registers onto the stack. I do not know why gcc does this, but for now I mimic + * gcc's behaviour. Here are the offsets the arguments are copied to. + */ + .set f,-8 + .set area1,-16 + .set newsp,-24 + +.globl _C_LABEL(PRE_Block) +.globl _C_LABEL(savecontext) + +ENTRY(savecontext) + pushq %rbp /* The frame setup is just like gcc */ + movq %rsp,%rbp + subq $32, %rsp /* make room for args on the stack */ + movq %rdi, f(%rbp) /* (3*8=24 but increments seem to */ + movq %rsi, area1(%rbp) /* i multiples of 24, so 32 it is) */ + movq %rdx, newsp(%rbp) /* and copy them there. */ + + movl $1,_C_LABEL(PRE_Block) /* Do not allow any interrupts */ + + pushq %rsp /* Push all registers onto the stack */ + pushq %rax /* Probably not _all_ are necessary */ + pushq %rcx /* but better one too much than one */ + pushq %rdx /* forgotten */ + pushq %rbx + pushq %rbp + pushq %rsi + pushq %rdi + pushq %r8 + pushq %r9 + pushq %r10 + pushq %r11 + pushq %r12 + pushq %r13 + pushq %r14 + pushq %r15 /* Btw, the pusha instruction is no more */ + + movq area1(%rbp),%rax /* rax = base of savearea */ + movq %rsp,topstack(%rax) /* area->topstack = rsp */ + movq newsp(%rbp),%rax /* rax = new sp */ + cmpq $0,%rax + je L1 /* if new sp is 0 then dont change rsp */ + movq %rax,%rsp /* Change rsp to the new sp */ +L1: + jmp *f(%rbp) /* jump to function pointer passed in arg */ + +/* Shouldnt be here....*/ + call _C_LABEL(abort) + +/* + * returnto(struct savearea *area2) + */ + +/* Offset where we put arg - se savecontext */ + .set area2,-8 + +.globl _C_LABEL(returnto) + +ENTRY(returnto) + pushq %rbp /* New frame, gcc style */ + movq %rsp, %rbp /* See savecontext above */ + subq $16, %rsp /* Make room for 2 args */ + movq %rdi, area2(%rbp) /* use room to copy 1 arg */ + movq area2(%rbp),%rax /* rax = area2 */ + movq topstack(%rax),%rsp /* restore rsp from place relative rbp*/ + + popq %r15 /* Restore regs */ + popq %r14 + popq %r13 + popq %r12 + popq %r11 + popq %r10 + popq %r9 + popq %r8 + popq %rdi + popq %rsi + popq %rbp + popq %rbx + popq %rdx + popq %rcx + popq %rax + popq %rsp /* See savecontext */ + + movl $0,_C_LABEL(PRE_Block) /* clear it up... */ + addq $32, %rsp /* We did rsp-32 above, correct that */ + popq %rbp + ret + +/* We never should get here, put in emergency brake as in i386 code */ + pushq $1234 + call _C_LABEL(abort) +