diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/Makefile linux-2.4.18-sparc64/arch/um/Makefile --- linux-2.4.18-orig/arch/um/Makefile Fri May 9 19:25:24 2003 +++ linux-2.4.18-sparc64/arch/um/Makefile Sat May 10 16:00:21 2003 @@ -3,6 +3,7 @@ include arch/$(ARCH)/Makefile-$(SUBARCH) EXTRAVERSION := $(EXTRAVERSION)-22um +EXTRAVERSIONS := $(EXTRAVRSION)-sparc64-3 include/linux/version.h: arch/$(ARCH)/Makefile # Recalculate MODLIB to reflect the EXTRAVERSION changes (via KERNELRELEASE) diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/Makefile-sparc64 linux-2.4.18-sparc64/arch/um/Makefile-sparc64 --- linux-2.4.18-orig/arch/um/Makefile-sparc64 Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/Makefile-sparc64 Sat May 10 16:00:21 2003 @@ -0,0 +1,17 @@ +ARCH_CFLAGS = -U__$(SUBARCH)__ -U$(SUBARCH) -pipe \ + -mno-fpu -mcpu=ultrasparc -ffixed-g4 \ + -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare \ + -Wa,--undeclared-regs + +ELF_SUBARCH = elf32-sparc + +SYS_HEADERS = $(ARCH_DIR)/include/sysdep-sparc64/sc.h + +$(ARCH_DIR)/include/sysdep-sparc64/sc.h : $(ARCH_DIR)/sys-sparc64/util/mk_sc + $(ARCH_DIR)/sys-sparc64/util/mk_sc > $@ + +$(ARCH_DIR)/sys-sparc64/util/mk_sc : $(ARCH_DIR)/sys-sparc64/util/mk_sc.c + $(MAKE) -C $(ARCH_DIR)/sys-sparc64/util all + +sysclean : + diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/include/process.h linux-2.4.18-sparc64/arch/um/include/process.h --- linux-2.4.18-orig/arch/um/include/process.h Fri May 9 19:25:24 2003 +++ linux-2.4.18-sparc64/arch/um/include/process.h Sat May 10 16:00:21 2003 @@ -6,8 +6,6 @@ #ifndef __PROCESS_H__ #define __PROCESS_H__ -#include - extern void sig_handler(int sig, struct sigcontext sc); extern void irq_handler(int sig, struct sigcontext sc); extern void alarm_handler(int sig, struct sigcontext sc); diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/include/syscall_user.h linux-2.4.18-sparc64/arch/um/include/syscall_user.h --- linux-2.4.18-orig/arch/um/include/syscall_user.h Fri May 9 19:25:24 2003 +++ linux-2.4.18-sparc64/arch/um/include/syscall_user.h Sat May 10 16:00:21 2003 @@ -6,8 +6,6 @@ #ifndef __SYSCALL_USER_H__ #define __SYSCALL_USER_H__ -#include - extern void syscall_handler(int sig, struct sigcontext sc); extern void exit_kernel(int pid, void *task); extern int do_syscall(void *task, int pid); diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/include/sysdep-sparc64/frame.h linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/frame.h --- linux-2.4.18-orig/arch/um/include/sysdep-sparc64/frame.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/frame.h Sat May 10 16:00:21 2003 @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) + * Licensed under the GPL + */ + +#ifndef __FRAME_SPARC64_H +#define __FRAME_SPARC64_H + +struct arch_frame_data_raw { + unsigned long sc_end; +}; + +struct arch_frame_data { + int fpstate_size; +}; + +#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 dontdiff linux-2.4.18-orig/arch/um/include/sysdep-sparc64/frame_kern.h linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/frame_kern.h --- linux-2.4.18-orig/arch/um/include/sysdep-sparc64/frame_kern.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/frame_kern.h Sat May 10 16:39:56 2003 @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2003 Shanti Katta (katta@csee.wvu.edu) + * Licensed under the GPL + */ + +#ifndef __FRAME_KERN_SPARC64_H +#define __FRAME_KERN_SPARC64_H + +/* This is called from sys_sigreturn. It takes the sp at the point of the +* sigreturn system call and returns the address of the sigcontext struct +* on the stack. +*/ + +static inline void *sp_to_sc(unsigned long sp) +{ + return((void *) sp); +} + +static inline void *sp_to_rt_sc(unsigned long sp) +{ + unsigned long sc; + + sc = sp - signal_frame_si.sp_index + signal_frame_si.len - 4; + return((void *) sc); +} + +static inline void *sp_to_mask(unsigned long sp) +{ + unsigned long mask; + + mask = sp - signal_frame_sc.sp_index + signal_frame_sc.len - 8; + return((void *) mask); +} + +extern int sc_size(void *data); + +static inline void *sp_to_rt_mask(unsigned long sp) +{ + unsigned long mask; + + mask = sp - signal_frame_si.sp_index + signal_frame_si.len + sc_size(&signal_frame_sc.arch) - 4; + return((void *) mask); +} + +#endif diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/include/sysdep-sparc64/frame_user.h linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/frame_user.h --- linux-2.4.18-orig/arch/um/include/sysdep-sparc64/frame_user.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/frame_user.h Sat May 10 16:41:29 2003 @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2003 Shanti Katta (katta@csee.wvu.edu) + * Licensed under the GPL + */ + +#ifndef __FRAME_USER_I386_H +#define __FRAME_USER_I386_H + +#include +#include "sysdep/frame.h" + +/* This stuff is to calculate the size of the fp state struct at runtime +* because it has changed between 2.2 and 2.4 and it would be good for a +* UML compiled on one to work on the other. +* So, setup_arch_frame_raw fills in the arch struct with the raw data, which +* just contains the address of the end of the sigcontext. This is invoked +* from the signal handler. +* setup_arch_frame uses that data to figure out what +* arch_frame_data.fpstate_size should be. It really has no idea, since it's +* not allowed to do sizeof(struct fpstate) but it's safe to consider that it's + * everything from the end of the sigcontext up to the top of the stack. So, +* it masks off the page number to get the offset within the page and subtracts + * that from the page size, and that's how big the fpstate struct will be +* considered to be. +*/ + +static inline void setup_arch_frame_raw(struct arch_frame_data_raw *data, + struct sigcontext *sc) +{ + data->sc_end = (unsigned long) sc; + data->sc_end += sizeof(*sc); +} + +static inline void setup_arch_frame(struct arch_frame_data_raw *in, + struct arch_frame_data *out) +{ + unsigned long fpstate_start = in->sc_end; + + fpstate_start &= ~PAGE_MASK; + out->fpstate_size = PAGE_SIZE - fpstate_start; +} + +/* This figures out where on the stack the SA_RESTORER function address +* is stored. For i386, it's the signal handler return address, so it's +* located next to the frame pointer. +* This is inlined, so __builtin_frame_address(0) is correct. Otherwise, +* it would have to be __builtin_frame_address(1). +*/ + +static inline unsigned long frame_restorer(void) +{ + unsigned long *fp; + + fp = __builtin_frame_address(0); + return((unsigned long) (fp + 1)); +} + +/* Similarly, this returns the value of sp when the handler was first + * entered. This is used to calculate the proper sp when delivering + * signals. + */ + +static inline unsigned long frame_sp(void) +{ + unsigned long *fp; + + fp = __builtin_frame_address(0); + return((unsigned long) (fp + 1)); +} + +#endif diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/include/sysdep-sparc64/ptrace.h linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/ptrace.h --- linux-2.4.18-orig/arch/um/include/sysdep-sparc64/ptrace.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/ptrace.h Sat May 10 16:00:21 2003 @@ -0,0 +1,119 @@ + +#ifndef __SYSDEP_SPARC64_PTRACE_H +#define __SYSDEP_SPARC64_PTRACE_H + +#include "sysdep/sc.h" + +struct uml_pt_regs { + unsigned long args[6]; + long syscall; + int is_user; + void *sc; +}; + +#define EMPTY_UML_PT_REGS { \ + syscall : -1, \ + args : { [0 ... 5] = 0 }, \ + is_user : 0, \ + sc : NULL } + +#define UM_REG(r, n) ((r)->regs[n]) + +/* These next two will prolly need to be fixed, but it will help compile */ +/* And since the ptrace stuff still needs to be fixed, all these could be + wrong. +*/ + +#define UPT_U_REGS[x](regs) SC_U_REGS[x]((regs)->sc) +#define UPT_PSR(regs) SC_PSR((regs)->sc) +#define UPT_FP(regs) SC_FP((regs)->sc) +#define UPT_RETPC(regs) SC_RETPC((regs)->sc) + +#define UPT_PC(regs) SC_PC((regs)->sc) +#define UPT_NPC(regs) SC_NPC((regs)->sc) + +#define UPT_IP(regs) SC_IP((regs)->sc) +#define UPT_SP(regs) SC_SP((regs)->sc) + +#define UPT_SC(regs) ((regs)->sc) + +#define UPT_REG(regs, reg) \ +({ unsigned long val; \ + switch(reg){ \ + case UREG_G0: val = UPT_U_REGS[0](regs); break; \ + case UREG_G1: val = UPT_U_REGS[1](regs); break; \ + case UREG_G2: val = UPT_U_REGS[2](regs); break; \ + case UREG_G3: val = UPT_U_REGS[3](regs); break; \ + case UREG_G4: val = UPT_U_REGS[4](regs); break; \ + case UREG_G5: val = UPT_U_REGS[5](regs); break; \ + case UREG_G6: val = UPT_U_REGS[6](regs); break; \ + case UREG_G7: val = UPT_U_REGS[7](regs); break; \ + case UREG_I0: val = UPT_U_REGS[8](regs); break; \ + case UREG_I1: val = UPT_U_REGS[9](regs); break; \ + case UREG_I2: val = UPT_U_REGS[10](regs); break; \ + case UREG_I3: val = UPT_U_REGS[11](regs); break; \ + case UREG_I4: val = UPT_U_REGS[12](regs); break; \ + case UREG_I5: val = UPT_U_REGS[13](regs); break; \ + case UREG_I6: val = UPT_U_REGS[14](regs); break; \ + case UREG_I7: val = UPT_U_REGS[15](regs); break; \ + case UREG_PC: val = UPT_IP(regs); break; \ + case UREG_PSR: val = UPT_SP(regs); break; \ + case UREG_NPC: val = UPT_NPC(regs); break; \ + case UREG_FP: val = UPT_FP(regs); break; \ + case UREG_RETPC: val = UPT_RETPC(regs); break; \ + default: \ + panic("Bad register in UPT_REG : %d\n", reg); \ + val = -1; \ + }\ + val; \ +}) + +#define UPT_SET(regs, reg, val) \ + do { \ + switch(reg){ \ + case UREG_G0: UPT_U_REGS[0](reg) = val; break; \ + case UREG_G1: UPT_U_REGS[1](reg) = val; break; \ + case UREG_G2: UPT_U_REGS[2](reg) = val; break; \ + case UREG_G3: UPT_U_REGS[3](reg) = val; break; \ + case UREG_G4: UPT_U_REGS[4](reg) = val; break; \ + case UREG_G5: UPT_U_REGS[5](reg) = val; break; \ + case UREG_G6: UPT_U_REGS[6](reg) = val; break; \ + case UREG_G7: UPT_U_REGS[7](reg) = val; break; \ + case UREG_I0: UPT_U_REGS[8](reg) = val; break; \ + case UREG_I1: UPT_U_REGS[9](reg) = val; break; \ + case UREG_I2: UPT_U_REGS[10](reg) = val; break; \ + case UREG_I3: UPT_U_REGS[11](reg) = val; break; \ + case UREG_I4: UPT_U_REGS[12](reg) = val; break; \ + case UREG_I5: UPT_U_REGS[13](reg) = val; break; \ + case UREG_I6: UPT_U_REGS[14](reg) = val; break; \ + case UREG_I7: UPT_U_REGS[15](reg) = val; break; \ + case UREG_PC: UPT_IP(reg) = val; break; \ + case UREG_PSR: UPT_SP(reg) = val; break; \ + case UREG_NPC: UPT_NPC(reg) = val; break; \ + case UREG_FP: UPT_FP(reg) = val; break; \ + case UREG_RETPC: UPT_RETPC(reg) = val; break; \ + default: \ + panic("Bad register in UPT_SET : %d\n", reg); \ + break; \ + } \ +} while (0) + +#define UPT_SET_SYSCALL_RETURN(regs, res) \ + SC_SET_SYSCALL_RETURN((regs)->sc, (res)) +#define UPT_RESTART_SYSCALL(regs) SC_RESTART_SYSCALL((regs)->sc) +#define UPT_ORIG_SYSCALL(regs) UPT_FP(regs) +#define UPT_SYSCALL_NR(regs) ((regs)->syscall) +#define UPT_SYSCALL_RET(regs) UPT_RETPC(regs) + +#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 dontdiff linux-2.4.18-orig/arch/um/include/sysdep-sparc64/ptrace_user.h linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/ptrace_user.h --- linux-2.4.18-orig/arch/um/include/sysdep-sparc64/ptrace_user.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/ptrace_user.h Sat May 10 16:42:07 2003 @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2003 Shanti Katta (katta@csee.wvu.edu) + * Licensed under the GPL + */ + +#ifndef __SYSDEP_SPARC64_PTRACE_USER_H__ +#define __SYSDEP_SPARC64_PTRACE_USER_H__ + +#include + +#define PT_OFFSET(r) ((r) * sizeof(long)) + +#define PT_SYSCALL_NR(regs) ((regs)[PT_FP]) +#define PT_SYSCALL_NR_OFFSET PT_OFFSET(PT_FP) + +#define PT_SYSCALL_ARG1_OFFSET PT_OFFSET(PT_I0) +#define PT_SYSCALL_ARG2_OFFSET PT_OFFSET(PT_I1) +#define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(PT_I2) +#define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(PT_I3) +#define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(PT_I4) + +#define PT_SYSCALL_RET_OFFSET PT_OFFSET(PT_I7) + +#define PT_IP_OFFSET PT_OFFSET(PT_PC) +#define PT_IP(regs) ((regs)[PT_PC]) +#define PT_SP(regs) ((regs)[PT_PSR]) + +#ifndef FRAME_SIZE +#define FRAME_SIZE (32) +#endif +#define FRAME_SIZE_OFFSET (12 * sizeof(unsigned long)) /* 12 stands for PTRACE_GETREGS in SPARC32 */ + +#define FP_FRAME_SIZE (32) /* Sparc64 defines 32 double-precision floating point registers */ + +#ifdef PTRACE_GETREGS +#define UM_HAVE_GETREGS +#endif + +#ifdef PTRACE_SETREGS +#define UM_HAVE_SETREGS +#endif + +#ifdef PTRACE_GETFPREGS +#define UM_HAVE_GETFPREGS +#endif + +#ifdef PTRACE_SETFPREGS +#define UM_HAVE_SETFPREGS +#endif + +#endif diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/include/sysdep-sparc64/sc.h linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/sc.h --- linux-2.4.18-orig/arch/um/include/sysdep-sparc64/sc.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/sc.h Sat May 10 16:00:21 2003 @@ -0,0 +1,10 @@ +#define SC_IP(sc) *((unsigned long *) &(((char *) (sc))[4])) +#define SC_SP(sc) *((unsigned long *) &(((char *) (sc))[0])) +#define SC_FP(sc) *((unsigned long *) &(((char *) (sc))[72])) +#define SC_UREG_I0(sc) *((unsigned long *) &(((char *) (sc))[48])) +#define SC_UREG_I1(sc) *((unsigned long *) &(((char *) (sc))[52])) +#define SC_UREG_I2(sc) *((unsigned long *) &(((char *) (sc))[56])) +#define SC_UREG_I3(sc) *((unsigned long *) &(((char *) (sc))[60])) +#define SC_UREG_I4(sc) *((unsigned long *) &(((char *) (sc))[64])) +#define SC_UREG_I5(sc) *((unsigned long *) &(((char *) (sc))[68])) +#define SC_RETPC(sc) *((unsigned long *) &(((char *) (sc))[76])) diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/include/sysdep-sparc64/sigcontext.h linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/sigcontext.h --- linux-2.4.18-orig/arch/um/include/sysdep-sparc64/sigcontext.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/sigcontext.h Sat May 10 16:42:37 2003 @@ -0,0 +1,42 @@ +/* + Copyright (C) 2003 Shanti Katta(katta@csee.wvu.edu) + Copyright (C) 2001 Iain Young(iain@g7iii.demon.co.uk) + Copyright (C) 2000 Jeff Dike(jdike@karaya.com) + Licensed under the GPL +*/ + +/* Again, stolen from the IA64 placekeeper. then nicked bits from + the PPC and i386 ports +*/ + +#ifndef __SYS_SIGCONTEXT_SPARC64_H +#define __SYS_SIGCONTEXT_SPARC64_H + +#define SC_RESTART_SYSCALL(sc) (SC_IP(sc) -= 4) +#define SC_SET_SYSCALL_RETURN(sc, result) do SC_FP(sc) = (result) ; while(0) + +#define SC_FAULT_ADDR(sc) SC_UREG_I1(sc) +#define SC_FAULT_WRITE(sc) (SC_UREG_I2(sc) & 2) + +#define SC_START_SYSCALL(sc) do ; while(0) + +#define SEGV_IS_FIXABLE(sc) ((SC_UREG_I3(sc) == 13) || (SC_UREG_I3(sc) == 14)) + +static inline void sc_to_regs(struct uml_pt_regs *regs, struct sigcontext *sc, unsigned long syscall) +{ + regs->syscall = syscall; + regs->args[0] = SC_UREG_I0(sc); + regs->args[1] = SC_UREG_I1(sc); + regs->args[2] = SC_UREG_I2(sc); + regs->args[3] = SC_UREG_I3(sc); + regs->args[4] = SC_UREG_I4(sc); + regs->args[5] = SC_UREG_I5(sc); +} + +extern unsigned long *sc_sigmask(void *sc_ptr); +extern int sc_get_fpregs(unsigned long buf, void *sc_ptr); + +#endif + + + diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/include/sysdep-sparc64/syscalls.h linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/syscalls.h --- linux-2.4.18-orig/arch/um/include/sysdep-sparc64/syscalls.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/include/sysdep-sparc64/syscalls.h Sat May 10 16:42:52 2003 @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2001 Iain Young (iain@g7iii.demon.co.uk) + * Copyright (C) 2003 Shanti Katta (katta@csee.wvu.edu) + * Licensed under the GPL + */ + +/* Again, mostly nicked from Jeff's code, and ported to SPARC64 */ + +#ifndef __SYSDEP_SPARC64_SYSCALLS_H +#define __SYSDEP_SPARC64_SYSCALLS_H + +#include "asm/unistd.h" + +typedef long syscall_handler_t(struct pt_regs); + +#define EXECUTE_SYSCALL(syscall, regs) (*sys_call_table[syscall])(*regs); + +#define ARCH_SYSCALLS \ + [ 222 ] = sys_ni_syscall, + +#define LAST_ARCH_SYSCALL 222 + +#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 dontdiff linux-2.4.18-orig/arch/um/kernel/frame.c linux-2.4.18-sparc64/arch/um/kernel/frame.c --- linux-2.4.18-orig/arch/um/kernel/frame.c Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/arch/um/kernel/frame.c Sat May 10 16:00:21 2003 @@ -15,7 +15,7 @@ #include #include #include -#include + #include "sysdep/ptrace.h" #include "sysdep/sigcontext.h" #include "frame_user.h" @@ -91,12 +91,12 @@ /* The frame that we want is the top of the signal stack */ len = top - PT_SP(regs); - *data_out = malloc(len); + /**data_out = malloc(len); if(*data_out == NULL){ printf("capture_stack : malloc failed - errno = %d\n", errno); exit(1); } - memcpy(*data_out, (void *) PT_SP(regs), len); + memcpy(*data_out, (void *) PT_SP(regs), len);*/ return(len); } @@ -216,8 +216,7 @@ raw_sc.stack = sigstack; raw_sc.size = PAGE_SIZE; - signal_frame_sc.len = capture_stack(sc_child, &raw_sc, (void *) top, - sig_top, &signal_frame_sc.data); + signal_frame_sc.len = capture_stack(sc_child, &raw_sc, (void *) top, sig_top, &signal_frame_sc.data); /* These are the offsets within signal_frame_sc.data (counting from * the bottom) of sig, sc, SA_RESTORER, and the initial sp. diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/kernel/irq.c linux-2.4.18-sparc64/arch/um/kernel/irq.c --- linux-2.4.18-orig/arch/um/kernel/irq.c Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/arch/um/kernel/irq.c Sat May 10 16:00:21 2003 @@ -180,6 +180,8 @@ * * This function may be called from IRQ context. */ + +#undef disable_irq_nosync void inline disable_irq_nosync(unsigned int irq) { diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/kernel/process.c linux-2.4.18-sparc64/arch/um/kernel/process.c --- linux-2.4.18-orig/arch/um/kernel/process.c Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/arch/um/kernel/process.c Sat May 10 16:00:21 2003 @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #ifdef PROFILING diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/kernel/signal_kern.c linux-2.4.18-sparc64/arch/um/kernel/signal_kern.c --- linux-2.4.18-orig/arch/um/kernel/signal_kern.c Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/arch/um/kernel/signal_kern.c Sat May 10 16:00:21 2003 @@ -98,14 +98,14 @@ if (ka->sa.sa_flags & SA_ONESHOT) ka->sa.sa_handler = SIG_DFL; - if (!(ka->sa.sa_flags & SA_NODEFER)) { + /*if (!(ka->sa.sa_flags & SA_NODEFER)) { spin_lock_irq(¤t->sigmask_lock); sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); sigaddset(¤t->blocked, signr); recalc_sigpending(current); spin_unlock_irq(¤t->sigmask_lock); - } + }*/ sp = PT_REGS_SP(regs); @@ -116,8 +116,8 @@ sp -= 4 * sizeof(void *); - if (ka->sa.sa_flags & SA_RESTORER) restorer = ka->sa.sa_restorer; - else restorer = NULL; + /*if (ka->sa.sa_flags & SA_RESTORER) restorer = ka->sa.sa_restorer; + else restorer = NULL;*/ if(ka->sa.sa_flags & SA_SIGINFO) err = setup_signal_stack_si(sp, signr, (unsigned long) handler, diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/kernel/sys_call_table.c linux-2.4.18-sparc64/arch/um/kernel/sys_call_table.c --- linux-2.4.18-orig/arch/um/kernel/sys_call_table.c Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/arch/um/kernel/sys_call_table.c Sat May 10 16:00:21 2003 @@ -84,7 +84,7 @@ extern syscall_handler_t sys_getgroups16; extern syscall_handler_t sys_setgroups16; extern syscall_handler_t sys_symlink; -extern syscall_handler_t sys_lstat; +/*extern syscall_handler_t sys_lstat;*/ extern syscall_handler_t sys_readlink; extern syscall_handler_t sys_uselib; extern syscall_handler_t sys_swapon; @@ -174,7 +174,7 @@ extern syscall_handler_t sys_getresgid16; extern syscall_handler_t sys_prctl; extern syscall_handler_t sys_ni_syscall; -extern syscall_handler_t sys_rt_sigaction; +/*extern syscall_handler_t sys_rt_sigaction;*/ extern syscall_handler_t sys_rt_sigprocmask; extern syscall_handler_t sys_rt_sigpending; extern syscall_handler_t sys_rt_sigtimedwait; @@ -259,8 +259,8 @@ [ __NR_mknod ] = sys_mknod, [ __NR_chmod ] = sys_chmod, [ __NR_lchown ] = sys_lchown16, - [ __NR_break ] = sys_ni_syscall, - [ __NR_oldstat ] = sys_stat, + /*[ __NR_break ] = sys_ni_syscall,*/ + /*[ __NR_oldstat ] = sys_stat,*/ [ __NR_lseek ] = sys_lseek, [ __NR_getpid ] = sys_getpid, [ __NR_mount ] = um_mount, @@ -270,14 +270,14 @@ [ __NR_stime ] = um_stime, [ __NR_ptrace ] = sys_ptrace, [ __NR_alarm ] = sys_alarm, - [ __NR_oldfstat ] = sys_fstat, + /*[ __NR_oldfstat ] = sys_fstat,*/ [ __NR_pause ] = sys_pause, [ __NR_utime ] = sys_utime, - [ __NR_stty ] = sys_ni_syscall, - [ __NR_gtty ] = sys_ni_syscall, + /*[ __NR_stty ] = sys_ni_syscall, + [ __NR_gtty ] = sys_ni_syscall,*/ [ __NR_access ] = sys_access, [ __NR_nice ] = sys_nice, - [ __NR_ftime ] = sys_ni_syscall, + /*[ __NR_ftime ] = sys_ni_syscall,*/ [ __NR_sync ] = sys_sync, [ __NR_kill ] = sys_kill, [ __NR_rename ] = sys_rename, @@ -288,7 +288,7 @@ [ __NR_dup ] = (syscall_handler_t *) sys_dup, [ __NR_pipe ] = sys_pipe, [ __NR_times ] = sys_times, - [ __NR_prof ] = sys_ni_syscall, + /*[ __NR_prof ] = sys_ni_syscall,*/ [ __NR_brk ] = sys_brk, [ __NR_setgid ] = sys_setgid16, [ __NR_getgid ] = sys_getgid16, @@ -297,13 +297,13 @@ [ __NR_getegid ] = sys_getegid16, [ __NR_acct ] = sys_acct, [ __NR_umount2 ] = sys_umount, - [ __NR_lock ] = sys_ni_syscall, + /*[ __NR_lock ] = sys_ni_syscall,*/ [ __NR_ioctl ] = sys_ioctl, [ __NR_fcntl ] = sys_fcntl, - [ __NR_mpx ] = sys_ni_syscall, + /*[ __NR_mpx ] = sys_ni_syscall,*/ [ __NR_setpgid ] = sys_setpgid, - [ __NR_ulimit ] = sys_ni_syscall, - [ __NR_oldolduname ] = sys_olduname, + /*[ __NR_ulimit ] = sys_ni_syscall, + [ __NR_oldolduname ] = sys_olduname,*/ [ __NR_umask ] = sys_umask, [ __NR_chroot ] = sys_chroot, [ __NR_ustat ] = sys_ustat, @@ -327,7 +327,7 @@ [ __NR_getgroups ] = sys_getgroups16, [ __NR_setgroups ] = sys_setgroups16, [ __NR_symlink ] = sys_symlink, - [ __NR_oldlstat ] = sys_lstat, + /*[ __NR_oldlstat ] = sys_lstat,*/ [ __NR_readlink ] = sys_readlink, [ __NR_uselib ] = sys_uselib, [ __NR_swapon ] = sys_swapon, @@ -340,10 +340,10 @@ [ __NR_fchown ] = sys_fchown16, [ __NR_getpriority ] = sys_getpriority, [ __NR_setpriority ] = sys_setpriority, - [ __NR_profil ] = sys_ni_syscall, + /*[ __NR_profil ] = sys_ni_syscall,*/ [ __NR_statfs ] = sys_statfs, [ __NR_fstatfs ] = sys_fstatfs, - [ __NR_ioperm ] = sys_ni_syscall, + /*[ __NR_ioperm ] = sys_ni_syscall,*/ [ __NR_socketcall ] = sys_socketcall, [ __NR_syslog ] = sys_syslog, [ __NR_setitimer ] = sys_setitimer, @@ -351,10 +351,10 @@ [ __NR_stat ] = sys_newstat, [ __NR_lstat ] = sys_newlstat, [ __NR_fstat ] = sys_newfstat, - [ __NR_olduname ] = sys_uname, - [ __NR_iopl ] = sys_ni_syscall, + /*[ __NR_olduname ] = sys_uname, + [ __NR_iopl ] = sys_ni_syscall,*/ [ __NR_vhangup ] = sys_vhangup, - [ __NR_idle ] = sys_ni_syscall, + /*[ __NR_idle ] = sys_ni_syscall,*/ [ __NR_wait4 ] = (syscall_handler_t *) sys_wait4, [ __NR_swapoff ] = sys_swapoff, [ __NR_sysinfo ] = sys_sysinfo, @@ -406,7 +406,7 @@ [ __NR_mremap ] = sys_mremap, [ __NR_setresuid ] = sys_setresuid16, [ __NR_getresuid ] = sys_getresuid16, - [ __NR_vm86 ] = sys_ni_syscall, + /*[ __NR_vm86 ] = sys_ni_syscall,*/ [ __NR_query_module ] = sys_query_module, [ __NR_poll ] = sys_poll, [ __NR_nfsservctl ] = sys_nfsservctl, @@ -414,7 +414,7 @@ [ __NR_getresgid ] = sys_getresgid16, [ __NR_prctl ] = sys_prctl, [ __NR_rt_sigreturn ] = sys_rt_sigreturn, - [ __NR_rt_sigaction ] = sys_rt_sigaction, + /*[ __NR_rt_sigaction ] = sys_rt_sigaction,*/ [ __NR_rt_sigprocmask ] = sys_rt_sigprocmask, [ __NR_rt_sigpending ] = sys_rt_sigpending, [ __NR_rt_sigtimedwait ] = sys_rt_sigtimedwait, @@ -428,22 +428,22 @@ [ __NR_capset ] = sys_capset, [ __NR_sigaltstack ] = sys_sigaltstack, [ __NR_sendfile ] = sys_sendfile, - [ __NR_getpmsg ] = sys_ni_syscall, - [ __NR_putpmsg ] = sys_ni_syscall, + /*[ __NR_getpmsg ] = sys_ni_syscall, + [ __NR_putpmsg ] = sys_ni_syscall,*/ [ __NR_vfork ] = sys_vfork, - [ __NR_ugetrlimit ] = sys_getrlimit, + /*[ __NR_ugetrlimit ] = sys_getrlimit, [ __NR_mmap2 ] = sys_mmap2, [ __NR_truncate64 ] = sys_truncate64, [ __NR_ftruncate64 ] = sys_ftruncate64, [ __NR_stat64 ] = sys_stat64, [ __NR_lstat64 ] = sys_lstat64, [ __NR_fstat64 ] = sys_fstat64, - [ __NR_fcntl64 ] = sys_fcntl64, + [ __NR_fcntl64 ] = sys_fcntl64,*/ [ __NR_getdents64 ] = sys_getdents64, - [ __NR_security ] = sys_ni_syscall, + /*[ __NR_security ] = sys_ni_syscall,*/ [ __NR_gettid ] = sys_gettid, [ __NR_readahead ] = sys_readahead, - [ __NR_setxattr ] = sys_ni_syscall, + /*[ __NR_setxattr ] = sys_ni_syscall, [ __NR_lsetxattr ] = sys_ni_syscall, [ __NR_fsetxattr ] = sys_ni_syscall, [ __NR_getxattr ] = sys_ni_syscall, @@ -454,7 +454,7 @@ [ __NR_flistxattr ] = sys_ni_syscall, [ __NR_removexattr ] = sys_ni_syscall, [ __NR_lremovexattr ] = sys_ni_syscall, - [ __NR_fremovexattr ] = sys_ni_syscall, + [ __NR_fremovexattr ] = sys_ni_syscall,*/ ARCH_SYSCALLS [ LAST_SYSCALL + 1 ... NR_syscalls ] = diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/kernel/syscall_kern.c linux-2.4.18-sparc64/arch/um/kernel/syscall_kern.c --- linux-2.4.18-orig/arch/um/kernel/syscall_kern.c Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/arch/um/kernel/syscall_kern.c Sat May 10 16:00:21 2003 @@ -321,11 +321,11 @@ sizeof(struct utimbuf))); } -static int check_oldstat(struct pt_regs *regs) +/*static int check_oldstat(struct pt_regs *regs) { return(check_area((void *) regs->regs.args[2], sizeof(struct __old_kernel_stat))); -} +}*/ static int check_stat(struct pt_regs *regs) { @@ -369,12 +369,12 @@ [ __NR_chown ] = { 1, NULL }, [ __NR_lchown ] = { 1, NULL }, [ __NR_utime ] = { 1, check_utime }, - [ __NR_oldlstat ] = { 1, check_oldstat }, - [ __NR_oldstat ] = { 1, check_oldstat }, + /*[ __NR_oldlstat ] = { 1, check_oldstat },*/ + /*[ __NR_oldstat ] = { 1, check_oldstat },*/ [ __NR_stat ] = { 1, check_stat }, - [ __NR_lstat ] = { 1, check_stat }, - [ __NR_stat64 ] = { 1, check_stat64 }, - [ __NR_lstat64 ] = { 1, check_stat64 }, + [ __NR_lstat ] = { 1, check_stat } + /*[ __NR_stat64 ] = { 1, check_stat64 },*/ + /*[ __NR_lstat64 ] = { 1, check_stat64 }*/ }; /* sys_utimes */ diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/kernel/time_kern.c linux-2.4.18-sparc64/arch/um/kernel/time_kern.c --- linux-2.4.18-orig/arch/um/kernel/time_kern.c Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/arch/um/kernel/time_kern.c Sat May 10 16:00:21 2003 @@ -15,6 +15,7 @@ #include "asm/current.h" #include "kern_util.h" #include "user_util.h" +#include "asm/irq.h" extern rwlock_t xtime_lock; @@ -85,19 +86,20 @@ void __delay(um_udelay_t time) { - /* Stolen from the i386 __loop_delay */ - int d0; - __asm__ __volatile__( - "\tjmp 1f\n" - ".align 16\n" - "1:\tjmp 2f\n" - ".align 16\n" - "2:\tdecl %0\n\tjns 2b" - :"=&a" (d0) - :"0" (time)); + /* Stolen from sparc64 __delay */ + __asm__ __volatile__( + " b,pt %%xcc, 1f\n" + " cmp %0, 0\n" + " .align 32\n" + "1:\n" + " bne,pt %%xcc, 1b\n" + " subcc %0, 1, %0\n" + : "=&r" (time) + : "0" (time) + : "cc"); } -void __udelay(um_udelay_t usecs) +void __udelay(um_udelay_t usecs, um_udelay_t lps) { int i, n; diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/kernel/trap_user.c linux-2.4.18-sparc64/arch/um/kernel/trap_user.c --- linux-2.4.18-orig/arch/um/kernel/trap_user.c Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/arch/um/kernel/trap_user.c Sat May 10 16:00:21 2003 @@ -130,7 +130,7 @@ "PTRACE_SYSCALL pid %d, errno = %d\n", pid, sig); break; - default: + default: tracer_panic("sleeping process %d got unexpected " "signal : %d\n", pid, sig); break; @@ -185,7 +185,7 @@ tracing_pid = getpid(); printk("tracing thread pid = %d\n", tracing_pid); - pid = clone(signal_tramp, sp, CLONE_FILES | SIGCHLD, init_proc); + pid = clone(signal_tramp, sp, CLONE_FILES | SIGCHLD | CLONE_VM, init_proc); n = waitpid(pid, &status, WUNTRACED); if(n < 0){ printf("waitpid on idle thread failed, errno = %d\n", errno); @@ -222,7 +222,7 @@ int cont = 0; if(WIFEXITED(status) || WIFSIGNALED(status)) - debugger_pid = -1; + debugger_pid = -1; /* XXX Figure out how to deal with gdb and SMP */ else cont = debugger_signal(status, cpu_tasks[0].pid); if(cont == PTRACE_SYSCALL) strace = 1; @@ -239,8 +239,7 @@ else if(WIFSIGNALED(status)){ sig = WTERMSIG(status); if(sig != 9){ - printk("Child %d exited with signal %d\n", pid, - sig); + /*printk("Child %d exited with signal %d\n", pid, sig);*/ } } else if(WIFSTOPPED(status)){ @@ -260,7 +259,6 @@ eip = ptrace(PTRACE_PEEKUSER, pid, PT_IP_OFFSET, 0); signal_record[signal_index].addr = eip; signal_record[signal_index++].signal = sig; - proc_id = pid_to_processor_id(pid); if(proc_id == -1){ sleeping_process_signal(pid, sig); @@ -347,7 +345,7 @@ tracer_panic("ptrace failed to continue " "process - errno = %d\n", errno); - } + } } } return(0); diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/link.ld.in linux-2.4.18-sparc64/arch/um/link.ld.in --- linux-2.4.18-orig/arch/um/link.ld.in Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/arch/um/link.ld.in Sat May 10 16:00:21 2003 @@ -1,10 +1,9 @@ -OUTPUT_FORMAT("elf32-ELF_SUBARCH") -OUTPUT_ARCH(ELF_SUBARCH) +OUTPUT_FORMAT("ELF_SUBARCH") +OUTPUT_ARCH(sparc) ENTRY(_start) SECTIONS { - . = START() + SIZEOF_HEADERS; . = ALIGN(4096); .thread_private : { diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/Makefile linux-2.4.18-sparc64/arch/um/sys-sparc64/Makefile --- linux-2.4.18-orig/arch/um/sys-sparc64/Makefile Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/Makefile Sat May 10 16:00:21 2003 @@ -0,0 +1,55 @@ +OBJ = sys.o + +OBJS = ptrace.o ptrace_user.o semaphore.o sigcontext.o \ + atomic.o bitops.o strncmp.o memstuff.o misc.o + +ARCH_DIR := arch/um +ARCH_INCLUDE := $(TOPDIR)/$(ARCH_DIR)/include + +EXTRA_AFLAGS := -I$(ARCH_INCLUDE) + +USER_OBJS = ptrace_user.o sigcontext.o memstuff.o misc.o + +SYMLINKS = semaphore.c atomic.S strncmp.S bitops.S + +all: $(OBJ) + +$(OBJ): $(OBJS) + rm -f $@ + $(LD) $(LINKFLAGS) --start-group $^ --end-group -o $@ + +$(USER_OBJS) : %.o: %.c + $(CC) $(CFLAGS_$@) $(USER_CFLAGS) -c -o $@ $< + +atomic.S bitops.S strncmp.S bitops.S: + rm -f $@ + ln -s $(TOPDIR)/arch/sparc64/lib/$@ $@ + +AFLAGS += -mcpu=ultrasparc -Wa,--undeclared-regs + +semaphore.c: + rm -f $@ + ln -s $(TOPDIR)/arch/sparc64/kernel/$@ $@ + +.S.o: + $(CC) $(AFLAGS) $(EXTRA_AFLAGS) -ansi -c $< -o $*.o + +clean: + rm -f $(OBJS) + rm -f $(SYMLINKS) + +fastdep: + +archmrproper: + rm -f $(SYMLINKS) +archclean: + rm -f link.ld + @$(MAKEBOOT) clean + +archdep: + @$(MAKEBOOT) dep + +modules: + +include $(TOPDIR)/Rules.make + diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/atomic.S linux-2.4.18-sparc64/arch/um/sys-sparc64/atomic.S --- linux-2.4.18-orig/arch/um/sys-sparc64/atomic.S Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/atomic.S Sat May 10 16:00:12 2003 @@ -0,0 +1,36 @@ +/* $Id: atomic.S,v 1.4 2001/11/18 00:12:56 davem Exp $ + * atomic.S: These things are too big to do inline. + * + * Copyright (C) 1999 David S. Miller (davem@redhat.com) + */ + +#include + + .text + .align 64 + + .globl atomic_impl_begin, atomic_impl_end + + .globl __atomic_add +atomic_impl_begin: +__atomic_add: /* %o0 = increment, %o1 = atomic_ptr */ + lduw [%o1], %g5 + add %g5, %o0, %g7 + cas [%o1], %g5, %g7 + cmp %g5, %g7 + bne,pn %icc, __atomic_add + membar #StoreLoad | #StoreStore + retl + add %g7, %o0, %o0 + + .globl __atomic_sub +__atomic_sub: /* %o0 = increment, %o1 = atomic_ptr */ + lduw [%o1], %g5 + sub %g5, %o0, %g7 + cas [%o1], %g5, %g7 + cmp %g5, %g7 + bne,pn %icc, __atomic_sub + membar #StoreLoad | #StoreStore + retl + sub %g7, %o0, %o0 +atomic_impl_end: diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/bitops.S linux-2.4.18-sparc64/arch/um/sys-sparc64/bitops.S --- linux-2.4.18-orig/arch/um/sys-sparc64/bitops.S Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/bitops.S Sat May 10 16:00:12 2003 @@ -0,0 +1,110 @@ +/* $Id: bitops.S,v 1.3 2001/11/18 00:12:56 davem Exp $ + * bitops.S: Sparc64 atomic bit operations. + * + * Copyright (C) 2000 David S. Miller (davem@redhat.com) + */ + +#include + + .text + .align 64 + .globl __bitops_begin +__bitops_begin: + + .globl ___test_and_set_bit +___test_and_set_bit: /* %o0=nr, %o1=addr */ + srlx %o0, 6, %g1 + mov 1, %g5 + sllx %g1, 3, %g3 + and %o0, 63, %g2 + sllx %g5, %g2, %g5 + add %o1, %g3, %o1 + ldx [%o1], %g7 +1: andcc %g7, %g5, %o0 + bne,pn %xcc, 2f + xor %g7, %g5, %g1 + casx [%o1], %g7, %g1 + cmp %g7, %g1 + bne,a,pn %xcc, 1b + ldx [%o1], %g7 +2: retl + membar #StoreLoad | #StoreStore + + .globl ___test_and_clear_bit +___test_and_clear_bit: /* %o0=nr, %o1=addr */ + srlx %o0, 6, %g1 + mov 1, %g5 + sllx %g1, 3, %g3 + and %o0, 63, %g2 + sllx %g5, %g2, %g5 + add %o1, %g3, %o1 + ldx [%o1], %g7 +1: andcc %g7, %g5, %o0 + be,pn %xcc, 2f + xor %g7, %g5, %g1 + casx [%o1], %g7, %g1 + cmp %g7, %g1 + bne,a,pn %xcc, 1b + ldx [%o1], %g7 +2: retl + membar #StoreLoad | #StoreStore + + .globl ___test_and_change_bit +___test_and_change_bit: /* %o0=nr, %o1=addr */ + srlx %o0, 6, %g1 + mov 1, %g5 + sllx %g1, 3, %g3 + and %o0, 63, %g2 + sllx %g5, %g2, %g5 + add %o1, %g3, %o1 + ldx [%o1], %g7 +1: and %g7, %g5, %o0 + xor %g7, %g5, %g1 + casx [%o1], %g7, %g1 + cmp %g7, %g1 + bne,a,pn %xcc, 1b + ldx [%o1], %g7 +2: retl + membar #StoreLoad | #StoreStore + nop + + .globl ___test_and_set_le_bit +___test_and_set_le_bit: /* %o0=nr, %o1=addr */ + srlx %o0, 5, %g1 + mov 1, %g5 + sllx %g1, 2, %g3 + and %o0, 31, %g2 + sllx %g5, %g2, %g5 + add %o1, %g3, %o1 + lduwa [%o1] ASI_PL, %g7 +1: andcc %g7, %g5, %o0 + bne,pn %icc, 2f + xor %g7, %g5, %g1 + casa [%o1] ASI_PL, %g7, %g1 + cmp %g7, %g1 + bne,a,pn %icc, 1b + lduwa [%o1] ASI_PL, %g7 +2: retl + membar #StoreLoad | #StoreStore + + .globl ___test_and_clear_le_bit +___test_and_clear_le_bit: /* %o0=nr, %o1=addr */ + srlx %o0, 5, %g1 + mov 1, %g5 + sllx %g1, 2, %g3 + and %o0, 31, %g2 + sllx %g5, %g2, %g5 + add %o1, %g3, %o1 + lduwa [%o1] ASI_PL, %g7 +1: andcc %g7, %g5, %o0 + be,pn %icc, 2f + xor %g7, %g5, %g1 + casa [%o1] ASI_PL, %g7, %g1 + cmp %g7, %g1 + bne,a,pn %icc, 1b + lduwa [%o1] ASI_PL, %g7 +2: retl + membar #StoreLoad | #StoreStore + + .globl __bitops_end +__bitops_end: diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/checksum.S linux-2.4.18-sparc64/arch/um/sys-sparc64/checksum.S --- linux-2.4.18-orig/arch/um/sys-sparc64/checksum.S Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/checksum.S Sat May 10 16:00:12 2003 @@ -0,0 +1,513 @@ +/* checksum.S: Sparc V9 optimized checksum code. + * + * Copyright(C) 1995 Linus Torvalds + * Copyright(C) 1995 Miguel de Icaza + * Copyright(C) 1996, 2000 David S. Miller + * Copyright(C) 1997 Jakub Jelinek + * + * derived from: + * Linux/Alpha checksum c-code + * Linux/ix86 inline checksum assembly + * RFC1071 Computing the Internet Checksum (esp. Jacobsons m68k code) + * David Mosberger-Tang for optimized reference c-code + * BSD4.4 portable checksum routine + */ + +#include +#include +#include +#include +#include +#include + + /* The problem with the "add with carry" instructions on Ultra + * are two fold. Firstly, they cannot pair with jack shit, + * and also they only add in the 32-bit carry condition bit + * into the accumulated sum. The following is much better. + * For larger chunks we use VIS code, which is faster ;) + */ + +#define src o0 +#define dst o1 +#define len o2 +#define sum o3 + + .text + /* I think I have an erection... Once _AGAIN_ the SunSoft + * engineers are caught asleep at the keyboard, tsk tsk... + */ + +#define CSUMCOPY_LASTCHUNK(off, t0, t1) \ + ldxa [%src - off - 0x08] %asi, t0; \ + ldxa [%src - off - 0x00] %asi, t1; \ + nop; nop; \ + addcc t0, %sum, %sum; \ + stw t0, [%dst - off - 0x04]; \ + srlx t0, 32, t0; \ + bcc,pt %xcc, 51f; \ + stw t0, [%dst - off - 0x08]; \ + add %sum, 1, %sum; \ +51: addcc t1, %sum, %sum; \ + stw t1, [%dst - off + 0x04]; \ + srlx t1, 32, t1; \ + bcc,pt %xcc, 52f; \ + stw t1, [%dst - off - 0x00]; \ + add %sum, 1, %sum; \ +52: + +cpc_start: +cc_end_cruft: + andcc %g7, 8, %g0 ! IEU1 Group + be,pn %icc, 1f ! CTI + and %g7, 4, %g5 ! IEU0 + ldxa [%src + 0x00] %asi, %g2 ! Load Group + add %dst, 8, %dst ! IEU0 + add %src, 8, %src ! IEU1 + addcc %g2, %sum, %sum ! IEU1 Group + 2 bubbles + stw %g2, [%dst - 0x04] ! Store + srlx %g2, 32, %g2 ! IEU0 + bcc,pt %xcc, 1f ! CTI Group + stw %g2, [%dst - 0x08] ! Store + add %sum, 1, %sum ! IEU0 +1: brz,pt %g5, 1f ! CTI Group + clr %g2 ! IEU0 + lduwa [%src + 0x00] %asi, %g2 ! Load + add %dst, 4, %dst ! IEU0 Group + add %src, 4, %src ! IEU1 + stw %g2, [%dst - 0x04] ! Store Group + 2 bubbles + sllx %g2, 32, %g2 ! IEU0 +1: andcc %g7, 2, %g0 ! IEU1 + be,pn %icc, 1f ! CTI Group + clr %o4 ! IEU1 + lduha [%src + 0x00] %asi, %o4 ! Load + add %src, 2, %src ! IEU0 Group + add %dst, 2, %dst ! IEU1 + sth %o4, [%dst - 0x2] ! Store Group + 2 bubbles + sll %o4, 16, %o4 ! IEU0 +1: andcc %g7, 1, %g0 ! IEU1 + be,pn %icc, 1f ! CTI Group + clr %o5 ! IEU0 + lduba [%src + 0x00] %asi, %o5 ! Load + stb %o5, [%dst + 0x00] ! Store Group + 2 bubbles + sll %o5, 8, %o5 ! IEU0 +1: or %g2, %o4, %o4 ! IEU1 + or %o5, %o4, %o4 ! IEU0 Group + addcc %o4, %sum, %sum ! IEU1 + bcc,pt %xcc, ccfold ! CTI + sethi %uhi(PAGE_OFFSET), %g4 ! IEU0 Group + b,pt %xcc, ccfold ! CTI + add %sum, 1, %sum ! IEU1 + +cc_fixit: + cmp %len, 6 ! IEU1 Group + bl,a,pn %icc, ccte ! CTI + andcc %len, 0xf, %g7 ! IEU1 Group + andcc %src, 2, %g0 ! IEU1 Group + be,pn %icc, 1f ! CTI + andcc %src, 0x4, %g0 ! IEU1 Group + lduha [%src + 0x00] %asi, %g4 ! Load + sub %len, 2, %len ! IEU0 + add %src, 2, %src ! IEU0 Group + add %dst, 2, %dst ! IEU1 + sll %g4, 16, %g3 ! IEU0 Group + 1 bubble + addcc %g3, %sum, %sum ! IEU1 + bcc,pt %xcc, 0f ! CTI + srl %sum, 16, %g3 ! IEU0 Group + add %g3, 1, %g3 ! IEU0 4 clocks (mispredict) +0: andcc %src, 0x4, %g0 ! IEU1 Group + sth %g4, [%dst - 0x2] ! Store + sll %sum, 16, %sum ! IEU0 + sll %g3, 16, %g3 ! IEU0 Group + srl %sum, 16, %sum ! IEU0 Group + or %g3, %sum, %sum ! IEU0 Group (regdep) +1: be,pt %icc, ccmerge ! CTI + andcc %len, 0xf0, %g1 ! IEU1 + lduwa [%src + 0x00] %asi, %g4 ! Load Group + sub %len, 4, %len ! IEU0 + add %src, 4, %src ! IEU1 + add %dst, 4, %dst ! IEU0 Group + addcc %g4, %sum, %sum ! IEU1 Group + 1 bubble + stw %g4, [%dst - 0x4] ! Store + bcc,pt %xcc, ccmerge ! CTI + andcc %len, 0xf0, %g1 ! IEU1 Group + b,pt %xcc, ccmerge ! CTI 4 clocks (mispredict) + add %sum, 1, %sum ! IEU0 + + .align 32 + .globl csum_partial_copy_sparc64 +csum_partial_copy_sparc64: /* %o0=src, %o1=dest, %o2=len, %o3=sum */ + xorcc %src, %dst, %o4 ! IEU1 Group + srl %sum, 0, %sum ! IEU0 + andcc %o4, 3, %g0 ! IEU1 Group + srl %len, 0, %len ! IEU0 + bne,pn %icc, ccslow ! CTI + andcc %src, 1, %g0 ! IEU1 Group + bne,pn %icc, ccslow ! CTI + cmp %len, 256 ! IEU1 Group + bgeu,pt %icc, csum_partial_copy_vis ! CTI + andcc %src, 7, %g0 ! IEU1 Group + bne,pn %icc, cc_fixit ! CTI + andcc %len, 0xf0, %g1 ! IEU1 Group +ccmerge:be,pn %icc, ccte ! CTI + andcc %len, 0xf, %g7 ! IEU1 Group + sll %g1, 2, %o4 ! IEU0 +13: sethi %hi(12f), %o5 ! IEU0 Group + add %src, %g1, %src ! IEU1 + sub %o5, %o4, %o5 ! IEU0 Group + jmpl %o5 + %lo(12f), %g0 ! CTI Group brk forced + add %dst, %g1, %dst ! IEU0 Group +cctbl: CSUMCOPY_LASTCHUNK(0xe8,%g2,%g3) + CSUMCOPY_LASTCHUNK(0xd8,%g2,%g3) + CSUMCOPY_LASTCHUNK(0xc8,%g2,%g3) + CSUMCOPY_LASTCHUNK(0xb8,%g2,%g3) + CSUMCOPY_LASTCHUNK(0xa8,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x98,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x88,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x78,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x68,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x58,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x48,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x38,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x28,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x18,%g2,%g3) + CSUMCOPY_LASTCHUNK(0x08,%g2,%g3) +12: + andcc %len, 0xf, %g7 ! IEU1 Group +ccte: bne,pn %icc, cc_end_cruft ! CTI + sethi %uhi(PAGE_OFFSET), %g4 ! IEU0 +ccfold: sllx %sum, 32, %o0 ! IEU0 Group + addcc %sum, %o0, %o0 ! IEU1 Group (regdep) + srlx %o0, 32, %o0 ! IEU0 Group (regdep) + bcs,a,pn %xcc, 1f ! CTI + add %o0, 1, %o0 ! IEU1 4 clocks (mispredict) +1: retl ! CTI Group brk forced + sllx %g4, 32, %g4 ! IEU0 Group + +ccslow: mov 0, %g5 + brlez,pn %len, 4f + andcc %src, 1, %o5 + be,a,pt %icc, 1f + srl %len, 1, %g7 + sub %len, 1, %len + lduba [%src] %asi, %g5 + add %src, 1, %src + stb %g5, [%dst] + srl %len, 1, %g7 + add %dst, 1, %dst +1: brz,a,pn %g7, 3f + andcc %len, 1, %g0 + andcc %src, 2, %g0 + be,a,pt %icc, 1f + srl %g7, 1, %g7 + lduha [%src] %asi, %o4 + sub %len, 2, %len + srl %o4, 8, %g2 + sub %g7, 1, %g7 + stb %g2, [%dst] + add %o4, %g5, %g5 + stb %o4, [%dst + 1] + add %src, 2, %src + srl %g7, 1, %g7 + add %dst, 2, %dst +1: brz,a,pn %g7, 2f + andcc %len, 2, %g0 + lduwa [%src] %asi, %o4 +5: srl %o4, 24, %g2 + srl %o4, 16, %g3 + stb %g2, [%dst] + srl %o4, 8, %g2 + stb %g3, [%dst + 1] + add %src, 4, %src + stb %g2, [%dst + 2] + addcc %o4, %g5, %g5 + stb %o4, [%dst + 3] + addc %g5, %g0, %g5 + add %dst, 4, %dst + subcc %g7, 1, %g7 + bne,a,pt %icc, 5b + lduwa [%src] %asi, %o4 + sll %g5, 16, %g2 + srl %g5, 16, %g5 + srl %g2, 16, %g2 + andcc %len, 2, %g0 + add %g2, %g5, %g5 +2: be,a,pt %icc, 3f + andcc %len, 1, %g0 + lduha [%src] %asi, %o4 + andcc %len, 1, %g0 + srl %o4, 8, %g2 + add %src, 2, %src + stb %g2, [%dst] + add %g5, %o4, %g5 + stb %o4, [%dst + 1] + add %dst, 2, %dst +3: be,a,pt %icc, 1f + sll %g5, 16, %o4 + lduba [%src] %asi, %g2 + sll %g2, 8, %o4 + stb %g2, [%dst] + add %g5, %o4, %g5 + sll %g5, 16, %o4 +1: addcc %o4, %g5, %g5 + srl %g5, 16, %o4 + addc %g0, %o4, %g5 + brz,pt %o5, 4f + srl %g5, 8, %o4 + and %g5, 0xff, %g2 + and %o4, 0xff, %o4 + sll %g2, 8, %g2 + or %g2, %o4, %g5 +4: addcc %sum, %g5, %sum + addc %g0, %sum, %o0 + retl + srl %o0, 0, %o0 +cpc_end: + + /* Now the version with userspace as the destination */ +#define CSUMCOPY_LASTCHUNK_USER(off, t0, t1) \ + ldx [%src - off - 0x08], t0; \ + ldx [%src - off - 0x00], t1; \ + nop; nop; \ + addcc t0, %sum, %sum; \ + stwa t0, [%dst - off - 0x04] %asi; \ + srlx t0, 32, t0; \ + bcc,pt %xcc, 51f; \ + stwa t0, [%dst - off - 0x08] %asi; \ + add %sum, 1, %sum; \ +51: addcc t1, %sum, %sum; \ + stwa t1, [%dst - off + 0x04] %asi; \ + srlx t1, 32, t1; \ + bcc,pt %xcc, 52f; \ + stwa t1, [%dst - off - 0x00] %asi; \ + add %sum, 1, %sum; \ +52: + +cpc_user_start: +cc_user_end_cruft: + andcc %g7, 8, %g0 ! IEU1 Group + be,pn %icc, 1f ! CTI + and %g7, 4, %g5 ! IEU0 + ldx [%src + 0x00], %g2 ! Load Group + add %dst, 8, %dst ! IEU0 + add %src, 8, %src ! IEU1 + addcc %g2, %sum, %sum ! IEU1 Group + 2 bubbles + stwa %g2, [%dst - 0x04] %asi ! Store + srlx %g2, 32, %g2 ! IEU0 + bcc,pt %xcc, 1f ! CTI Group + stwa %g2, [%dst - 0x08] %asi ! Store + add %sum, 1, %sum ! IEU0 +1: brz,pt %g5, 1f ! CTI Group + clr %g2 ! IEU0 + lduw [%src + 0x00], %g2 ! Load + add %dst, 4, %dst ! IEU0 Group + add %src, 4, %src ! IEU1 + stwa %g2, [%dst - 0x04] %asi ! Store Group + 2 bubbles + sllx %g2, 32, %g2 ! IEU0 +1: andcc %g7, 2, %g0 ! IEU1 + be,pn %icc, 1f ! CTI Group + clr %o4 ! IEU1 + lduh [%src + 0x00], %o4 ! Load + add %src, 2, %src ! IEU0 Group + add %dst, 2, %dst ! IEU1 + stha %o4, [%dst - 0x2] %asi ! Store Group + 2 bubbles + sll %o4, 16, %o4 ! IEU0 +1: andcc %g7, 1, %g0 ! IEU1 + be,pn %icc, 1f ! CTI Group + clr %o5 ! IEU0 + ldub [%src + 0x00], %o5 ! Load + stba %o5, [%dst + 0x00] %asi ! Store Group + 2 bubbles + sll %o5, 8, %o5 ! IEU0 +1: or %g2, %o4, %o4 ! IEU1 + or %o5, %o4, %o4 ! IEU0 Group + addcc %o4, %sum, %sum ! IEU1 + bcc,pt %xcc, ccuserfold ! CTI + sethi %uhi(PAGE_OFFSET), %g4 ! IEU0 Group + b,pt %xcc, ccuserfold ! CTI + add %sum, 1, %sum ! IEU1 + +cc_user_fixit: + cmp %len, 6 ! IEU1 Group + bl,a,pn %icc, ccuserte ! CTI + andcc %len, 0xf, %g7 ! IEU1 Group + andcc %src, 2, %g0 ! IEU1 Group + be,pn %icc, 1f ! CTI + andcc %src, 0x4, %g0 ! IEU1 Group + lduh [%src + 0x00], %g4 ! Load + sub %len, 2, %len ! IEU0 + add %src, 2, %src ! IEU0 Group + add %dst, 2, %dst ! IEU1 + sll %g4, 16, %g3 ! IEU0 Group + 1 bubble + addcc %g3, %sum, %sum ! IEU1 + bcc,pt %xcc, 0f ! CTI + srl %sum, 16, %g3 ! IEU0 Group + add %g3, 1, %g3 ! IEU0 4 clocks (mispredict) +0: andcc %src, 0x4, %g0 ! IEU1 Group + stha %g4, [%dst - 0x2] %asi ! Store + sll %sum, 16, %sum ! IEU0 + sll %g3, 16, %g3 ! IEU0 Group + srl %sum, 16, %sum ! IEU0 Group + or %g3, %sum, %sum ! IEU0 Group (regdep) +1: be,pt %icc, ccusermerge ! CTI + andcc %len, 0xf0, %g1 ! IEU1 + lduw [%src + 0x00], %g4 ! Load Group + sub %len, 4, %len ! IEU0 + add %src, 4, %src ! IEU1 + add %dst, 4, %dst ! IEU0 Group + addcc %g4, %sum, %sum ! IEU1 Group + 1 bubble + stwa %g4, [%dst - 0x4] %asi ! Store + bcc,pt %xcc, ccusermerge ! CTI + andcc %len, 0xf0, %g1 ! IEU1 Group + b,pt %xcc, ccusermerge ! CTI 4 clocks (mispredict) + add %sum, 1, %sum ! IEU0 + + .align 32 + .globl csum_partial_copy_user_sparc64 +csum_partial_copy_user_sparc64: /* %o0=src, %o1=dest, %o2=len, %o3=sum */ + xorcc %src, %dst, %o4 ! IEU1 Group + srl %sum, 0, %sum ! IEU0 + andcc %o4, 3, %g0 ! IEU1 Group + srl %len, 0, %len ! IEU0 + bne,pn %icc, ccuserslow ! CTI + andcc %src, 1, %g0 ! IEU1 Group + bne,pn %icc, ccuserslow ! CTI + cmp %len, 256 ! IEU1 Group + bgeu,pt %icc, csum_partial_copy_user_vis ! CTI + andcc %src, 7, %g0 ! IEU1 Group + bne,pn %icc, cc_user_fixit ! CTI + andcc %len, 0xf0, %g1 ! IEU1 Group +ccusermerge: + be,pn %icc, ccuserte ! CTI + andcc %len, 0xf, %g7 ! IEU1 Group + sll %g1, 2, %o4 ! IEU0 +13: sethi %hi(12f), %o5 ! IEU0 Group + add %src, %g1, %src ! IEU1 + sub %o5, %o4, %o5 ! IEU0 Group + jmpl %o5 + %lo(12f), %g0 ! CTI Group brk forced + add %dst, %g1, %dst ! IEU0 Group +ccusertbl: + CSUMCOPY_LASTCHUNK_USER(0xe8,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0xd8,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0xc8,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0xb8,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0xa8,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x98,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x88,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x78,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x68,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x58,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x48,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x38,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x28,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x18,%g2,%g3) + CSUMCOPY_LASTCHUNK_USER(0x08,%g2,%g3) +12: + andcc %len, 0xf, %g7 ! IEU1 Group +ccuserte: + bne,pn %icc, cc_user_end_cruft ! CTI + sethi %uhi(PAGE_OFFSET), %g4 ! IEU0 +ccuserfold: + sllx %sum, 32, %o0 ! IEU0 Group + addcc %sum, %o0, %o0 ! IEU1 Group (regdep) + srlx %o0, 32, %o0 ! IEU0 Group (regdep) + bcs,a,pn %xcc, 1f ! CTI + add %o0, 1, %o0 ! IEU1 4 clocks (mispredict) +1: retl ! CTI Group brk forced + sllx %g4, 32, %g4 ! IEU0 Group + +ccuserslow: + mov 0, %g5 + brlez,pn %len, 4f + andcc %src, 1, %o5 + be,a,pt %icc, 1f + srl %len, 1, %g7 + sub %len, 1, %len + ldub [%src], %g5 + add %src, 1, %src + stba %g5, [%dst] %asi + srl %len, 1, %g7 + add %dst, 1, %dst +1: brz,a,pn %g7, 3f + andcc %len, 1, %g0 + andcc %src, 2, %g0 + be,a,pt %icc, 1f + srl %g7, 1, %g7 + lduh [%src], %o4 + sub %len, 2, %len + srl %o4, 8, %g2 + sub %g7, 1, %g7 + stba %g2, [%dst] %asi + add %o4, %g5, %g5 + stba %o4, [%dst + 1] %asi + add %src, 2, %src + srl %g7, 1, %g7 + add %dst, 2, %dst +1: brz,a,pn %g7, 2f + andcc %len, 2, %g0 + lduw [%src], %o4 +5: srl %o4, 24, %g2 + srl %o4, 16, %g3 + stba %g2, [%dst] %asi + srl %o4, 8, %g2 + stba %g3, [%dst + 1] %asi + add %src, 4, %src + stba %g2, [%dst + 2] %asi + addcc %o4, %g5, %g5 + stba %o4, [%dst + 3] %asi + addc %g5, %g0, %g5 + add %dst, 4, %dst + subcc %g7, 1, %g7 + bne,a,pt %icc, 5b + lduw [%src], %o4 + sll %g5, 16, %g2 + srl %g5, 16, %g5 + srl %g2, 16, %g2 + andcc %len, 2, %g0 + add %g2, %g5, %g5 +2: be,a,pt %icc, 3f + andcc %len, 1, %g0 + lduh [%src], %o4 + andcc %len, 1, %g0 + srl %o4, 8, %g2 + add %src, 2, %src + stba %g2, [%dst] %asi + add %g5, %o4, %g5 + stba %o4, [%dst + 1] %asi + add %dst, 2, %dst +3: be,a,pt %icc, 1f + sll %g5, 16, %o4 + ldub [%src], %g2 + sll %g2, 8, %o4 + stba %g2, [%dst] %asi + add %g5, %o4, %g5 + sll %g5, 16, %o4 +1: addcc %o4, %g5, %g5 + srl %g5, 16, %o4 + addc %g0, %o4, %g5 + brz,pt %o5, 4f + srl %g5, 8, %o4 + and %g5, 0xff, %g2 + and %o4, 0xff, %o4 + sll %g2, 8, %g2 + or %g2, %o4, %g5 +4: addcc %sum, %g5, %sum + addc %g0, %sum, %o0 + retl + srl %o0, 0, %o0 +cpc_user_end: + + .globl cpc_handler +cpc_handler: + ldx [%sp + 0x7ff + 128], %g1 + ldub [%g6 + AOFF_task_thread + AOFF_thread_current_ds], %g3 + sub %g0, EFAULT, %g2 + brnz,a,pt %g1, 1f + st %g2, [%g1] +1: sethi %uhi(PAGE_OFFSET), %g4 + wr %g3, %g0, %asi + retl + sllx %g4, 32, %g4 + + .section __ex_table + .align 4 + .word cpc_start, 0, cpc_end, cpc_handler + .word cpc_user_start, 0, cpc_user_end, cpc_handler diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/ksyms.c linux-2.4.18-sparc64/arch/um/sys-sparc64/ksyms.c --- linux-2.4.18-orig/arch/um/sys-sparc64/ksyms.c Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/ksyms.c Sat May 10 16:00:21 2003 @@ -0,0 +1,11 @@ +#include "linux/module.h" +#include "linux/in6.h" +#include "linux/rwsem.h" +#include "asm/byteorder.h" +#include "asm/semaphore.h" +#include "asm/uaccess.h" +#include "asm/checksum.h" +#include "asm/errno.h" + +/* Networking helper routines. */ +EXPORT_SYMBOL(csum_partial_copy_generic); diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/memstuff.c linux-2.4.18-sparc64/arch/um/sys-sparc64/memstuff.c --- linux-2.4.18-orig/arch/um/sys-sparc64/memstuff.c Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/memstuff.c Sat May 10 16:00:21 2003 @@ -0,0 +1,51 @@ +/* This is to get rid of "undefined references" to __memcpy, __memmove, __memset */ + +#include +#include "linux/kernel.h" + +extern int stop_a_enabled = 1; + +int __memcpy(void *dst, const void *src, int num) +{ + /* calls the libc memcpy */ + return(memcpy(dst,src,num)); +} + +void *__builtin_memcpy(void *dst, const void *src, int num) +{ + /* calls the libc memcpy */ + return(memcpy(dst,src,num)); +} + +void *__memset(void *buf, int ch, int num) +{ + return(memset(buf,ch,num)); +} + +void *__builtin_memset(void *buf, int ch, int num) +{ + return(memset(buf,ch,num)); +} + +void *__memmove(void *dst, const void *src, int num) +{ + return(memmove(dst,src,num)); +} + +/* Some page stuff goes here */ + +void _clear_page(void *page) +{ + panic("_clear_page"); +} + +extern void clear_user_page(void *page, unsigned long vaddr) +{ + panic("clear_user_page"); +} + +extern void copy_user_page(void *to, void *from, unsigned long vaddr) +{ + panic("copy_user_page"); +} + diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/misc.c linux-2.4.18-sparc64/arch/um/sys-sparc64/misc.c --- linux-2.4.18-orig/arch/um/sys-sparc64/misc.c Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/misc.c Sat May 10 16:00:21 2003 @@ -0,0 +1,34 @@ +/* This is to stub csum functions to help UML compile */ + +extern unsigned int csum_partial_copy_user_sparc64(const char *src, char *dst, int len, unsigned int sum) +{ + panic("csum_partial_copy_user_sparc64"); + return 0; +} + +extern unsigned int csum_partial_copy_sparc64(const char *src, char *dst, int len, unsigned int sum) +{ + panic("csum_partial_copy_sparc64"); + return 0; +} + +extern unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum) +{ + panic("csum_partial"); + return 0; +} + +extern int arch_handle_signal(int sig, struct uml_pt_regs *regs) +{ + panic("arch_handle_signal"); + return 0; +} + +extern void arch_check_bugs(void) +{ + panic("arch_check_bugs"); +} + + + + diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/ptrace.c linux-2.4.18-sparc64/arch/um/sys-sparc64/ptrace.c --- linux-2.4.18-orig/arch/um/sys-sparc64/ptrace.c Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/ptrace.c Sat May 10 16:47:49 2003 @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2003 Shanti Katta (katta@csee.wvu.edu) + * Licensed under the GPL + */ + +#include "linux/sched.h" +#include "asm/ptrace.h" +#include "asm/uaccess.h" +#include "ptrace_user.h" +#include "sysdep/sigcontext.h" +#include "sysdep/sc.h" + +int putreg(struct task_struct *child, int regno, unsigned long value) +{ + return 0; +} + +unsigned long getreg(struct task_struct *child, int regno) +{ + unsigned long retval = ~0UL; + return retval; +} + +int get_fpregs(unsigned long buf, struct task_struct *child) +{ + int err; + return(0); +} + +int set_fpregs(unsigned long buf, struct task_struct *child) +{ + int err; + 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 dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/ptrace_user.c linux-2.4.18-sparc64/arch/um/sys-sparc64/ptrace_user.c --- linux-2.4.18-orig/arch/um/sys-sparc64/ptrace_user.c Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/ptrace_user.c Sat May 10 16:00:21 2003 @@ -0,0 +1,24 @@ +#include +#include +#include +#include "sysdep/ptrace.h" + +int ptrace_getregs(long pid, unsigned long *regs_out) +{ + return(ptrace(PTRACE_GETREGS, pid, 0, regs_out)); +} + +int ptrace_setregs(long pid, unsigned long *regs) +{ + return(ptrace(PTRACE_SETREGS, pid, 0, 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: +*/ diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/semaphore.c linux-2.4.18-sparc64/arch/um/sys-sparc64/semaphore.c --- linux-2.4.18-orig/arch/um/sys-sparc64/semaphore.c Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/semaphore.c Sat May 10 16:00:12 2003 @@ -0,0 +1,88 @@ +/* $Id: semaphore.c,v 1.9 2001/11/18 00:12:56 davem Exp $ + * semaphore.c: Sparc64 semaphore implementation. + * + * This is basically the PPC semaphore scheme ported to use + * the sparc64 atomic instructions, so see the PPC code for + * credits. + */ + +#include + +/* + * Atomically update sem->count. + * This does the equivalent of the following: + * + * old_count = sem->count; + * tmp = MAX(old_count, 0) + incr; + * sem->count = tmp; + * return old_count; + */ +static __inline__ int __sem_update_count(struct semaphore *sem, int incr) +{ + int old_count, tmp; + + __asm__ __volatile__("\n" +" ! __sem_update_count old_count(%0) tmp(%1) incr(%4) &sem->count(%3)\n" +"1: ldsw [%3], %0\n" +" mov %0, %1\n" +" cmp %0, 0\n" +" movl %%icc, 0, %1\n" +" add %1, %4, %1\n" +" cas [%3], %0, %1\n" +" cmp %0, %1\n" +" bne,pn %%icc, 1b\n" +" membar #StoreLoad | #StoreStore\n" + : "=&r" (old_count), "=&r" (tmp), "=m" (sem->count) + : "r" (&sem->count), "r" (incr), "m" (sem->count) + : "cc"); + + return old_count; +} + +void __up(struct semaphore *sem) +{ + __sem_update_count(sem, 1); + wake_up(&sem->wait); +} + +void __down(struct semaphore * sem) +{ + struct task_struct *tsk = current; + DECLARE_WAITQUEUE(wait, tsk); + + tsk->state = TASK_UNINTERRUPTIBLE; + add_wait_queue_exclusive(&sem->wait, &wait); + + while (__sem_update_count(sem, -1) <= 0) { + schedule(); + tsk->state = TASK_UNINTERRUPTIBLE; + } + remove_wait_queue(&sem->wait, &wait); + tsk->state = TASK_RUNNING; + + wake_up(&sem->wait); +} + +int __down_interruptible(struct semaphore * sem) +{ + int retval = 0; + struct task_struct *tsk = current; + DECLARE_WAITQUEUE(wait, tsk); + + tsk->state = TASK_INTERRUPTIBLE; + add_wait_queue_exclusive(&sem->wait, &wait); + + while (__sem_update_count(sem, -1) <= 0) { + if (signal_pending(current)) { + __sem_update_count(sem, 0); + retval = -EINTR; + break; + } + schedule(); + tsk->state = TASK_INTERRUPTIBLE; + } + tsk->state = TASK_RUNNING; + remove_wait_queue(&sem->wait, &wait); + wake_up(&sem->wait); + return retval; +} diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/sigcontext.c linux-2.4.18-sparc64/arch/um/sys-sparc64/sigcontext.c --- linux-2.4.18-orig/arch/um/sys-sparc64/sigcontext.c Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/sigcontext.c Sat May 10 16:00:21 2003 @@ -0,0 +1,64 @@ +#include +#include +#include +#include +#include "sysdep/ptrace.h" +#include "kern_util.h" +#include "frame_user.h" + +int sc_size(void *data) +{ + struct arch_frame_data *arch = data; + + return(sizeof(struct sigcontext) + arch->fpstate_size); +} + +int copy_sc_to_user(void *to_ptr, void *from_ptr, void *data) +{ + struct arch_frame_data *arch = data; + struct sigcontext *to = to_ptr, *from = from_ptr; + int to_fp, from_fp; + int err; + to_fp = (int)((unsigned long) to + sizeof(*to)); + from_fp = from->sigc_onstack; + err = copy_to_user_proc(to, from, sizeof(*to)); + if(from_fp != 0){ + err |= copy_to_user_proc(&to->sigc_onstack, &to_fp, sizeof(to->sigc_onstack)); + err |= copy_to_user_proc(to_fp, from_fp, arch->fpstate_size); + } + return(err); +} + +int copy_sc_from_user(void *to_ptr, void *from_ptr, void *data) +{ + struct arch_frame_data *arch = data; + struct sigcontext *to = to_ptr, *from = from_ptr; + int to_fp, from_fp; + unsigned long sigs; + int err; + + to_fp = to->sigc_onstack; + from_fp = from->sigc_onstack; + sigs = to->sigc_mask; + err = copy_from_user_proc(to, from, sizeof(*to)); + to->sigc_mask = sigs; + if(to_fp != 0) + err |= copy_from_user_proc(to_fp, from_fp, arch->fpstate_size); + return(err); +} + +void sc_to_sc(void *to_ptr, void *from_ptr) +{ + struct sigcontext *to = to_ptr, *from = from_ptr; + int size = sizeof(*to) + signal_frame_sc.arch.fpstate_size; + + memcpy(to, from, size); + if(from->sigc_onstack != 0) to->sigc_onstack = (int)(to + 1); +} + +unsigned long *sc_sigmask(void *sc_ptr) +{ + struct sigcontext *sc = sc_ptr; + + return(&sc->sigc_mask); +} diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/strncmp.S linux-2.4.18-sparc64/arch/um/sys-sparc64/strncmp.S --- linux-2.4.18-orig/arch/um/sys-sparc64/strncmp.S Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/strncmp.S Sat May 10 16:00:12 2003 @@ -0,0 +1,31 @@ +/* $Id: strncmp.S,v 1.2 1997/03/11 17:51:44 jj Exp $ + * Sparc64 optimized strncmp code. + * + * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + */ + +#include + + .text + .align 4 + .global __strncmp, strncmp +__strncmp: +strncmp: + brlez,pn %o2, 3f + lduba [%o0] (ASI_PNF), %o3 +1: + add %o0, 1, %o0 + ldub [%o1], %o4 + brz,pn %o3, 2f + add %o1, 1, %o1 + cmp %o3, %o4 + bne,pn %icc, 2f + subcc %o2, 1, %o2 + bne,a,pt %xcc, 1b + ldub [%o0], %o3 +2: + retl + sub %o3, %o4, %o0 +3: + retl + clr %o0 diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/util/Makefile linux-2.4.18-sparc64/arch/um/sys-sparc64/util/Makefile --- linux-2.4.18-orig/arch/um/sys-sparc64/util/Makefile Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/util/Makefile Sat May 10 16:00:21 2003 @@ -0,0 +1,6 @@ +all : mk_sc + +mk_sc : mk_sc.c + +clean : + rm mk_sc diff -Naur -X dontdiff linux-2.4.18-orig/arch/um/sys-sparc64/util/mk_sc.c linux-2.4.18-sparc64/arch/um/sys-sparc64/util/mk_sc.c --- linux-2.4.18-orig/arch/um/sys-sparc64/util/mk_sc.c Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/arch/um/sys-sparc64/util/mk_sc.c Sat May 10 16:00:21 2003 @@ -0,0 +1,39 @@ +#include +#include +#include + +#define SC_OFFSET(name, field) printf("#define " name "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n", offsetof(struct sigcontext, field)) + +/*#define SC_FP_OFFSET(name, field) \ + printf("#define " name \ + "(sc) *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\ + offsetof(struct __siginfo_fpu_t, field)) + +#define SC_FP_OFFSET_PTR(name, field, type) \ + printf("#define " name \ + "(sc) ((" type " *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\ + offsetof(struct __siginfo_fpu_t, field))*/ + +int main(int argc, char **argv) +{ + SC_OFFSET("SC_IP", si_regs.pc); + SC_OFFSET("SC_SP", si_regs.psr); + SC_OFFSET("SC_FP", si_regs.u_regs[14]); + SC_OFFSET("SC_UREG_I0", si_regs.u_regs[8]); + SC_OFFSET("SC_UREG_I1", si_regs.u_regs[9]); + SC_OFFSET("SC_UREG_I2", si_regs.u_regs[10]); + SC_OFFSET("SC_UREG_I3", si_regs.u_regs[11]); + SC_OFFSET("SC_UREG_I4", si_regs.u_regs[12]); + SC_OFFSET("SC_UREG_I5", si_regs.u_regs[13]); + SC_OFFSET("SC_RETPC", si_regs.u_regs[15]); + /*SC_FP_OFFSET("SC_FP_CW", cw); + SC_FP_OFFSET("SC_FP_SW", sw); + SC_FP_OFFSET("SC_FP_TAG", tag); + SC_FP_OFFSET("SC_FP_IPOFF", ipoff); + SC_FP_OFFSET("SC_FP_CSSEL", cssel); + SC_FP_OFFSET("SC_FP_DATAOFF", dataoff); + SC_FP_OFFSET("SC_FP_DATASEL", datasel); + SC_FP_OFFSET_PTR("SC_FP_ST", _st, "struct _fpstate"); + SC_FP_OFFSET_PTR("SC_FXSR_ENV", _fxsr_env, "void");*/ + return(0); +} diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-sparc64/checksum.h linux-2.4.18-sparc64/include/asm-sparc64/checksum.h --- linux-2.4.18-orig/include/asm-sparc64/checksum.h Fri Apr 27 01:17:26 2001 +++ linux-2.4.18-sparc64/include/asm-sparc64/checksum.h Sat May 10 15:59:35 2003 @@ -44,10 +44,11 @@ unsigned int sum) { int ret; - unsigned char cur_ds = current->thread.current_ds.seg; + /* Next line commented out to make uml compile on sparc64 */ + /*unsigned char cur_ds = current->thread.current_ds.seg;*/ __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "i" (ASI_P)); ret = csum_partial_copy_sparc64(src, dst, len, sum); - __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" (cur_ds)); + /*__asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" (cur_ds));*/ return ret; } diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/archparam-sparc64.h linux-2.4.18-sparc64/include/asm-um/archparam-sparc64.h --- linux-2.4.18-orig/include/asm-um/archparam-sparc64.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/include/asm-um/archparam-sparc64.h Sat May 10 15:59:38 2003 @@ -0,0 +1,94 @@ +/* $Id: archparam-sparc64.h,v 1.1.2.2 2002/06/08 20:49:05 shanti Exp $ */ +#ifndef __UM_ARCHPARAM_SPARC64_H +#define __UM_ARCHPARAM_SPARC64_H + +/* + * ELF register definitions.. + */ + +#include +#ifdef __KERNEL__ +#include +#endif + +/* + * These are used to set parameters in the core dumps. + */ +#ifndef ELF_ARCH +#define ELF_ARCH EM_SPARCV9 +#define ELF_CLASS ELFCLASS64 +#define ELF_DATA ELFDATA2MSB + +typedef unsigned long elf_greg_t; + +#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef struct { + unsigned long pr_regs[32]; + unsigned long pr_fsr; + unsigned long pr_gsr; + unsigned long pr_fprs; +} elf_fpregset_t; +#endif + +typedef unsigned long um_udelay_t; + +/* + * This is used to ensure we don't load something for the wrong architecture. + */ +#ifndef elf_check_arch +#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) /* Might be EM_SPARCV9 or EM_SPARC */ +#endif + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE PAGE_SIZE + +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical + use of this is to invoke "./ld.so someprog" to test out a new version of + the loader. We need to make sure that it is out of the way of the program + that it will "exec", and that there is sufficient room for the brk. */ + +#ifndef ELF_ET_DYN_BASE +#define ELF_ET_DYN_BASE 0x0000010000000000UL +#endif + + +/* This yields a mask that user programs can use to figure out what + instruction set this cpu supports. */ + +/* On Ultra, we support all of the v8 capabilities. */ +#define ELF_HWCAP ((HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \ + HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | \ + HWCAP_SPARC_V9) | \ + ((tlb_type == cheetah) ? HWCAP_SPARC_ULTRA3 : 0)) + +/* This yields a string that ld.so will use to load implementation + specific libraries for optimization. This is more specific in + intent than poking at uname or /proc/cpuinfo. */ + +#define ELF_PLATFORM (NULL) + +#ifdef __KERNEL__ +#define SET_PERSONALITY(ex, ibcs2) \ +do { unsigned char flags = current->thread.flags; \ + if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ + flags |= SPARC_FLAG_32BIT; \ + else \ + flags &= ~SPARC_FLAG_32BIT; \ + if (flags != current->thread.flags) { \ + /* flush_thread will update pgd cache */\ + current->thread.flags = flags; \ + } \ + \ + if (ibcs2) \ + set_personality(PER_SVR4); \ + else if (current->personality != PER_LINUX32) \ + set_personality(PER_LINUX); \ +} while (0) +#endif + +#endif /* !(__ASM_SPARC64_ELF_H) */ + + + diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/asi.h linux-2.4.18-sparc64/include/asm-um/asi.h --- linux-2.4.18-orig/include/asm-um/asi.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/include/asm-um/asi.h Sat May 10 15:59:38 2003 @@ -0,0 +1,6 @@ +#ifndef __UM_ASI_H +#define __UM_ASI_H + +#include "asm/arch/asi.h" + +#endif diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/checksum-sparc64.h linux-2.4.18-sparc64/include/asm-um/checksum-sparc64.h --- linux-2.4.18-orig/include/asm-um/checksum-sparc64.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/include/asm-um/checksum-sparc64.h Sat May 10 15:59:38 2003 @@ -0,0 +1,209 @@ +/* $Id: checksum.h,v 1.17 2001/04/24 01:09:12 davem Exp $ */ +#ifndef __UM_CHECKSUM_H +#define __UM_CHECKSUM_H + +/* checksum.h: IP/UDP/TCP checksum routines on the V9. + * + * Copyright(C) 1995 Linus Torvalds + * Copyright(C) 1995 Miguel de Icaza + * Copyright(C) 1996 David S. Miller + * Copyright(C) 1996 Eddie C. Dost + * Copyright(C) 1997 Jakub Jelinek + * + * derived from: + * Alpha checksum c-code + * ix86 inline assembly + * RFC1071 Computing the Internet Checksum + */ + +#include + +/* computes the checksum of a memory block at buff, length len, + * and adds in "sum" (32-bit) + * + * returns a 32-bit number suitable for feeding into itself + * or csum_tcpudp_magic + * + * this function must be called with even lengths, except + * for the last fragment, which may be odd + * + * it's best to have buff aligned on a 32-bit boundary + */ +extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); + +/* the same as csum_partial, but copies from user space while it + * checksums + * + * here even more important to align src and dst on a 32-bit (or even + * better 64-bit) boundary + */ +extern unsigned int csum_partial_copy_sparc64(const char *src, char *dst, int len, unsigned int sum); + +extern __inline__ unsigned int +csum_partial_copy_nocheck (const char *src, char *dst, int len, + unsigned int sum) +{ + int ret; + /* Next line commented to make asm-sparc64 compile. */ + unsigned char cur_ds = current->thread.current_ds.seg; + __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "i" (ASI_P)); + ret = csum_partial_copy_sparc64(src, dst, len, sum); + __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" (cur_ds)); + return ret; +} + +extern __inline__ unsigned int +csum_partial_copy_from_user(const char *src, char *dst, int len, + unsigned int sum, int *err) +{ + __asm__ __volatile__ ("stx %0, [%%sp + 0x7ff + 128]" + : : "r" (err)); + return csum_partial_copy_sparc64(src, dst, len, sum); +} + +/* + * Copy and checksum to user + */ +#define HAVE_CSUM_COPY_USER +extern unsigned int csum_partial_copy_user_sparc64(const char *src, char *dst, int len, unsigned int sum); +extern __inline__ unsigned int +csum_and_copy_to_user(const char *src, char *dst, int len, + unsigned int sum, int *err) +{ + __asm__ __volatile__ ("stx %0, [%%sp + 0x7ff + 128]" + : : "r" (err)); + return csum_partial_copy_user_sparc64(src, dst, len, sum); +} + +/* ihl is always 5 or greater, almost always is 5, and iph is word aligned + * the majority of the time. + */ +extern __inline__ unsigned short ip_fast_csum(__const__ unsigned char *iph, + unsigned int ihl) +{ + unsigned short sum; + + /* Note: We must read %2 before we touch %0 for the first time, + * because GCC can legitimately use the same register for + * both operands. + */ + __asm__ __volatile__( +" sub %2, 4, %%g7 ! IEU0\n" +" lduw [%1 + 0x00], %0 ! Load Group\n" +" lduw [%1 + 0x04], %%g2 ! Load Group\n" +" lduw [%1 + 0x08], %%g3 ! Load Group\n" +" addcc %%g2, %0, %0 ! IEU1 1 Load Bubble + Group\n" +" lduw [%1 + 0x0c], %%g2 ! Load\n" +" addccc %%g3, %0, %0 ! Sngle Group no Bubble\n" +" lduw [%1 + 0x10], %%g3 ! Load Group\n" +" addccc %%g2, %0, %0 ! Sngle Group no Bubble\n" +" addc %0, %%g0, %0 ! Sngle Group\n" +"1: addcc %%g3, %0, %0 ! IEU1 Group no Bubble\n" +" add %1, 4, %1 ! IEU0\n" +" addccc %0, %%g0, %0 ! Sngle Group no Bubble\n" +" subcc %%g7, 1, %%g7 ! IEU1 Group\n" +" be,a,pt %%icc, 2f ! CTI\n" +" sll %0, 16, %%g2 ! IEU0\n" +" lduw [%1 + 0x10], %%g3 ! Load Group\n" +" ba,pt %%xcc, 1b ! CTI\n" +" nop ! IEU0\n" +"2: addcc %0, %%g2, %%g2 ! IEU1 Group\n" +" srl %%g2, 16, %0 ! IEU0 Group regdep XXX Scheisse!\n" +" addc %0, %%g0, %0 ! Sngle Group\n" +" xnor %%g0, %0, %0 ! IEU0 Group\n" +" srl %0, 0, %0 ! IEU0 Group XXX Scheisse!\n" + : "=r" (sum), "=&r" (iph) + : "r" (ihl), "1" (iph) + : "g2", "g3", "g7", "cc"); + return sum; +} + +/* Fold a partial checksum without adding pseudo headers. */ +extern __inline__ unsigned short csum_fold(unsigned int sum) +{ + unsigned int tmp; + + __asm__ __volatile__( +" addcc %0, %1, %1\n" +" srl %1, 16, %1\n" +" addc %1, %%g0, %1\n" +" xnor %%g0, %1, %0\n" + : "=&r" (sum), "=r" (tmp) + : "0" (sum), "1" (sum<<16) + : "cc"); + return (sum & 0xffff); +} + +extern __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, + unsigned long daddr, + unsigned int len, + unsigned short proto, + unsigned int sum) +{ + __asm__ __volatile__( +" addcc %1, %0, %0\n" +" addccc %2, %0, %0\n" +" addccc %3, %0, %0\n" +" addc %0, %%g0, %0\n" + : "=r" (sum), "=r" (saddr) + : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), "1" (saddr) + : "cc"); + return sum; +} + +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 16-bit checksum, already complemented + */ +static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum) +{ + return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); +} + +#define _HAVE_ARCH_IPV6_CSUM + +static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, + struct in6_addr *daddr, + __u32 len, + unsigned short proto, + unsigned int sum) +{ + __asm__ __volatile__ ( +" addcc %3, %4, %%g7\n" +" addccc %5, %%g7, %%g7\n" +" lduw [%2 + 0x0c], %%g2\n" +" lduw [%2 + 0x08], %%g3\n" +" addccc %%g2, %%g7, %%g7\n" +" lduw [%2 + 0x04], %%g2\n" +" addccc %%g3, %%g7, %%g7\n" +" lduw [%2 + 0x00], %%g3\n" +" addccc %%g2, %%g7, %%g7\n" +" lduw [%1 + 0x0c], %%g2\n" +" addccc %%g3, %%g7, %%g7\n" +" lduw [%1 + 0x08], %%g3\n" +" addccc %%g2, %%g7, %%g7\n" +" lduw [%1 + 0x04], %%g2\n" +" addccc %%g3, %%g7, %%g7\n" +" lduw [%1 + 0x00], %%g3\n" +" addccc %%g2, %%g7, %%g7\n" +" addccc %%g3, %%g7, %0\n" +" addc 0, %0, %0\n" + : "=&r" (sum) + : "r" (saddr), "r" (daddr), "r"(htonl(len)), + "r"(htonl(proto)), "r"(sum) + : "g2", "g3", "g7", "cc"); + + return csum_fold(sum); +} + +/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */ +extern __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len) +{ + return csum_fold(csum_partial(buff, len, 0)); +} + +#endif /* !(__UM_CHECKSUM_H) */ diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/elf-sparc64.h linux-2.4.18-sparc64/include/asm-um/elf-sparc64.h --- linux-2.4.18-orig/include/asm-um/elf-sparc64.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/include/asm-um/elf-sparc64.h Sat May 10 15:59:38 2003 @@ -0,0 +1,18 @@ +#ifndef __UM_ELF_H +#define __UM_ELF_H + +#include "asm/archparam.h" + +#define ELF_HWCAP (0) + +#define SET_PERSONALITY(ex, ibcs2) do ; while (0) + +#define ELF_EXEC_PAGESIZE 4096 + +#define elf_check_arch(x) (1) + +#define ELF_CLASS ELFCLASS32 + +#define USE_ELF_CORE_DUMP + +#endif diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/io.h linux-2.4.18-sparc64/include/asm-um/io.h --- linux-2.4.18-orig/include/asm-um/io.h Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/include/asm-um/io.h Sat May 10 15:59:38 2003 @@ -12,11 +12,14 @@ * Change virtual addresses to physical addresses and vv. * These are pretty trivial */ + +#undef virt_to_phys static inline unsigned long virt_to_phys(volatile void * address) { return __pa((void *) address); } +#undef phys_to_virt static inline void * phys_to_virt(unsigned long address) { return __va(address); diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/irq.h linux-2.4.18-sparc64/include/asm-um/irq.h --- linux-2.4.18-orig/include/asm-um/irq.h Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/include/asm-um/irq.h Sat May 10 15:59:38 2003 @@ -24,6 +24,8 @@ #define WINCH_IRQ 10 #define SIGIO_WRITE_IRQ 11 +/*#define CONSOLE_IRQ 12*/ + #define LAST_IRQ SIGIO_WRITE_IRQ #define NR_IRQS (LAST_IRQ + 1) diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/mmu.h linux-2.4.18-sparc64/include/asm-um/mmu.h --- linux-2.4.18-orig/include/asm-um/mmu.h Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/include/asm-um/mmu.h Sat May 10 15:59:38 2003 @@ -1,5 +1,5 @@ -#ifndef __MMU_H -#define __MMU_H +#ifndef __UM_MMU_H +#define __UM_MMU_H #include "asm/arch/mmu.h" diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/processor-generic.h linux-2.4.18-sparc64/include/asm-um/processor-generic.h --- linux-2.4.18-orig/include/asm-um/processor-generic.h Fri May 9 19:25:25 2003 +++ linux-2.4.18-sparc64/include/asm-um/processor-generic.h Sat May 10 15:59:38 2003 @@ -123,6 +123,8 @@ /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ + +#undef TASK_UNMAPPED_BASE #define TASK_UNMAPPED_BASE (0x40000000) extern void start_thread(struct pt_regs *regs, unsigned long entry, diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/processor-sparc64.h linux-2.4.18-sparc64/include/asm-um/processor-sparc64.h --- linux-2.4.18-orig/include/asm-um/processor-sparc64.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/include/asm-um/processor-sparc64.h Sat May 10 15:59:38 2003 @@ -0,0 +1,19 @@ +#ifndef __UM_PROCESSOR_SPARC64_H +#define __UM_PROCESSOR_SPARC64_H + +#if defined(__ASSEMBLY__) + +#define CONFIG_SPARC64 +#include "asm/arch/processor.h" + +#else + +#include "asm/processor-generic.h" + +#endif + +#endif + + + + diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/ptrace-sparc64.h linux-2.4.18-sparc64/include/asm-um/ptrace-sparc64.h --- linux-2.4.18-orig/include/asm-um/ptrace-sparc64.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/include/asm-um/ptrace-sparc64.h Sat May 10 17:03:54 2003 @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2003 Shanti Katta (katta@csee.wvu.edu) + * Licensed under the GPL + */ + +#ifndef __UM_PTRACE_SPARC64_H +#define __UM_PTRACE_SPARC64_H + +#include "asm/ptrace-generic.h" + +#define PT_REGS_U_REGS[x](r) UPT_U_REGS[x](&(r)->regs) +/*#define PT_REGS_U_REGS[1](r) UPT_U_REGS[1](&(r)->regs) +#define PT_REGS_U_REGS[2](r) UPT_U_REGS[2](&(r)->regs) +#define PT_REGS_U_REGS[3](r) UPT_U_REGS[3](&(r)->regs) +#define PT_REGS_U_REGS[4](r) UPT_U_REGS[4](&(r)->regs) +#define PT_REGS_U_REGS[5](r) UPT_U_REGS[5](&(r)->regs) +#define PT_REGS_U_REGS[6](r) UPT_U_REGS[6](&(r)->regs) +#define PT_REGS_U_REGS[7](r) UPT_U_REGS[7](&(r)->regs) +#define PT_REGS_U_REGS[8](r) UPT_U_REGS[8](&(r)->regs) +#define PT_REGS_U_REGS[9](r) UPT_U_REGS[9](&(r)->regs) +#define PT_REGS_U_REGS[10](r) UPT_U_REGS[10](&(r)->regs) +#define PT_REGS_U_REGS[11](r) UPT_U_REGS[11](&(r)->regs) +#define PT_REGS_U_REGS[12](r) UPT_U_REGS[12](&(r)->regs) +#define PT_REGS_U_REGS[13](r) UPT_U_REGS[13](&(r)->regs) +#define PT_REGS_U_REGS[14](r) UPT_U_REGS[14](&(r)->regs) +#define PT_REGS_U_REGS[15](r) UPT_U_REGS[15](&(r)->regs)*/ +#define PT_REGS_PSR(r) UPT_PSR(&(r)->regs) +#define PT_REGS_FP(r) UPT_FP(&(r)->regs) +#define PT_REGS_RETPC(r) UPT_RETPC(&(r)->regs) + +#define PT_REGS_SYSCALL_RET(r) PT_REGS_RETPC(r) +#define PT_REGS_ORIG_SYSCALL(r) PT_REGS_FP(r) +#define PT_FIX_EXEC_STACK(sp) do ; while(0) + +#define user_mode(r) ((r)->regs.is_user) + +#endif + + diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/sigcontext-sparc64.h linux-2.4.18-sparc64/include/asm-um/sigcontext-sparc64.h --- linux-2.4.18-orig/include/asm-um/sigcontext-sparc64.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/include/asm-um/sigcontext-sparc64.h Sat May 10 15:59:38 2003 @@ -0,0 +1,6 @@ +#ifndef __UM_SIGCONTEXT_SPARC64_H +#define __UM_SIGCONTEXT_SPARC64_H + +#include "asm/sigcontext-generic.h" + +#endif diff -Naur -X dontdiff linux-2.4.18-orig/include/asm-um/system-sparc64.h linux-2.4.18-sparc64/include/asm-um/system-sparc64.h --- linux-2.4.18-orig/include/asm-um/system-sparc64.h Wed Dec 31 19:00:00 1969 +++ linux-2.4.18-sparc64/include/asm-um/system-sparc64.h Sat May 10 15:59:38 2003 @@ -0,0 +1,8 @@ +#ifndef __UM_SYSTEM_SPARC64_H +#define __UM_SYSTEM_SPARC64_H + +#define empty_zero_page empty_zero_page_renamed +#include "asm/system-generic.h" +#undef empty_zero_page + +#endif diff -Naur -X dontdiff linux-2.4.18-orig/mm/bootmem.c linux-2.4.18-sparc64/mm/bootmem.c --- linux-2.4.18-orig/mm/bootmem.c Fri Dec 21 12:42:04 2001 +++ linux-2.4.18-sparc64/mm/bootmem.c Sat May 10 15:59:30 2003 @@ -120,10 +120,10 @@ start = (addr + PAGE_SIZE-1) / PAGE_SIZE; sidx = start - (bdata->node_boot_start/PAGE_SIZE); - for (i = sidx; i < eidx; i++) { + /*for (i = sidx; i < eidx; i++) { if (!test_and_clear_bit(i, bdata->node_bootmem_map)) BUG(); - } + }*/ } /*