diff -Naur -X exclude-files ac_clean/arch/um/include/sysdep-ppc/sigcontext.h ac/arch/um/include/sysdep-ppc/sigcontext.h --- ac_clean/arch/um/include/sysdep-ppc/sigcontext.h Wed Dec 31 19:00:00 1969 +++ ac/arch/um/include/sysdep-ppc/sigcontext.h Sun May 27 15:49:30 2001 @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) + * Licensed under the GPL + */ + +#ifndef __SYS_SIGCONTEXT_PPC_H +#define __SYS_SIGCONTEXT_PPC_H + +#define UM_GET_SC(sc) asm("mr %0, 4" : "=r" (sc) :) + +#define SC_FAULT_ADDR(sc) ({ \ + struct sigcontext_struct *_sc = (sc); \ + long retval = -1; \ + switch (_sc->regs->trap) { \ + case 0x300: \ + /* data exception */ \ + retval = _sc->regs->dar; \ + break; \ + case 0x400: \ + /* instruction exception */ \ + retval = _sc->regs->nip; \ + break; \ + default: \ + panic("SC_FAULT_ADDR: unhandled trap type\n"); \ + } \ + retval; \ + }) + +#define SC_FAULT_WRITE(sc) (!!(((sc)->regs->dsisr) & 0x02000000)) + +#define SC_IP(sc) ((sc)->regs->nip) +#define SC_SP(sc) ((sc)->regs->gpr[1]) + +#endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff -Naur -X exclude-files ac_clean/arch/um/include/sysdep-ppc/syscalls.h ac/arch/um/include/sysdep-ppc/syscalls.h --- ac_clean/arch/um/include/sysdep-ppc/syscalls.h Wed Dec 31 19:00:00 1969 +++ ac/arch/um/include/sysdep-ppc/syscalls.h Sun May 27 15:49:30 2001 @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) + * Licensed under the GPL + */ + +#include "kern_util.h" // FIXME: syscall_handler_t may move to a different .h + +extern syscall_handler_t old_mmap; + +#define ARCH_SYSCALLS \ + [ __NR_modify_ldt ] = sys_ni_syscall, \ + [ __NR_pciconfig_read ] = sys_ni_syscall, \ + [ __NR_pciconfig_write ] = sys_ni_syscall, \ + [ __NR_pciconfig_iobase ] = sys_ni_syscall, \ + [ __NR_pivot_root ] = sys_ni_syscall, \ + [ __NR_multiplexer ] = sys_ni_syscall, \ + [ __NR_fcntl64 ] = sys_fcntl64, \ + [ __NR_getdents64 ] = sys_getdents64, \ + [ __NR_madvise ] = sys_madvise, \ + [ __NR_mincore ] = sys_mincore, \ + +#define LAST_SYSCALL __NR_mincore + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff -Naur -X exclude-files ac_clean/arch/um/sys-ppc/misc.S ac/arch/um/sys-ppc/misc.S --- ac_clean/arch/um/sys-ppc/misc.S Wed Dec 31 19:00:00 1969 +++ ac/arch/um/sys-ppc/misc.S Sun May 27 15:49:42 2001 @@ -0,0 +1,116 @@ +/* + * This file contains miscellaneous low-level functions. + * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) + * + * Largely rewritten by Cort Dougan (cort@cs.nmt.edu) + * and Paul Mackerras. + * + * A couple of functions stolen from arch/ppc/kernel/misc.S for UML + * by Chris Emerson. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#include +#include +#include "ppc_asm.h" + +#if defined(CONFIG_4xx) || defined(CONFIG_8xx) +#define CACHE_LINE_SIZE 16 +#define LG_CACHE_LINE_SIZE 4 +#define MAX_COPY_PREFETCH 1 +#elif !defined(CONFIG_PPC64BRIDGE) +#define CACHE_LINE_SIZE 32 +#define LG_CACHE_LINE_SIZE 5 +#define MAX_COPY_PREFETCH 4 +#else +#define CACHE_LINE_SIZE 128 +#define LG_CACHE_LINE_SIZE 7 +#define MAX_COPY_PREFETCH 1 +#endif /* CONFIG_4xx || CONFIG_8xx */ + + .text + +/* + * Clear a page using the dcbz instruction, which doesn't cause any + * memory traffic (except to write out any cache lines which get + * displaced). This only works on cacheable memory. + */ +_GLOBAL(clear_page) + li r0,4096/CACHE_LINE_SIZE + mtctr r0 +#ifdef CONFIG_8xx + li r4, 0 +1: stw r4, 0(r3) + stw r4, 4(r3) + stw r4, 8(r3) + stw r4, 12(r3) +#else +1: dcbz 0,r3 +#endif + addi r3,r3,CACHE_LINE_SIZE + bdnz 1b + blr + +/* + * Copy a whole page. We use the dcbz instruction on the destination + * to reduce memory traffic (it eliminates the unnecessary reads of + * the destination into cache). This requires that the destination + * is cacheable. + */ +#define COPY_16_BYTES \ + lwz r6,4(r4); \ + lwz r7,8(r4); \ + lwz r8,12(r4); \ + lwzu r9,16(r4); \ + stw r6,4(r3); \ + stw r7,8(r3); \ + stw r8,12(r3); \ + stwu r9,16(r3) + +_GLOBAL(copy_page) + addi r3,r3,-4 + addi r4,r4,-4 + li r5,4 + +#ifndef CONFIG_8xx +#if MAX_COPY_PREFETCH > 1 + li r0,MAX_COPY_PREFETCH + li r11,4 + mtctr r0 +11: dcbt r11,r4 + addi r11,r11,CACHE_LINE_SIZE + bdnz 11b +#else /* MAX_COPY_PREFETCH == 1 */ + dcbt r5,r4 + li r11,CACHE_LINE_SIZE+4 +#endif /* MAX_COPY_PREFETCH */ +#endif /* CONFIG_8xx */ + + li r0,4096/CACHE_LINE_SIZE + mtctr r0 +1: +#ifndef CONFIG_8xx + dcbt r11,r4 + dcbz r5,r3 +#endif + COPY_16_BYTES +#if CACHE_LINE_SIZE >= 32 + COPY_16_BYTES +#if CACHE_LINE_SIZE >= 64 + COPY_16_BYTES + COPY_16_BYTES +#if CACHE_LINE_SIZE >= 128 + COPY_16_BYTES + COPY_16_BYTES + COPY_16_BYTES + COPY_16_BYTES +#endif +#endif +#endif + bdnz 1b + blr diff -Naur -X exclude-files ac_clean/arch/um/sys-ppc/ptrace_user.c ac/arch/um/sys-ppc/ptrace_user.c --- ac_clean/arch/um/sys-ppc/ptrace_user.c Wed Dec 31 19:00:00 1969 +++ ac/arch/um/sys-ppc/ptrace_user.c Sun May 27 15:49:42 2001 @@ -0,0 +1,39 @@ +#include +#include +#include + +int ptrace_getregs(long pid, struct sys_pt_regs *regs_out) +{ + int i; + for (i=0; i < sizeof(struct sys_pt_regs)/sizeof(PPC_REG); ++i) { + errno = 0; + regs_out->regs[i] = ptrace(PTRACE_PEEKUSER, pid, i*4, 0); + if (errno) { + return -errno; + } + } + return 0; +} + +int ptrace_setregs(long pid, struct sys_pt_regs *regs_in) +{ + int i; + for (i=0; i < sizeof(struct sys_pt_regs)/sizeof(PPC_REG); ++i) { + if (i != 34 /* FIXME: PT_ORIG_R3 */ && i <= PT_MQ) { + if (ptrace(PTRACE_POKEUSER, pid, i*4, regs_in->regs[i]) < 0) { + return -errno; + } + } + } + return 0; +} +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff -Naur -X exclude-files ac_clean/arch/um/sys-ppc/sigcontext.c ac/arch/um/sys-ppc/sigcontext.c --- ac_clean/arch/um/sys-ppc/sigcontext.c Sun May 27 15:42:43 2001 +++ ac/arch/um/sys-ppc/sigcontext.c Wed Dec 31 19:00:00 1969 @@ -1,48 +0,0 @@ -#include -#include -#include "sysdep/ptrace.h" -#include "user_util.h" - -void fill_in_sigcontext(struct sigcontext *sc, struct sys_pt_regs *regs, - unsigned long cr2, int err) -{ -#if 0 - int i; - // general purpose regs - for (i=0; i<32; ++i) { - sc->regs->gpr[i] = regs->u.regs[PT_R0 + i]; - } - sc->regs->nip = regs->u.regs[PT_NIP]; - sc->regs->msr = regs->u.regs[PT_MSR]; - sc->regs->orig_gpr3 = regs->u.regs[PT_ORIG_R3]; - sc->regs->ctr = regs->u.regs[PT_CTR]; - sc->regs->link = regs->u.regs[PT_LNK]; - sc->regs->xer = regs->u.regs[PT_XER]; - sc->regs->ccr = regs->u.regs[PT_CCR]; - sc->regs->mq = regs->u.regs[PT_MQ]; - sc->regs->trap = err; - sc->regs->dar = cr2; -#endif - *(sc->regs) = *regs; - // DAR, DSISR, RESULT? -} - -void fill_in_regs(struct sys_pt_regs *regs, void *sc_ptr) -{ - struct sigcontext *sc; - - sc = sc_ptr; - - *(sc->regs) = *regs; -} - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */