From: NIIBE Y. <gn...@m1...> - 2002-02-26 08:13:58
|
And I'll commit following changes to follow mainline kernel. I haven't tested yet. Only compile it. 2002-02-26 NIIBE Yutaka <gn...@m1...> Updated to 2.5.3. * Makefile: Version 2.5.3 * AGAINST-2.5.3: New file. * AGAINST-2.5.3-pre5: Removed. * include/asm-sh/bitops.h (__ffs): Implemented. * include/asm-sh/mmu_context.h (sched_find_first_bit): Implemented (copied i386 implementation). (sched_find_first_zero_bit): Removed. * arch/sh/kernel/ptrace.c (sys_ptrace): Use ptrace_check_attach. Replace PT_TRACESYS -> PT_SYSCALLTRACE. * arch/sh/kernel/entry.S (sys_call_table): Added entries. Remove COMPAT_OLD_SYSCALL_ABI things. Follow up to new member "task_work" in task_struct. * include/asm-sh/unistd.h (__NR_security, __NR_gettid, __NR_setxattr, __NR_lsetxattr, __NR_fsetxattr, __NR_getxattr, __NR_lgetxattr, __NR_fgetxattr, __NR_listxattr, __NR_llistxattr, __NR_flistxattr, __NR_removexattr, __NR_lremovexattr, __NR_fremovexattr): Added. 2002-02-26 NIIBE Yutaka <gn...@m1...> Merge changes in 2.5.3-pre6. * Makefile (Drivers-y): Added drivers/base/base.o. * drivers/Makefile (subdir-y): Added "base". * drivers/char/Config.help (CONFIG_WATCHDOG): Added. * arch/sh/Config.help (CONFIG_PCI_GOBIOS, CONFIG_KCORE_ELF, CONFIG_SH_GENERIC, CONFIG_SH_SOLUTION_ENGINE, CONFIG_SH_7751_SOLUTION_ENGINE, CONFIG_SH_HP620, CONFIG_SH_HP680, CONFIG_SH_HP690, CONFIG_SH_CQREEK, CONFIG_SH_DMIDA, CONFIG_SH_EC3104, CONFIG_SH_DREAMCAST, CONFIG_SH_UNKNOWN): Added. Index: Makefile =================================================================== RCS file: /cvsroot/linuxsh/linux/Makefile,v retrieving revision 1.6 diff -u -3 -p -r1.6 Makefile --- Makefile 25 Jan 2002 02:07:58 -0000 1.6 +++ Makefile 26 Feb 2002 08:10:47 -0000 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 3 -EXTRAVERSION =-pre5 +EXTRAVERSION = KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) @@ -131,7 +131,8 @@ DRIVERS- := DRIVERS-$(CONFIG_ACPI) += drivers/acpi/acpi.o DRIVERS-$(CONFIG_PARPORT) += drivers/parport/driver.o -DRIVERS-y += drivers/char/char.o \ +DRIVERS-y += drivers/base/base.o \ + drivers/char/char.o \ drivers/block/block.o \ drivers/misc/misc.o \ drivers/net/net.o \ @@ -169,7 +170,7 @@ DRIVERS-$(CONFIG_ZORRO) += drivers/zorro DRIVERS-$(CONFIG_FC4) += drivers/fc4/fc4.a DRIVERS-$(CONFIG_ALL_PPC) += drivers/macintosh/macintosh.o DRIVERS-$(CONFIG_MAC) += drivers/macintosh/macintosh.o -DRIVERS-$(CONFIG_ISAPNP) += drivers/pnp/pnp.o +DRIVERS-$(CONFIG_PNP) += drivers/pnp/pnp.o DRIVERS-$(CONFIG_SGI_IP22) += drivers/sgi/sgi.a DRIVERS-$(CONFIG_VT) += drivers/video/video.o DRIVERS-$(CONFIG_PARIDE) += drivers/block/paride/paride.a Index: arch/sh/Config.help =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/Config.help,v retrieving revision 1.2 diff -u -3 -p -r1.2 Config.help --- arch/sh/Config.help 25 Jan 2002 04:27:53 -0000 1.2 +++ arch/sh/Config.help 26 Feb 2002 08:10:47 -0000 @@ -4,122 +4,6 @@ CONFIG_SUPERH gaming console. The SuperH port has a home page at <http://www.sh-linux.org/>. -CONFIG_SH_GENERIC - Select Generic if configuring for a generic SuperH system. - The "generic" option compiles in *all* the possible hardware - support and relies on the sh_mv= kernel commandline option to choose - at runtime which routines to use. "MV" stands for "machine vector"; - each of the machines below is described by a machine vector. - - Select SolutionEngine if configuring for a Hitachi SH7709 - or SH7750/7750S evalutation board. - - Select Overdrive if configuring for a ST407750 Overdrive board. - More information at - <http://linuxsh.sourceforge.net/docs/7750overdrive.php3>. - - Select HP620 if configuring for a HP Jornada HP620. - More information (hardware only) at - <http://www.hp.com/jornada/>. - - Select HP680 if configuring for a HP Jornada HP680. - More information (hardware only) at - <http://www.hp.com/jornada/products/680/>. - - Select HP690 if configuring for a HP Jornada HP690. - More information (hardware only) at - <http://www.hp.com/jornada/products/680/>. - - Select CqREEK if configuring for a CqREEK SH7708 or SH7750. - More information at - <http://sources.redhat.com/ecos/hardware.html#SuperH>. - - Select DMIDA if configuring for a DataMyte 4000 Industrial - Digital Assistant. More information at <http://www.dmida.com/>. - - Select EC3104 if configuring for a system with an Eclipse - International EC3104 chip, e.g. the Harris AD2000 or Compaq Aero 8000. - - Select Dreamcast if configuring for a SEGA Dreamcast. - More information at - <http://www.m17n.org/linux-sh/dreamcast/>. There is a - Dreamcast project is at <http://linuxdc.sourceforge.net/>. - - Select BareCPU if you know what this means, and it applies - to your system. - -# These may have to be merged in when we go to CML2: -# - "SolutionEngine7751" for Hitachi SolutionEngine (7751) -# - "STB1_Harp" for STMicroelectronics HARP -# - "CqREEK" for CQ Publishing CqREEK SH-4 -# - "CAT68701" for CAT 68701 Evaluation Board (SH7708) -# - "BigSur" for Big Sur Evaluation Board -# - "ADX" for A&D ADX - -CONFIG_SH_SOLUTION_ENGINE - Select SolutionEngine if configuring for a Hitachi SH7709 - or SH7750 evalutation board. - -CONFIG_SH_7751_SOLUTION_ENGINE - Select 7751 SolutionEngine if configuring for a Hitachi SH7751 - evalutation board. - -CONFIG_SH_OVERDRIVE - Select Overdrive if configuring for a ST407750 Overdrive board. - More information at - <http://linuxsh.sourceforge.net/docs/7750overdrive.php3>. - -CONFIG_SH_HP620 - Select HP620 if configuring for a HP jornada HP620. - More information (hardware only) at - <http://www.hp.com/jornada/>. - -CONFIG_SH_HP680 - Select HP680 if configuring for a HP Jornada HP680. - More information (hardware only) at - <http://www.hp.com/jornada/products/680/>. - -CONFIG_SH_HP690 - Select HP690 if configuring for a HP Jornada HP690. - More information (hardware only) - at <http://www.hp.com/jornada/products/680/>. - -CONFIG_SH_CQREEK - Select CqREEK if configuring for a CqREEK SH7708 or SH7750. - More information at - <http://sources.redhat.com/ecos/hardware.html#SuperH>. - -CONFIG_SH_DMIDA - Select DMIDA if configuring for a DataMyte 4000 Industrial - Digital Assistant. More information at <http://www.dmida.com/>. - -CONFIG_SH_EC3104 - Select EC3104 if configuring for a system with an Eclipse - International EC3104 chip, e.g. the Harris AD2000. - -CONFIG_SH_DREAMCAST - Select Dreamcast if configuring for a SEGA Dreamcast. - More information at - <http://www.m17n.org/linux-sh/dreamcast/>. There is a - Dreamcast project is at <http://linuxdc.sourceforge.net/>. - -CONFIG_SH_SH2000 - SH-2000 is a single-board computer based around SH7709A chip - intended for embedded applications. - It has an Ethernet interface (CS8900A), direct connected - Compact Flash socket, three serial ports and PC-104 bus. - More information at <http://sh2000.sh-linux.org>. - -CONFIG_SH_UNKNOWN - "Bare CPU" aka "unknown" means an SH-based system which is not one - of the specific ones mentioned above, which means you need to enter - all sorts of stuff like CONFIG_MEMORY_START because the config - system doesn't already know what it is. You get a machine vector - without any platform-specific code in it, so things like the RTC may - not work. - - This option is for the early stages of porting to a new machine. - CONFIG_IDE If you say Y here, your kernel will be able to manage low cost mass storage units such as ATA/(E)IDE and ATAPI units. The most common @@ -198,6 +82,20 @@ CONFIG_PCI information about which PCI hardware does work under Linux and which doesn't. +CONFIG_PCI_GOBIOS + On PCI systems, the BIOS can be used to detect the PCI devices and + determine their configuration. However, some old PCI motherboards + have BIOS bugs and may crash if this is done. Also, some embedded + PCI-based systems don't have any BIOS at all. Linux can also try to + detect the PCI hardware directly without using the BIOS. + + With this option, you can specify how Linux should detect the PCI + devices. If you choose "BIOS", the BIOS will be used, if you choose + "Direct", the BIOS won't be used, and if you choose "Any", the + kernel will try the direct access method and falls back to the BIOS + if that doesn't work. If unsure, go with the default, which is + "Any". + CONFIG_MCA MicroChannel Architecture is found in some IBM PS/2 machines and laptops. It is a bus system similar to PCI or ISA. See @@ -252,6 +150,29 @@ CONFIG_PCMCIA and ds.o. If you want to compile it as a module, say M here and read <file:Documentation/modules.txt>. +CONFIG_KCORE_ELF + If you enabled support for /proc file system then the file + /proc/kcore will contain the kernel core image. This can be used + in gdb: + + $ cd /usr/src/linux ; gdb vmlinux /proc/kcore + + You have two choices here: ELF and A.OUT. Selecting ELF will make + /proc/kcore appear in ELF core format as defined by the Executable + and Linking Format specification. Selecting A.OUT will choose the + old "a.out" format which may be necessary for some old versions + of binutils or on some architectures. + + This is especially useful if you have compiled the kernel with the + "-g" option to preserve debugging information. It is mainly used + for examining kernel data structures on the live kernel so if you + don't understand what this means or are not a kernel hacker, just + leave it at its default value ELF. + +CONFIG_KCORE_AOUT + Not necessary unless you're using a very out-of-date binutils + version. You probably want KCORE_ELF. + CONFIG_BINFMT_ELF ELF (Executable and Linkable Format) is a format for libraries and executables used across different architectures and operating @@ -774,6 +695,109 @@ CONFIG_CF_ENABLER primary IDE drive (only tested for SanDisk). If in doubt, select 'N'. + +CONFIG_SH_GENERIC + Select Generic if configuring for a generic SuperH system. + The "generic" option compiles in *all* the possible hardware + support and relies on the sh_mv= kernel commandline option to choose + at runtime which routines to use. "MV" stands for "machine vector"; + each of the machines below is described by a machine vector. + + Select SolutionEngine if configuring for a Hitachi SH7709 + or SH7750/7750S evalutation board. + + Select Overdrive if configuring for a ST407750 Overdrive board. + More information at + <http://linuxsh.sourceforge.net/docs/7750overdrive.php3>. + + Select HP620 if configuring for a HP Jornada HP620. + More information (hardware only) at + <http://www.hp.com/jornada/>. + + Select HP680 if configuring for a HP Jornada HP680. + More information (hardware only) at + <http://www.hp.com/jornada/products/680/>. + + Select HP690 if configuring for a HP Jornada HP690. + More information (hardware only) at + <http://www.hp.com/jornada/products/680/>. + + Select CqREEK if configuring for a CqREEK SH7708 or SH7750. + More information at + <http://sources.redhat.com/ecos/hardware.html#SuperH>. + + Select DMIDA if configuring for a DataMyte 4000 Industrial + Digital Assistant. More information at <http://www.dmida.com/>. + + Select EC3104 if configuring for a system with an Eclipse + International EC3104 chip, e.g. the Harris AD2000 or Compaq Aero 8000. + + Select Dreamcast if configuring for a SEGA Dreamcast. + More information at + <http://www.m17n.org/linux-sh/dreamcast/>. There is a + Dreamcast project is at <http://linuxdc.sourceforge.net/>. + + Select BareCPU if you know what this means, and it applies + to your system. + +CONFIG_SH_SOLUTION_ENGINE + Select SolutionEngine if configuring for a Hitachi SH7709 + or SH7750 evalutation board. + +CONFIG_SH_7751_SOLUTION_ENGINE + Select 7751 SolutionEngine if configuring for a Hitachi SH7751 + evalutation board. + +CONFIG_SH_HP620 + Select HP620 if configuring for a HP jornada HP620. + More information (hardware only) at + <http://www.hp.com/jornada/>. + +CONFIG_SH_HP680 + Select HP680 if configuring for a HP Jornada HP680. + More information (hardware only) at + <http://www.hp.com/jornada/products/680/>. + +CONFIG_SH_HP690 + Select HP690 if configuring for a HP Jornada HP690. + More information (hardware only) + at <http://www.hp.com/jornada/products/680/>. + +CONFIG_SH_CQREEK + Select CqREEK if configuring for a CqREEK SH7708 or SH7750. + More information at + <http://sources.redhat.com/ecos/hardware.html#SuperH>. + +CONFIG_SH_DMIDA + Select DMIDA if configuring for a DataMyte 4000 Industrial + Digital Assistant. More information at <http://www.dmida.com/>. + +CONFIG_SH_EC3104 + Select EC3104 if configuring for a system with an Eclipse + International EC3104 chip, e.g. the Harris AD2000. + +CONFIG_SH_DREAMCAST + Select Dreamcast if configuring for a SEGA Dreamcast. + More information at + <http://www.m17n.org/linux-sh/dreamcast/>. There is a + Dreamcast project is at <http://linuxdc.sourceforge.net/>. + +CONFIG_SH_SH2000 + SH-2000 is a single-board computer based around SH7709A chip + intended for embedded applications. + It has an Ethernet interface (CS8900A), direct connected + Compact Flash socket, three serial ports and PC-104 bus. + More information at <http://sh2000.sh-linux.org>. + +CONFIG_SH_UNKNOWN + "Bare CPU" aka "unknown" means an SH-based system which is not one + of the specific ones mentioned above, which means you need to enter + all sorts of stuff like CONFIG_MEMORY_START because the config + system doesn't already know what it is. You get a machine vector + without any platform-specific code in it, so things like the RTC may + not work. + + This option is for the early stages of porting to a new machine. CONFIG_CPU_SUBTYPE_SH7707 Select the type of SuperH processor you have. This information is Index: arch/sh/kernel/entry.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/entry.S,v retrieving revision 1.2 diff -u -3 -p -r1.2 entry.S --- arch/sh/kernel/entry.S 29 Dec 2001 06:50:38 -0000 1.2 +++ arch/sh/kernel/entry.S 26 Feb 2002 08:10:47 -0000 @@ -15,12 +15,6 @@ #include <linux/config.h> -/* - * Define this to turn on compatibility with the previous - * system call ABI. This feature is not properly maintained. - */ -#undef COMPAT_OLD_SYSCALL_ABI - ! NOTE: ! GNU as (as of 2.9.1) changes bf/s into bt/s and bra, when the address ! to be jumped is too far, but it causes illegal slot exception. @@ -61,11 +55,8 @@ * These are offsets into the task-struct. */ flags = 4 -sigpending = 8 -need_resched = 20 -tsk_ptrace = 24 - -PT_TRACESYS = 0x00000002 +work = 8 +syscall_trace = work+1 ENOSYS = 38 EINVAL = 22 @@ -208,6 +199,7 @@ address_error_store: bra call_dae mov #1,r5 ! writeaccess = 1 + .align 2 call_dae: mov.l 1f, r0 mov.l @r0, r6 ! address @@ -275,50 +267,107 @@ debug_trap: nop .align 2 -1: .long SYMBOL_NAME(break_point_trap_software) - - .align 2 error: ! STI() - mov.l 1f, r0 + mov.l 2f, r0 jmp @r0 nop - .align 2 -1: .long SYMBOL_NAME(do_exception_error) - ! -! -! ENTRY(ret_from_fork) mov.l @r15+,r0 + mov r0, r4 ! Call schedule_tail + mov.l 3f, r1 + mova syscall_exit, r0 + jmp @r1 + lds r0, pr + + .align 2 +1: .long SYMBOL_NAME(break_point_trap_software) +2: .long SYMBOL_NAME(do_exception_error) +3: .long SYMBOL_NAME(schedule_tail) + + .align 2 +work_pending: + ! r1: current->work +#ifdef __LITTLE_ENDIAN__ +#else + swap.w r1, r0 + swap.b r0, r0 +#endif + and #0xff,r0 + ! r0: current->work.need_resched + tst r0, r0 + bt work_notifysig + + .align 2 +work_resched: mov.l 1f, r1 - jsr @r1 - mov r0, r4 - ! If we're being traced, return via syscall_ret_trace, otherwise - ! return directly to ret_from_syscall - stc k_current, r0 - mov.l @(tsk_ptrace,r0), r0 ! Is current PTRACE_SYSCALL'd? - mov #PT_TRACESYS, r1 - tst r1, r0 - bt ret_from_syscall - bra syscall_ret_trace - nop + jsr @r1 + nop + /* CLI */ + stc sr, r0 + or #0xf0, r0 + ldc r0, sr + ! + stc k_current, r1 + mov.l @(work,r1), r1 + mov.l 2f, r0 + and r1, r0 + tst r0, r0 + bt restore_all + bra work_pending + nop .align 2 -1: .long SYMBOL_NAME(schedule_tail) +work_notifysig: + ! r1: current->work +#ifdef __LITTLE_ENDIAN__ + swap.w r1, r0 +#else + swap.b r0, r0 +#endif + and #0xff,r0 + ! r0: current->work.sigpending + tst r0, r0 + bt restore_all + mov r15, r4 + mov #0, r5 + mov.l 3f, r1 + mova restore_all, r0 + jmp @r1 + lds r0, pr + +ENTRY(resume_userspace) + /* CLI */ + stc sr, r0 + or #0xf0, r0 + ldc r0, sr + ! + stc k_current, r1 + mov.l @(work,r1), r1 ! current->work + mov.l 2f, r0 + and r1, r0 + tst r0, r0 + bf work_pending + bra restore_all + nop + + .align 2 +1: .long SYMBOL_NAME(schedule) +2: ! ignore syscall trace counter +#ifdef __LITTLE_ENDIAN__ + .long 0xffff00ff +#else + .long 0xff00ffff +#endif +3: + .long SYMBOL_NAME(do_signal) /* - * Old syscall interface: - * - * Syscall #: R0 - * Arguments #0 to #3: R4--R7 - * more arguments: On the stack - * TRA: (number of arguments on the stack) x 4 - * - * New syscall interface: + * Syscall interface: * * Syscall #: R3 * Arguments #0 to #3: R4--R7 @@ -340,9 +389,10 @@ ENTRY(ret_from_fork) * argument. */ + .align 2 system_call: - mov.l __TRA, r9 - mov.l @r9, r8 + mov.l 1f, r9 + mov.l @r9, r8 ! Read from TRA (Trap Address) Register ! ! Is the trap argument >= 0x20? (TRA will be >= 0x80) mov #0x20, r9 @@ -354,217 +404,46 @@ system_call: mov #SYSCALL_NR, r14 add r15, r14 ! -#ifdef COMPAT_OLD_SYSCALL_ABI - mov #0x40, r9 - cmp/hs r9, r8 - bf/s old_abi_system_call - nop -#endif - ! New Syscall ABI add #-0x40, r8 shlr2 r8 shll8 r8 shll8 r8 ! r8 = num_args<<16 mov r3, r10 - or r8, r10 ! Encode syscall # and # of arguments + or r8, r10 ! Encode syscall # and # of arguments mov.l r10, @r14 ! set syscall_nr STI() - ! - stc k_current, r11 - mov.l @(tsk_ptrace,r11), r10 ! Is current PTRACE_SYSCALL'd? - mov #PT_TRACESYS, r11 - tst r11, r10 - bt 5f - ! Yes it is traced. - mov.l __syscall_trace, r11 ! Call syscall_trace() which notifies - jsr @r11 ! superior (will chomp R[0-7]) - nop - ! Reload R0-R4 from kernel stack, where the - ! parent may have modified them using - ! ptrace(POKEUSR). (Note that R0-R2 are - ! used by the system call handler directly - ! from the kernel stack anyway, so don't need - ! to be reloaded here.) This allows the parent - ! to rewrite system calls and args on the fly. - mov.l @(OFF_R4,r15), r4 ! arg0 - mov.l @(OFF_R5,r15), r5 - mov.l @(OFF_R6,r15), r6 - mov.l @(OFF_R7,r15), r7 ! arg3 - mov.l @(OFF_R3,r15), r3 ! syscall_nr - ! Arrange for syscall_trace() to be called - ! again as the system call returns. - mov.l __syscall_ret_trace, r10 - bra 6f - lds r10, pr - ! No it isn't traced. - ! Arrange for normal system call return. -5: mov.l __syscall_ret, r10 - lds r10, pr ! Call the system call handler through the table. - ! (both normal and ptrace'd) ! First check for bad syscall number -6: mov r3, r9 - mov.l __n_sys, r10 + mov r3, r9 + mov.l 2f, r10 ! Number of syscalls cmp/hs r10, r9 - bf 2f - ! Bad syscall number - rts ! go to syscall_ret or syscall_ret_trace - mov #-ENOSYS, r0 + bt syscall_badsys + ! ! Good syscall number -2: shll2 r9 ! x4 - mov.l __sct, r11 + stc k_current, r11 + add #syscall_trace, r11 + mov.b @r11, r10 + tst r10, r10 + bf syscall_trace_entry + ! +syscall_traced: + shll2 r9 ! x4 + mov.l 3f, r11 ! Load the address of sys_call_table add r11, r9 mov.l @r9, r11 - jmp @r11 ! jump to specific syscall handler + jsr @r11 ! jump to specific syscall handler nop - - ! In case of trace -syscall_ret_trace: mov.l r0, @(OFF_R0,r15) ! save the return value - mov.l __syscall_trace, r1 - mova SYMBOL_NAME(ret_from_syscall), r0 - jmp @r1 ! Call syscall_trace() which notifies superior - lds r0, pr ! Then return to ret_from_syscall() - - - -#ifdef COMPAT_OLD_SYSCALL_ABI -! Handle old ABI system call. -! Note that ptrace(SYSCALL) is not supported for the old ABI. -! At this point: -! r0, r4-7 as per ABI -! r8 = value of TRA register (= num_args<<2) -! r14 = points to SYSCALL_NR in stack frame -old_abi_system_call: - mov r0, r9 ! Save system call number in r9 - ! ! arrange for return which pops stack - mov.l __old_abi_syscall_ret, r10 - lds r10, pr - ! Build the stack frame if TRA > 0 - mov r8, r10 - cmp/pl r10 - bf 0f - mov.l @(OFF_SP,r15), r0 ! get original user stack -7: add #-4, r10 -4: mov.l @(r0,r10), r1 ! May cause address error exception.. - mov.l r1, @-r15 - cmp/pl r10 - bt 7b -0: - mov.l r9, @r14 ! set syscall_nr - STI() - ! Call the system call handler through the table. - ! First check for bad syscall number - mov.l __n_sys, r10 - cmp/hs r10, r9 - bf 2f - ! Bad syscall number - rts ! return to old_abi_syscall_ret - mov #-ENOSYS, r0 - ! Good syscall number -2: shll2 r9 ! x4 - mov.l __sct, r11 - add r11, r9 - mov.l @r9, r11 - jmp @r11 ! call specific syscall handler, - nop - - .align 2 -__old_abi_syscall_ret: - .long old_abi_syscall_ret - - ! This code gets called on address error exception when copying - ! syscall arguments from user stack to kernel stack. It is - ! supposed to return -EINVAL through old_abi_syscall_ret, but it - ! appears to have been broken for a long time in that the r0 - ! return value will be saved into the kernel stack relative to r15 - ! but the value of r15 is not correct partway through the loop. - ! So the user prog is returned its old r0 value, not -EINVAL. - ! Greg Banks 28 Aug 2000. - .section .fixup,"ax" -fixup_syscall_argerr: - ! First get r15 back to - rts - mov #-EINVAL, r0 - .previous - - .section __ex_table, "a" - .align 2 - .long 4b,fixup_syscall_argerr - .previous -#endif - - .align 2 -__TRA: .long TRA -__syscall_trace: - .long SYMBOL_NAME(syscall_trace) -__n_sys:.long NR_syscalls -__sct: .long SYMBOL_NAME(sys_call_table) -__syscall_ret_trace: - .long syscall_ret_trace -__syscall_ret: - .long syscall_ret -__INV_IMASK: - .long 0xffffff0f ! ~(IMASK) - - - .align 2 -reschedule: - mova SYMBOL_NAME(ret_from_syscall), r0 - mov.l 1f, r1 - jmp @r1 - lds r0, pr - .align 2 -1: .long SYMBOL_NAME(schedule) - -ret_from_irq: -ret_from_exception: - mov #OFF_SR, r0 - mov.l @(r0,r15), r0 ! get status register - shll r0 - shll r0 ! kernel space? - bt restore_all ! Yes, it's from kernel, go back soon - ! - bra ret_from_syscall - nop - - .align 2 -#ifdef COMPAT_OLD_SYSCALL_ABI -old_abi_syscall_ret: - add r8, r15 ! pop off the arguments - /* fall through */ -#endif -syscall_ret: - mov.l r0, @(OFF_R0,r15) ! save the return value - /* fall through */ - -ENTRY(ret_from_syscall) +syscall_exit: /* CLI */ stc sr, r0 or #0xf0, r0 ldc r0, sr ! stc k_current, r1 - mov.l @(need_resched,r1), r0 - tst r0, r0 - bf reschedule - mov.l @(sigpending,r1), r0 - tst r0, r0 - bt restore_all -signal_return: - mov r15, r4 - mov #0, r5 - mov.l __do_signal, r1 - mova restore_all, r0 - jmp @r1 - lds r0, pr - .align 2 -__do_signal: - .long SYMBOL_NAME(do_signal) -__irq_stat: - .long SYMBOL_NAME(irq_stat) - - .align 2 + mov.l @(work,r1), r1 ! current->work + tst r1, r1 + bf syscall_exit_work restore_all: mov.l @r15+, r0 mov.l @r15+, r1 @@ -576,8 +455,8 @@ restore_all: mov.l @r15+, r7 ! stc sr, r8 - mov.l __blrb_flags, r9 ! BL =1, RB=1 - or r9, r8 + mov.l 7f, r9 + or r9, r8 ! BL =1, RB=1 ldc r8, sr ! here, change the register bank ! mov.l @r15+, r8 @@ -598,10 +477,10 @@ restore_all: ! ! Calculate new SR value mov k3, k2 ! original SR value - mov.l 1f, k1 + mov.l 8f, k1 stc sr, k0 and k1, k0 ! Get current FD-bit - mov.l 2f, k1 + mov.l 9f, k1 and k1, k2 ! Mask orignal SR value or k0, k2 ! Inherit current FD-bit ! @@ -609,11 +488,11 @@ restore_all: shlr2 k0 and #0x3c, k0 cmp/eq #0x3c, k0 - bt/s 7f + bt/s 6f shll2 k0 mov g_imask, k0 ! -7: or k0, k2 ! Set the IMASK-bits +6: or k0, k2 ! Set the IMASK-bits ldc k2, ssr ! mov k4, r15 @@ -621,10 +500,82 @@ restore_all: nop .align 2 -__blrb_flags: .long 0x30000000 -1: .long 0x00008000 ! FD -2: .long 0xffff7f0f ! ~(IMASK+FD) -3: .long 0x00080000 ! SZ=0, PR=1 +1: .long TRA +2: .long NR_syscalls +3: .long SYMBOL_NAME(sys_call_table) +7: .long 0x30000000 +8: .long 0x00008000 ! FD +9: .long 0xffff7f0f ! ~(IMASK+FD) + + .align 2 +syscall_trace_entry: + ! Yes it is traced. + ! XXX setup arguments... + mov.l 1f, r11 ! Call do_syscall_trace which notifies + jsr @r11 ! superior (will chomp R[0-7]) + nop + ! Reload R0-R4 from kernel stack, where the + ! parent may have modified them using + ! ptrace(POKEUSR). (Note that R0-R2 are + ! used by the system call handler directly + ! from the kernel stack anyway, so don't need + ! to be reloaded here.) This allows the parent + ! to rewrite system calls and args on the fly. + mov.l @(OFF_R4,r15), r4 ! arg0 + mov.l @(OFF_R5,r15), r5 + mov.l @(OFF_R6,r15), r6 + mov.l @(OFF_R7,r15), r7 ! arg3 + mov.l @(OFF_R3,r15), r3 ! syscall_nr + ! Arrange for do_syscall_trace to be called + ! again as the system call returns. + mov.l 2f, r10 ! Number of syscalls + cmp/hs r10, r3 + bf syscall_traced + bra syscall_exit + mov #-ENOSYS, r0 + + .align 2 +syscall_exit_work: + ! r1: current->work +#ifdef __LITTLE_ENDIAN__ + swap.b r1, r0 +#else + swap.w r1, r0 +#endif + and #0xff,r0 + ! r0: current->work.syscall_trace + tst r0, r0 + bt work_pending + STI() + ! XXX setup arguments... + mov.l 1f, r0 + jsr @r0 + nop + bra resume_userspace + nop + + .align 2 +1: .long SYMBOL_NAME(do_syscall_trace) +2: .long NR_syscalls +__INV_IMASK: + .long 0xffffff0f ! ~(IMASK) + + .align 2 +syscall_badsys: ! Bad syscall number + bra resume_userspace + mov #-ENOSYS, r0 + + .align 2 +ret_from_irq: +ret_from_exception: + mov #OFF_SR, r0 + mov.l @(r0,r15), r0 ! get status register + shll r0 + shll r0 ! kernel space? + bt restore_all ! Yes, it's from kernel, go back soon + ! + bra resume_userspace + nop ! Exception Vector Base ! @@ -641,8 +592,8 @@ general_exception: bra handle_exception mov.l @k2, k2 .align 2 -2: .long ret_from_exception 1: .long EXPEVT +2: .long ret_from_exception ! ! .balign 1024,0,1024 @@ -667,6 +618,7 @@ interrupt: ! ! + .align 2 handle_exception: ! Using k0, k1 for scratch registers (r0_bank1, r1_bank), ! save all registers onto stack. @@ -674,7 +626,7 @@ handle_exception: stc ssr, k0 ! Is it from kernel space? shll k0 ! Check MD bit (bit30) by shifting it into... shll k0 ! ...the T bit - bt/s 9f ! It's a kernel to kernel transition. + bt/s 1f ! It's a kernel to kernel transition. mov r15, k0 ! save original stack to k0 /* User space to kernel */ mov #0x20, k1 @@ -682,8 +634,8 @@ handle_exception: add current, k1 mov k1, r15 ! change to kernel stack ! -9: mov #-1, k4 - mov.l 3f, k1 +1: mov #-1, k4 + mov.l 2f, k1 ! Save the user registers on the stack. mov.l k4, @-r15 ! syscall_nr (default: -1) ! @@ -707,7 +659,7 @@ handle_exception: ! stc sr, r8 ! Back to normal register bank, and or k1, r8 ! Block all interrupts - mov.l 5f, k1 + mov.l 3f, k1 and k1, r8 ! ... ldc r8, sr ! ...changed here. ! @@ -723,17 +675,18 @@ handle_exception: stc k_ex_code, r8 shlr2 r8 shlr r8 - mov.l 1f, r9 + mov.l 4f, r9 add r8, r9 mov.l @r9, r9 jmp @r9 nop + .align 2 -1: .long SYMBOL_NAME(exception_handling_table) -3: .long 0x000000f0 ! FD=0, IMASK=15 -5: .long 0xcfffffff ! RB=0, BL=0 -6: .long 0x00080000 ! SZ=0, PR=1 +2: .long 0x000000f0 ! FD=0, IMASK=15 +3: .long 0xcfffffff ! RB=0, BL=0 +4: .long SYMBOL_NAME(exception_handling_table) + .align 2 none: rts nop @@ -1195,14 +1148,24 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_madvise) .long SYMBOL_NAME(sys_getdents64) /* 220 */ .long SYMBOL_NAME(sys_fcntl64) + .long SYMBOL_NAME(sys_ni_syscall) /* reserved for TUX */ + .long SYMBOL_NAME(sys_ni_syscall) /* Reserved for Security */ + .long SYMBOL_NAME(sys_gettid) + .long SYMBOL_NAME(sys_readahead) /* 225 */ + .long SYMBOL_NAME(sys_setxattr) + .long SYMBOL_NAME(sys_lsetxattr) + .long SYMBOL_NAME(sys_fsetxattr) + .long SYMBOL_NAME(sys_getxattr) + .long SYMBOL_NAME(sys_lgetxattr) /* 230 */ + .long SYMBOL_NAME(sys_fgetxattr) + .long SYMBOL_NAME(sys_listxattr) + .long SYMBOL_NAME(sys_llistxattr) + .long SYMBOL_NAME(sys_flistxattr) + .long SYMBOL_NAME(sys_removexattr) /* 235 */ + .long SYMBOL_NAME(sys_lremovexattr) + .long SYMBOL_NAME(sys_fremovexattr) - /* - * NOTE!! This doesn't have to be exact - we just have - * to make sure we have _enough_ of the "sys_ni_syscall" - * entries. Don't panic if you notice that this hasn't - * been shrunk every time we add a new system call. - */ - .rept NR_syscalls-221 + .rept NR_syscalls-(.-sys_call_table)/4 .long SYMBOL_NAME(sys_ni_syscall) .endr Index: arch/sh/kernel/ptrace.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/ptrace.c,v retrieving revision 1.1 diff -u -3 -p -r1.1 ptrace.c --- arch/sh/kernel/ptrace.c 15 Oct 2001 20:44:51 -0000 1.1 +++ arch/sh/kernel/ptrace.c 26 Feb 2002 08:10:47 -0000 @@ -191,15 +191,11 @@ asmlinkage int sys_ptrace(long request, ret = ptrace_attach(child); goto out_tsk; } - ret = -ESRCH; - if (!(child->ptrace & PT_PTRACED)) - goto out_tsk; - if (child->state != TASK_STOPPED) { - if (request != PTRACE_KILL) - goto out_tsk; - } - if (child->p_pptr != tsk) + + ret = ptrace_check_attach(child, request == PTRACE_KILL); + if (ret < 0) goto out_tsk; + switch (request) { /* when I and D space are separate, these will need to be fixed. */ case PTRACE_PEEKTEXT: /* read word at location addr. */ @@ -279,9 +275,9 @@ asmlinkage int sys_ptrace(long request, if ((unsigned long) data > _NSIG) break; if (request == PTRACE_SYSCALL) - child->ptrace |= PT_TRACESYS; + child->ptrace |= PT_SYSCALLTRACE; else - child->ptrace &= ~PT_TRACESYS; + child->ptrace &= ~PT_SYSCALLTRACE; child->exit_code = data; wake_up_process(child); ret = 0; @@ -312,7 +308,7 @@ asmlinkage int sys_ptrace(long request, ret = -EIO; if ((unsigned long) data > _NSIG) break; - child->ptrace &= ~PT_TRACESYS; + child->ptrace &= ~PT_SYSCALLTRACE; if ((child->ptrace & PT_DTRACE) == 0) { /* Spurious delayed TF traps may occur */ child->ptrace |= PT_DTRACE; @@ -376,12 +372,12 @@ out: return ret; } -asmlinkage void syscall_trace(void) +asmlinkage void do_syscall_trace(void) { struct task_struct *tsk = current; - if ((tsk->ptrace & (PT_PTRACED|PT_TRACESYS)) - != (PT_PTRACED|PT_TRACESYS)) + if ((tsk->ptrace & (PT_PTRACED|PT_SYSCALLTRACE)) + != (PT_PTRACED|PT_SYSCALLTRACE)) return; /* the 0x80 provides a way for the tracing parent to distinguish between a syscall stop and SIGTRAP delivery */ Index: drivers/Makefile =================================================================== RCS file: /cvsroot/linuxsh/linux/drivers/Makefile,v retrieving revision 1.2 diff -u -3 -p -r1.2 Makefile --- drivers/Makefile 3 Dec 2001 22:15:34 -0000 1.2 +++ drivers/Makefile 26 Feb 2002 08:10:47 -0000 @@ -10,7 +10,7 @@ mod-subdirs := dio mtd sbus video macint message/i2o message/fusion scsi md ieee1394 pnp isdn atm \ fc4 net/hamradio i2c acpi bluetooth maple -subdir-y := parport char block net sound misc media cdrom hotplug +subdir-y := base parport char block net sound misc media cdrom hotplug subdir-m := $(subdir-y) Index: drivers/char/Config.help =================================================================== RCS file: /cvsroot/linuxsh/linux/drivers/char/Config.help,v retrieving revision 1.1 diff -u -3 -p -r1.1 Config.help --- drivers/char/Config.help 25 Jan 2002 02:07:59 -0000 1.1 +++ drivers/char/Config.help 26 Feb 2002 08:10:47 -0000 @@ -818,6 +818,28 @@ CONFIG_INTEL_RNG If unsure, say N. +CONFIG_WATCHDOG + If you say Y here (and to one of the following options) and create a + character special file /dev/watchdog with major number 10 and minor + number 130 using mknod ("man mknod"), you will get a watchdog, i.e.: + subsequently opening the file and then failing to write to it for + longer than 1 minute will result in rebooting the machine. This + could be useful for a networked machine that needs to come back + online as fast as possible after a lock-up. There's both a watchdog + implementation entirely in software (which can sometimes fail to + reboot the machine) and a driver for hardware watchdog boards, which + are more robust and can also keep track of the temperature inside + your computer. For details, read <file:Documentation/watchdog.txt> + in the kernel source. + + The watchdog is usually used together with the watchdog daemon + which is available from + <ftp://ibiblio.org/pub/Linux/system/daemons/watchdog/>. This daemon can + also monitor NFS connections and can reboot the machine when the process + table is full. + + If unsure, say N. + CONFIG_WATCHDOG_NOWAYOUT The default watchdog behaviour (which you get if you say N here) is to stop the timer if the process managing it closes the file Index: include/asm-sh/bitops.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/bitops.h,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 bitops.h --- include/asm-sh/bitops.h 15 Oct 2001 20:45:06 -0000 1.1.1.1 +++ include/asm-sh/bitops.h 26 Feb 2002 08:10:47 -0000 @@ -186,6 +186,26 @@ static __inline__ unsigned long ffz(unsi return result; } +/** + * __ffs - find first bit in word. + * @word: The word to search + * + * Undefined if no bit exists, so code should check against 0 first. + */ +static __inline__ unsigned long __ffs(unsigned long word) +{ + unsigned long result; + + __asm__("1:\n\t" + "shlr %1\n\t" + "bf/s 1b\n\t" + " add #1, %0" + : "=r" (result), "=r" (word) + : "0" (~0L), "1" (word) + : "t"); + return result; +} + static __inline__ int find_next_zero_bit(void *addr, int size, int offset) { unsigned long *p = ((unsigned long *) addr) + (offset >> 5); Index: include/asm-sh/mmu_context.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/mmu_context.h,v retrieving revision 1.4 diff -u -3 -p -r1.4 mmu_context.h --- include/asm-sh/mmu_context.h 24 Jan 2002 11:20:11 -0000 1.4 +++ include/asm-sh/mmu_context.h 26 Feb 2002 08:10:47 -0000 @@ -166,7 +166,7 @@ static __inline__ void switch_mm(struct struct mm_struct *next, struct task_struct *tsk, unsigned int cpu) { - if (prev != next) { + if (likely(prev != next)) { unsigned long __pgdir = (unsigned long)next->pgd; clear_bit(cpu, &prev->cpu_vm_mask); @@ -196,7 +196,7 @@ enter_lazy_tlb(struct mm_struct *mm, str # error update this function. #endif -static inline int sched_find_first_zero_bit(unsigned long *b) +static inline int sched_find_first_bit(unsigned long *b) { unsigned int rt; @@ -207,6 +207,17 @@ static inline int sched_find_first_zero_ if (b[4] != ~0) return ffz(b[4]) + MAX_RT_PRIO; return ffz(b[5]) + 32 + MAX_RT_PRIO; + if (unlikely(b[0])) + return __ffs(b[0]); + if (unlikely(b[1])) + return __ffs(b[1]) + 32; + if (unlikely(b[2])) + return __ffs(b[2]) + 64; + if (unlikely(b[3])) + return __ffs(b[3]) + 96; + if (b[4]) + return __ffs(b[4]) + 128; + return __ffs(b[5]) + 32 + 128; } #endif /* __ASM_SH_MMU_CONTEXT_H */ Index: include/asm-sh/unistd.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/unistd.h,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 unistd.h --- include/asm-sh/unistd.h 15 Oct 2001 20:45:10 -0000 1.1.1.1 +++ include/asm-sh/unistd.h 26 Feb 2002 08:10:47 -0000 @@ -231,6 +231,20 @@ #define __NR_madvise 219 #define __NR_getdents64 220 #define __NR_fcntl64 221 +#define __NR_security 223 /* syscall for security modules */ +#define __NR_gettid 224 +#define __NR_setxattr 226 +#define __NR_lsetxattr 227 +#define __NR_fsetxattr 228 +#define __NR_getxattr 229 +#define __NR_lgetxattr 230 +#define __NR_fgetxattr 231 +#define __NR_listxattr 232 +#define __NR_llistxattr 233 +#define __NR_flistxattr 234 +#define __NR_removexattr 235 +#define __NR_lremovexattr 236 +#define __NR_fremovexattr 237 /* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */ |