From f037360f2ed111fe89a8f5cb6ba351f4e9934e53 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 13 Nov 2005 16:06:57 -0800 Subject: [PATCH] m68k: thread_info header cleanup a) in smp_lock.h #include of sched.h and spinlock.h moved under #ifdef CONFIG_LOCK_KERNEL. b) interrupt.h now explicitly pulls sched.h (not via smp_lock.h from hardirq.h as it used to) c) in three more places we need changes to compensate for (a) - one place in arch/sparc needs string.h now, hardirq.h needs forward declaration of task_struct and preempt.h needs direct include of thread_info.h. d) thread_info-related helpers in sched.h and thread_info.h put under ifndef __HAVE_THREAD_FUNCTIONS. Obviously safe. Signed-off-by: Al Viro Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/lib/bitext.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/sparc') diff --git a/arch/sparc/lib/bitext.c b/arch/sparc/lib/bitext.c index 94b05e8c906..2e168d16547 100644 --- a/arch/sparc/lib/bitext.c +++ b/arch/sparc/lib/bitext.c @@ -10,6 +10,7 @@ */ #include +#include #include #include -- cgit v1.2.3 From 4a6dae6d382e9edf3ff440b819e554ed706359bc Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Sun, 13 Nov 2005 16:07:24 -0800 Subject: [PATCH] atomic: cmpxchg Introduce an atomic_cmpxchg operation. Signed-off-by: Nick Piggin Cc: "Paul E. McKenney" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/lib/atomic32.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index 2e64e8c3e8e..be46f654518 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c @@ -37,17 +37,28 @@ int __atomic_add_return(int i, atomic_t *v) spin_unlock_irqrestore(ATOMIC_HASH(v), flags); return ret; } +EXPORT_SYMBOL(__atomic_add_return); -void atomic_set(atomic_t *v, int i) +int atomic_cmpxchg(atomic_t *v, int old, int new) { + int ret; unsigned long flags; - spin_lock_irqsave(ATOMIC_HASH(v), flags); - v->counter = i; + spin_lock_irqsave(ATOMIC_HASH(v), flags); + ret = v->counter; + if (likely(ret == old)) + v->counter = new; spin_unlock_irqrestore(ATOMIC_HASH(v), flags); + return ret; } -EXPORT_SYMBOL(__atomic_add_return); -EXPORT_SYMBOL(atomic_set); +void atomic_set(atomic_t *v, int i) +{ + unsigned long flags; + spin_lock_irqsave(ATOMIC_HASH(v), flags); + v->counter = i; + spin_unlock_irqrestore(ATOMIC_HASH(v), flags); +} +EXPORT_SYMBOL(atomic_set); -- cgit v1.2.3 From 8426e1f6af0fd7f44d040af7263750c5a52f3cc3 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Sun, 13 Nov 2005 16:07:25 -0800 Subject: [PATCH] atomic: inc_not_zero Introduce an atomic_inc_not_zero operation. Make this a special case of atomic_add_unless because lockless pagecache actually wants atomic_inc_not_negativeone due to its offset refcount. Signed-off-by: Nick Piggin Cc: "Paul E. McKenney" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/lib/atomic32.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'arch/sparc') diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index be46f654518..cb3cf0f2282 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c @@ -53,6 +53,21 @@ int atomic_cmpxchg(atomic_t *v, int old, int new) return ret; } +int atomic_add_unless(atomic_t *v, int a, int u) +{ + int ret; + unsigned long flags; + + spin_lock_irqsave(ATOMIC_HASH(v), flags); + ret = v->counter; + if (ret != u) + v->counter += a; + spin_unlock_irqrestore(ATOMIC_HASH(v), flags); + return ret != u; +} + +static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) +/* Atomic operations are already serializing */ void atomic_set(atomic_t *v, int i) { unsigned long flags; -- cgit v1.2.3 From 0b14c179a483e71ea41df2aa4a661760063115bd Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Mon, 21 Nov 2005 21:32:15 -0800 Subject: [PATCH] unpaged: VM_UNPAGED Although we tend to associate VM_RESERVED with remap_pfn_range, quite a few drivers set VM_RESERVED on areas which are then populated by nopage. The PageReserved removal in 2.6.15-rc1 changed VM_RESERVED not to free pages in zap_pte_range, without changing those drivers not to set it: so their pages just leak away. Let's not change miscellaneous drivers now: introduce VM_UNPAGED at the core, to flag the special areas where the ptes may have no struct page, or if they have then it's not to be touched. Replace most instances of VM_RESERVED in core mm by VM_UNPAGED. Force it on in remap_pfn_range, and the sparc and sparc64 io_remap_pfn_range. Revert addition of VM_RESERVED to powerpc vdso, it's not needed there. Is it needed anywhere? It still governs the mm->reserved_vm statistic, and special vmas not to be merged, and areas not to be core dumped; but could probably be eliminated later (the drivers are probably specifying it because in 2.4 it kept swapout off the vma, but in 2.6 we work from the LRU, which these pages don't get on). Use the VM_SHM slot for VM_UNPAGED, and define VM_SHM to 0: it serves no purpose whatsoever, and should be removed from drivers when we clean up. Signed-off-by: Hugh Dickins Acked-by: William Irwin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/mm/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/sparc') diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic.c index 9604893ffdb..0410bae681f 100644 --- a/arch/sparc/mm/generic.c +++ b/arch/sparc/mm/generic.c @@ -74,7 +74,7 @@ int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; /* See comment in mm/memory.c remap_pfn_range */ - vma->vm_flags |= VM_IO | VM_RESERVED; + vma->vm_flags |= VM_IO | VM_RESERVED | VM_UNPAGED; prot = __pgprot(pg_iobits); offset -= from; -- cgit v1.2.3 From f3d48f0373c14a6203202f7b1dfc7b0d8aaf6ed2 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Mon, 21 Nov 2005 21:32:22 -0800 Subject: [PATCH] unpaged: fix sound Bad page states Earlier I unifdefed PageCompound, so that snd_pcm_mmap_control_nopage and others can give out a 0-order component of a higher-order page, which won't be mistakenly freed when zap_pte_range unmaps it. But many Bad page states reported a PG_reserved was freed after all: I had missed that we need to say __GFP_COMP to get compound page behaviour. Some of these higher-order pages are allocated by snd_malloc_pages, some by snd_malloc_dev_pages; or if SBUS, by sbus_alloc_consistent - but that has no gfp arg, so add __GFP_COMP into its sparc32/64 implementations. I'm still rather puzzled that DRM seems not to need a similar change. Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/kernel/ioport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index d0f2bd227c4..d39c9f20627 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c @@ -252,7 +252,7 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp) } order = get_order(len_total); - if ((va = __get_free_pages(GFP_KERNEL, order)) == 0) + if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0) goto err_nopages; if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) -- cgit v1.2.3 From 5cd9194a1b0b0fa219c31421ac64dfd38670ed49 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 28 Nov 2005 14:02:10 -0800 Subject: [PATCH] sparc: convert IO remapping to VM_PFNMAP Here are the Sparc bits. Signed-off-by: Linus Torvalds --- arch/sparc/mm/generic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic.c index 0410bae681f..2cb0728cee0 100644 --- a/arch/sparc/mm/generic.c +++ b/arch/sparc/mm/generic.c @@ -32,9 +32,7 @@ static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, unsigne if (end > PMD_SIZE) end = PMD_SIZE; do { - pte_t oldpage = *pte; - pte_clear(mm, address, pte); - set_pte(pte, mk_pte_io(offset, prot, space)); + set_pte_at(mm, address, pte, mk_pte_io(offset, prot, space)); address += PAGE_SIZE; offset += PAGE_SIZE; pte++; @@ -63,7 +61,7 @@ static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned } int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, - unsigned long pfn, unsigned long size, pgprot_t prot) + unsigned long pfn, unsigned long size, pgprot_t prot) { int error = 0; pgd_t * dir; @@ -74,7 +72,9 @@ int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; /* See comment in mm/memory.c remap_pfn_range */ - vma->vm_flags |= VM_IO | VM_RESERVED | VM_UNPAGED; + vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; + vma->vm_pgoff = (offset >> PAGE_SHIFT) | + ((unsigned long)space << 28UL); prot = __pgprot(pg_iobits); offset -= from; -- cgit v1.2.3 From 1d66a79dc8dd892c0db04396a0b1d05e0f53fe4f Mon Sep 17 00:00:00 2001 From: Paul Jackson Date: Mon, 12 Dec 2005 14:42:31 -0800 Subject: [SPARC]: atomic_clear_mask build fix This fixes one build error introduced in sparc with the patch of Oct 30, resent Nov 4 "[patch 3/5] atomic: atomic_inc_not_zero" I still can't get sparc to build, but at least it gets further after I remove this line. Apparently, this change was agreed to by Andrew and Nick on Nov 14, but everyone thought someone else was doing it. Signed-off-by: Paul Jackson Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- arch/sparc/lib/atomic32.c | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/sparc') diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index cb3cf0f2282..de84f8534ba 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c @@ -66,7 +66,6 @@ int atomic_add_unless(atomic_t *v, int a, int u) return ret != u; } -static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) /* Atomic operations are already serializing */ void atomic_set(atomic_t *v, int i) { -- cgit v1.2.3 From 1df2ab48f995b1599740a3f430df77fe24cb8ce9 Mon Sep 17 00:00:00 2001 From: Paul Jackson Date: Mon, 12 Dec 2005 14:42:44 -0800 Subject: [SPARC]: block/ needed in final image link With this fix, sparc links vmlinuz again using crosstool. Without this fix, the final link fails missing several dozen dozen symbols, beginning with: kernel/built-in.o(.text+0x6fd0): In function `do_exit': : undefined reference to `exit_io_context' (exit_io_context is defined in block/ll_rw_blk.c). Signed-off-by: Paul Jackson Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- arch/sparc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/sparc') diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index dea48f6cff3..4cdbb2d59ed 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -34,7 +34,7 @@ libs-y += arch/sparc/prom/ arch/sparc/lib/ # Renaming is done to avoid confusing pattern matching rules in 2.5.45 (multy-) INIT_Y := $(patsubst %/, %/built-in.o, $(init-y)) CORE_Y := $(core-y) -CORE_Y += kernel/ mm/ fs/ ipc/ security/ crypto/ +CORE_Y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ CORE_Y := $(patsubst %/, %/built-in.o, $(CORE_Y)) DRIVERS_Y := $(patsubst %/, %/built-in.o, $(drivers-y)) NET_Y := $(patsubst %/, %/built-in.o, $(net-y)) -- cgit v1.2.3 From f8ad23a401d41f90cb377035d206b41de0699a0b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 05:44:18 -0500 Subject: [PATCH] fix iomem annotations in sparc32 pcic code Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/kernel/pcic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index cccfc12802e..42002b742de 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c @@ -161,7 +161,7 @@ static struct pcic_sn2list pcic_known_sysnames[] = { static int pcic0_up; static struct linux_pcic pcic0; -void * __iomem pcic_regs; +void __iomem *pcic_regs; volatile int pcic_speculative; volatile int pcic_trapped; -- cgit v1.2.3 From c316ef0494eec2d08df2f083fc06fc06a6fd48c6 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 05:55:44 -0500 Subject: [PATCH] sparc/kernel/time: __iomem annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/kernel/time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c index 24814d58f9e..7dadcdb4ca4 100644 --- a/arch/sparc/kernel/time.c +++ b/arch/sparc/kernel/time.c @@ -49,7 +49,7 @@ DEFINE_SPINLOCK(rtc_lock); enum sparc_clock_type sp_clock_typ; DEFINE_SPINLOCK(mostek_lock); void __iomem *mstk48t02_regs = NULL; -static struct mostek48t08 *mstk48t08_regs = NULL; +static struct mostek48t08 __iomem *mstk48t08_regs = NULL; static int set_rtc_mmss(unsigned long); static int sbus_do_settimeofday(struct timespec *tv); @@ -342,7 +342,7 @@ static __inline__ void clock_probe(void) /* XXX r/o attribute is somewhere in r.flags */ r.flags = clk_reg[0].which_io; r.start = clk_reg[0].phys_addr; - mstk48t08_regs = (struct mostek48t08 *) sbus_ioremap(&r, 0, + mstk48t08_regs = sbus_ioremap(&r, 0, sizeof(struct mostek48t08), "mk48t08"); mstk48t02_regs = &mstk48t08_regs->regs; -- cgit v1.2.3 From e4fe342f932346a306f98f5401ad510b890c0a15 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 4 Dec 2005 18:48:45 -0500 Subject: [PATCH] sparc: NULL noise removal (ebus.c) Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/kernel/ebus.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c index 1754192c69d..5c3529ceb5d 100644 --- a/arch/sparc/kernel/ebus.c +++ b/arch/sparc/kernel/ebus.c @@ -22,7 +22,7 @@ #include #include -struct linux_ebus *ebus_chain = 0; +struct linux_ebus *ebus_chain = NULL; /* We are together with pcic.c under CONFIG_PCI. */ extern unsigned int pcic_pin_to_irq(unsigned int, char *name); @@ -46,7 +46,7 @@ static struct ebus_device_irq je1_1[] = { { "SUNW,CS4231", 0 }, { "parallel", 0 }, { "se", 2 }, - { 0, 0 } + { NULL, 0 } }; /* @@ -55,7 +55,7 @@ static struct ebus_device_irq je1_1[] = { */ static struct ebus_system_entry ebus_blacklist[] = { { "SUNW,JavaEngine1", je1_1 }, - { 0, 0 } + { NULL, NULL } }; static struct ebus_device_irq *ebus_blackp = NULL; @@ -233,7 +233,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev) ebus_alloc(sizeof(struct linux_ebus_child)); child = dev->children; - child->next = 0; + child->next = NULL; child->parent = dev; child->bus = dev->bus; fill_ebus_child(node, ®s[0], child); @@ -243,7 +243,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev) ebus_alloc(sizeof(struct linux_ebus_child)); child = child->next; - child->next = 0; + child->next = NULL; child->parent = dev; child->bus = dev->bus; fill_ebus_child(node, ®s[0], child); @@ -275,7 +275,7 @@ void __init ebus_init(void) } } - pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0); + pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, NULL); if (!pdev) { return; } @@ -284,7 +284,7 @@ void __init ebus_init(void) ebus_chain = ebus = (struct linux_ebus *) ebus_alloc(sizeof(struct linux_ebus)); - ebus->next = 0; + ebus->next = NULL; while (ebusnd) { @@ -325,8 +325,8 @@ void __init ebus_init(void) ebus_alloc(sizeof(struct linux_ebus_device)); dev = ebus->devices; - dev->next = 0; - dev->children = 0; + dev->next = NULL; + dev->children = NULL; dev->bus = ebus; fill_ebus_device(nd, dev); @@ -335,8 +335,8 @@ void __init ebus_init(void) ebus_alloc(sizeof(struct linux_ebus_device)); dev = dev->next; - dev->next = 0; - dev->children = 0; + dev->next = NULL; + dev->children = NULL; dev->bus = ebus; fill_ebus_device(nd, dev); } @@ -353,7 +353,7 @@ void __init ebus_init(void) ebus->next = (struct linux_ebus *) ebus_alloc(sizeof(struct linux_ebus)); ebus = ebus->next; - ebus->next = 0; + ebus->next = NULL; ++num_ebus; } if (pdev) -- cgit v1.2.3 From a32972965e23471f0762a1136f80990ebf72406a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 05:56:39 -0500 Subject: [PATCH] sun4c_memerr_reg __iomem annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/mm/sun4c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/sparc') diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 1d560390e28..731f19603ca 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -497,7 +497,7 @@ static void __init sun4c_probe_mmu(void) patch_kernel_fault_handler(); } -volatile unsigned long *sun4c_memerr_reg = NULL; +volatile unsigned long __iomem *sun4c_memerr_reg = NULL; void __init sun4c_probe_memerr_reg(void) { -- cgit v1.2.3 From 80ce8baf5da730c87194e2e38a4cfca0254f9599 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 06:04:55 -0500 Subject: [PATCH] arch/sparc/kernel/led.c __user annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/kernel/led.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c index 2a3afca453c..313d1620ae8 100644 --- a/arch/sparc/kernel/led.c +++ b/arch/sparc/kernel/led.c @@ -55,7 +55,7 @@ static int led_read_proc(char *buf, char **start, off_t offset, int count, return len; } -static int led_write_proc(struct file *file, const char *buffer, +static int led_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data) { char *buf = NULL; -- cgit v1.2.3 From 0b57ee9e55373a27e45549e82b0c43621480a71b Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Thu, 22 Dec 2005 21:03:47 -0800 Subject: [SPARC]: introduce a SPARC Kconfig symbol Introduce a Kconfig symbol SPARC that is defined on both the sparc and sparc64 architectures. This symbol makes some dependencies more readable. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch/sparc') diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 3cfb8be3ff6..56c34e7fd4e 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -55,6 +55,10 @@ config NR_CPUS depends on SMP default "32" +config SPARC + bool + default y + # Identify this as a Sparc32 build config SPARC32 bool -- cgit v1.2.3 From 597d1f0622d21ffe54aceef8da9682e776f51cc2 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 22 Dec 2005 23:04:39 -0800 Subject: [SPARC]: Kill CHILD_MAX. It's definition is wrong (-1 means "no limit" not 999), only the Sparc SunOS/Solaris compat code uses it, so let's just kill it off completely from limits.h and all referencing code. Noticed by Ulrich Drepper. Signed-off-by: David S. Miller --- arch/sparc/kernel/sys_sunos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c index 81c894acd0d..d07ae02101a 100644 --- a/arch/sparc/kernel/sys_sunos.c +++ b/arch/sparc/kernel/sys_sunos.c @@ -894,7 +894,7 @@ asmlinkage long sunos_sysconf (int name) ret = ARG_MAX; break; case _SC_CHILD_MAX: - ret = CHILD_MAX; + ret = -1; /* no limit */ break; case _SC_CLK_TCK: ret = HZ; -- cgit v1.2.3 From d5784b57d2e08a632b971baae23266121004ef3b Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 28 Dec 2005 13:22:54 -0800 Subject: [SPARC]: Use STABS_DEBUG and DWARF_DEBUG macros in vmlinux.lds.S Signed-off-by: David S. Miller --- arch/sparc/kernel/vmlinux.lds.S | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index 38938d2e63a..346c19a949f 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S @@ -85,19 +85,9 @@ SECTIONS } _end = . ; PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - .debug 0 : { *(.debug) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) } + + STABS_DEBUG + + DWARF_DEBUG } -- cgit v1.2.3 From 6b9c7ed84837753a436415097063232422e29a35 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 8 Jan 2006 01:02:33 -0800 Subject: [PATCH] use ptrace_get_task_struct in various places The ptrace_get_task_struct() helper that I added as part of the ptrace consolidation is useful in variety of places that currently opencode it. Switch them to the common helpers. Add a ptrace_traceme() helper that needs to be explicitly called, and simplify the ptrace_get_task_struct() interface. We don't need the request argument now, and we return the task_struct directly, using ERR_PTR() for error returns. It's a bit more code in the callers, but we have two sane routines that do one thing well now. Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/kernel/ptrace.c | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c index 475c4c13462..fc470c0e9dc 100644 --- a/arch/sparc/kernel/ptrace.c +++ b/arch/sparc/kernel/ptrace.c @@ -286,40 +286,17 @@ asmlinkage void do_ptrace(struct pt_regs *regs) s, (int) request, (int) pid, addr, data, addr2); } #endif - if (request == PTRACE_TRACEME) { - int my_ret; - - /* are we already being traced? */ - if (current->ptrace & PT_PTRACED) { - pt_error_return(regs, EPERM); - goto out; - } - my_ret = security_ptrace(current->parent, current); - if (my_ret) { - pt_error_return(regs, -my_ret); - goto out; - } - /* set the ptrace bit in the process flags. */ - current->ptrace |= PT_PTRACED; + if (request == PTRACE_TRACEME) { + ret = ptrace_traceme(); pt_succ_return(regs, 0); goto out; } -#ifndef ALLOW_INIT_TRACING - if (pid == 1) { - /* Can't dork with init. */ - pt_error_return(regs, EPERM); - goto out; - } -#endif - read_lock(&tasklist_lock); - child = find_task_by_pid(pid); - if (child) - get_task_struct(child); - read_unlock(&tasklist_lock); - if (!child) { - pt_error_return(regs, ESRCH); + child = ptrace_get_task_struct(pid); + if (IS_ERR(child)) { + ret = PTR_ERR(child); + pt_error_return(regs, -ret); goto out; } -- cgit v1.2.3 From e585e47031751f4e393e10ffd922885508b958dd Mon Sep 17 00:00:00 2001 From: Matt Mackall Date: Sun, 8 Jan 2006 01:05:24 -0800 Subject: [PATCH] tiny: Make *[ug]id16 support optional Configurable 16-bit UID and friends support This allows turning off the legacy 16 bit UID interfaces on embedded platforms. text data bss dec hex filename 3330172 529036 190556 4049764 3dcb64 vmlinux-baseline 3328268 529040 190556 4047864 3dc3f8 vmlinux From: Adrian Bunk UID16 was accidentially disabled for !EMBEDDED. Signed-off-by: Matt Mackall Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/Kconfig | 4 ---- 1 file changed, 4 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 56c34e7fd4e..f944b58cdfe 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -9,10 +9,6 @@ config MMU bool default y -config UID16 - bool - default y - config HIGHMEM bool default y -- cgit v1.2.3 From df2e71fb9115a8d4f721fb1464db09adc8332bc5 Mon Sep 17 00:00:00 2001 From: "akpm@osdl.org" Date: Mon, 9 Jan 2006 20:51:37 -0800 Subject: [PATCH] dump_thread() cleanup ) From: Adrian Bunk - create one common dump_thread() prototype in kernel.h - dump_thread() is only used in fs/binfmt_aout.c and can therefore be removed on all architectures where CONFIG_BINFMT_AOUT is not available Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/kernel/sparc_ksyms.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c index 1c8fd0fd930..0b0d492c953 100644 --- a/arch/sparc/kernel/sparc_ksyms.c +++ b/arch/sparc/kernel/sparc_ksyms.c @@ -82,8 +82,6 @@ extern int __lshrdi3(int, int); extern int __muldi3(int, int); extern int __divdi3(int, int); -extern void dump_thread(struct pt_regs *, struct user *); - /* Private functions with odd calling conventions. */ extern void ___atomic24_add(void); extern void ___atomic24_sub(void); -- cgit v1.2.3 From a9415644583ef344e02f84faf5fe24bfadb2af8e Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 11 Jan 2006 12:17:48 -0800 Subject: [PATCH] capable/capability.h (arch/) arch: Use where capable() is used. Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/kernel/sys_sunos.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c index d07ae02101a..288de276d9f 100644 --- a/arch/sparc/kernel/sys_sunos.c +++ b/arch/sparc/kernel/sys_sunos.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3 From d562ef6a23feb72f32ebd23fb32fe7d2c35a85cd Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 12 Jan 2006 01:05:46 -0800 Subject: [PATCH] sparc: task_thread_info() Signed-off-by: Al Viro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/kernel/process.c | 4 ++-- arch/sparc/kernel/ptrace.c | 4 ++-- arch/sparc/kernel/sun4d_smp.c | 2 +- arch/sparc/kernel/sun4m_smp.c | 2 +- arch/sparc/kernel/traps.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c index ea864741146..7eebb08a953 100644 --- a/arch/sparc/kernel/process.c +++ b/arch/sparc/kernel/process.c @@ -337,7 +337,7 @@ EXPORT_SYMBOL(dump_stack); */ unsigned long thread_saved_pc(struct task_struct *tsk) { - return tsk->thread_info->kpc; + return task_thread_info(tsk)->kpc; } /* @@ -724,7 +724,7 @@ unsigned long get_wchan(struct task_struct *task) task->state == TASK_RUNNING) goto out; - fp = task->thread_info->ksp + bias; + fp = task_thread_info(task)->ksp + bias; do { /* Bogus frame pointer? */ if (fp < (task_base + sizeof(struct thread_info)) || diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c index fc470c0e9dc..1baf13ed5c3 100644 --- a/arch/sparc/kernel/ptrace.c +++ b/arch/sparc/kernel/ptrace.c @@ -75,7 +75,7 @@ static inline void read_sunos_user(struct pt_regs *regs, unsigned long offset, struct task_struct *tsk, long __user *addr) { struct pt_regs *cregs = tsk->thread.kregs; - struct thread_info *t = tsk->thread_info; + struct thread_info *t = task_thread_info(tsk); int v; if(offset >= 1024) @@ -170,7 +170,7 @@ static inline void write_sunos_user(struct pt_regs *regs, unsigned long offset, struct task_struct *tsk) { struct pt_regs *cregs = tsk->thread.kregs; - struct thread_info *t = tsk->thread_info; + struct thread_info *t = task_thread_info(tsk); unsigned long value = regs->u_regs[UREG_I3]; if(offset >= 1024) diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index cc1fc898495..40d426cce82 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c @@ -200,7 +200,7 @@ void __init smp4d_boot_cpus(void) /* Cook up an idler for this guy. */ p = fork_idle(i); cpucount++; - current_set[i] = p->thread_info; + current_set[i] = task_thread_info(p); for (no = 0; !cpu_find_by_instance(no, NULL, &mid) && mid != i; no++) ; diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index f113422a372..a21f27d10e5 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c @@ -173,7 +173,7 @@ void __init smp4m_boot_cpus(void) /* Cook up an idler for this guy. */ p = fork_idle(i); cpucount++; - current_set[i] = p->thread_info; + current_set[i] = task_thread_info(p); /* See trampoline.S for details... */ entry += ((i-1) * 3); diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c index 3f451ae6648..41d45c298fb 100644 --- a/arch/sparc/kernel/traps.c +++ b/arch/sparc/kernel/traps.c @@ -291,7 +291,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, #ifndef CONFIG_SMP if(!fpt) { #else - if(!(fpt->thread_info->flags & _TIF_USEDFPU)) { + if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) { #endif fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth); regs->psr &= ~PSR_EF; @@ -334,7 +334,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, /* nope, better SIGFPE the offending process... */ #ifdef CONFIG_SMP - fpt->thread_info->flags &= ~_TIF_USEDFPU; + task_thread_info(fpt)->flags &= ~_TIF_USEDFPU; #endif if(psr & PSR_PS) { /* The first fsr store/load we tried trapped, -- cgit v1.2.3 From 36483c6b5e6cc8f29fbe5203caa7e0b836802747 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 12 Jan 2006 01:05:47 -0800 Subject: [PATCH] sparc: task_stack_page() Signed-off-by: Al Viro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/sparc/kernel/process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c index 7eebb08a953..fbb05a452e5 100644 --- a/arch/sparc/kernel/process.c +++ b/arch/sparc/kernel/process.c @@ -302,7 +302,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp) int count = 0; if (tsk != NULL) - task_base = (unsigned long) tsk->thread_info; + task_base = (unsigned long) task_stack_page(tsk); else task_base = (unsigned long) current_thread_info(); @@ -392,7 +392,7 @@ void flush_thread(void) /* We must fixup kregs as well. */ /* XXX This was not fixed for ti for a while, worked. Unused? */ current->thread.kregs = (struct pt_regs *) - ((char *)current->thread_info + (THREAD_SIZE - TRACEREG_SZ)); + (task_stack_page(current) + (THREAD_SIZE - TRACEREG_SZ)); } } @@ -459,7 +459,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, unsigned long unused, struct task_struct *p, struct pt_regs *regs) { - struct thread_info *ti = p->thread_info; + struct thread_info *ti = task_thread_info(p); struct pt_regs *childregs; char *new_stack; @@ -482,7 +482,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, * V V (stk.fr.) V (pt_regs) { (stk.fr.) } * +----- - - - - - ------+===========+============={+==========}+ */ - new_stack = (char*)ti + THREAD_SIZE; + new_stack = task_stack_page(p) + THREAD_SIZE; if (regs->psr & PSR_PS) new_stack -= STACKFRAME_SZ; new_stack -= STACKFRAME_SZ + TRACEREG_SZ; -- cgit v1.2.3 From 1ae613883468eab2fb8a077aad9fdedfbfa73d1b Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Tue, 17 Jan 2006 15:36:05 -0800 Subject: [SPARC]: change if() BUG(); to BUG_ON in iommu.c this patch changes if() BUG(); constructs in iommu.c to BUG_ON(); so it gets save to define BUG() and BUG_ON() to nullstatements. Signed-off-by: Eric Sesterhenn Signed-off-by: David S. Miller --- arch/sparc/mm/iommu.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index 489bf68d5f0..77840c80478 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c @@ -295,8 +295,7 @@ static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus) int ioptex; int i; - if (busa < iommu->start) - BUG(); + BUG_ON(busa < iommu->start); ioptex = (busa - iommu->start) >> PAGE_SHIFT; for (i = 0; i < npages; i++) { iopte_val(iommu->page_table[ioptex + i]) = 0; @@ -340,9 +339,9 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va, iopte_t *first; int ioptex; - if ((va & ~PAGE_MASK) != 0) BUG(); - if ((addr & ~PAGE_MASK) != 0) BUG(); - if ((len & ~PAGE_MASK) != 0) BUG(); + BUG_ON((va & ~PAGE_MASK) != 0); + BUG_ON((addr & ~PAGE_MASK) != 0); + BUG_ON((len & ~PAGE_MASK) != 0); /* page color = physical address */ ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT, @@ -405,8 +404,8 @@ static void iommu_unmap_dma_area(unsigned long busa, int len) unsigned long end; int ioptex = (busa - iommu->start) >> PAGE_SHIFT; - if ((busa & ~PAGE_MASK) != 0) BUG(); - if ((len & ~PAGE_MASK) != 0) BUG(); + BUG_ON((busa & ~PAGE_MASK) != 0); + BUG_ON((len & ~PAGE_MASK) != 0); iopte += ioptex; end = busa + len; -- cgit v1.2.3 From 2d7d5f05111a9d913131a2764d8b20157f8f758d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 19 Jan 2006 02:42:49 -0800 Subject: [SPARC]: Add support for *at(), ppoll, and pselect syscalls. This also includes by necessity _TIF_RESTORE_SIGMASK support, which actually resulted in a lot of cleanups. The sparc signal handling code is quite a mess and I should clean it up some day. Signed-off-by: David S. Miller --- arch/sparc/kernel/entry.S | 56 ------------------- arch/sparc/kernel/rtrap.S | 9 ++-- arch/sparc/kernel/signal.c | 117 +++++++++++----------------------------- arch/sparc/kernel/sparc_ksyms.c | 2 - arch/sparc/kernel/systbls.S | 10 +++- 5 files changed, 44 insertions(+), 150 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S index 03ecb4e4614..c51d08d218e 100644 --- a/arch/sparc/kernel/entry.S +++ b/arch/sparc/kernel/entry.S @@ -1276,62 +1276,6 @@ sys_sigstack: call do_sys_sigstack mov %l5, %o7 - .align 4 - .globl sys_sigpause -sys_sigpause: - /* Note: %o0 already has correct value... */ - call do_sigpause - add %sp, STACKFRAME_SZ, %o1 - - ld [%curptr + TI_FLAGS], %l5 - andcc %l5, _TIF_SYSCALL_TRACE, %g0 - be 1f - nop - - call syscall_trace - nop - -1: - /* We are returning to a signal handler. */ - RESTORE_ALL - - .align 4 - .globl sys_sigsuspend -sys_sigsuspend: - call do_sigsuspend - add %sp, STACKFRAME_SZ, %o0 - - ld [%curptr + TI_FLAGS], %l5 - andcc %l5, _TIF_SYSCALL_TRACE, %g0 - be 1f - nop - - call syscall_trace - nop - -1: - /* We are returning to a signal handler. */ - RESTORE_ALL - - .align 4 - .globl sys_rt_sigsuspend -sys_rt_sigsuspend: - /* Note: %o0, %o1 already have correct value... */ - call do_rt_sigsuspend - add %sp, STACKFRAME_SZ, %o2 - - ld [%curptr + TI_FLAGS], %l5 - andcc %l5, _TIF_SYSCALL_TRACE, %g0 - be 1f - nop - - call syscall_trace - nop - -1: - /* We are returning to a signal handler. */ - RESTORE_ALL - .align 4 .globl sys_sigreturn sys_sigreturn: diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap.S index f7460d897e7..77ca6fd8125 100644 --- a/arch/sparc/kernel/rtrap.S +++ b/arch/sparc/kernel/rtrap.S @@ -68,15 +68,14 @@ ret_trap_lockless_ipi: ld [%curptr + TI_FLAGS], %g2 signal_p: - andcc %g2, (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING), %g0 + andcc %g2, (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %g0 bz,a ret_trap_continue ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr - clr %o0 - mov %l5, %o2 - mov %l6, %o3 + mov %l5, %o1 + mov %l6, %o2 call do_signal - add %sp, STACKFRAME_SZ, %o1 ! pt_regs ptr + add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr /* Fall through. */ ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c index 5f34d7dc2b8..0748d8147bb 100644 --- a/arch/sparc/kernel/signal.c +++ b/arch/sparc/kernel/signal.c @@ -35,9 +35,6 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, void *fpqueue, unsigned long *fpqdepth); extern void fpload(unsigned long *fpregs, unsigned long *fsr); -asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, - unsigned long orig_o0, int restart_syscall); - /* Signal frames: the original one (compatible with SunOS): * * Set up a signal frame... Make the stack look the way SunOS @@ -95,98 +92,30 @@ struct rt_signal_frame { #define NF_ALIGNEDSZ (((sizeof(struct new_signal_frame) + 7) & (~7))) #define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7))) -/* - * atomically swap in the new signal mask, and wait for a signal. - * This is really tricky on the Sparc, watch out... - */ -asmlinkage void _sigpause_common(old_sigset_t set, struct pt_regs *regs) +static int _sigpause_common(old_sigset_t set) { - sigset_t saveset; - set &= _BLOCKABLE; spin_lock_irq(¤t->sighand->siglock); - saveset = current->blocked; + current->saved_sigmask = current->blocked; siginitset(¤t->blocked, set); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - regs->pc = regs->npc; - regs->npc += 4; - - /* Condition codes and return value where set here for sigpause, - * and so got used by setup_frame, which again causes sigreturn() - * to return -EINTR. - */ - while (1) { - current->state = TASK_INTERRUPTIBLE; - schedule(); - /* - * Return -EINTR and set condition code here, - * so the interrupted system call actually returns - * these. - */ - regs->psr |= PSR_C; - regs->u_regs[UREG_I0] = EINTR; - if (do_signal(&saveset, regs, 0, 0)) - return; - } -} + current->state = TASK_INTERRUPTIBLE; + schedule(); + set_thread_flag(TIF_RESTORE_SIGMASK); -asmlinkage void do_sigpause(unsigned int set, struct pt_regs *regs) -{ - _sigpause_common(set, regs); + return -ERESTARTNOHAND; } -asmlinkage void do_sigsuspend (struct pt_regs *regs) +asmlinkage int sys_sigpause(unsigned int set) { - _sigpause_common(regs->u_regs[UREG_I0], regs); + return _sigpause_common(set); } -asmlinkage void do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, - struct pt_regs *regs) +asmlinkage int sys_sigsuspend(old_sigset_t set) { - sigset_t oldset, set; - - /* XXX: Don't preclude handling different sized sigset_t's. */ - if (sigsetsize != sizeof(sigset_t)) { - regs->psr |= PSR_C; - regs->u_regs[UREG_I0] = EINVAL; - return; - } - - if (copy_from_user(&set, uset, sizeof(set))) { - regs->psr |= PSR_C; - regs->u_regs[UREG_I0] = EFAULT; - return; - } - - sigdelsetmask(&set, ~_BLOCKABLE); - spin_lock_irq(¤t->sighand->siglock); - oldset = current->blocked; - current->blocked = set; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - - regs->pc = regs->npc; - regs->npc += 4; - - /* Condition codes and return value where set here for sigpause, - * and so got used by setup_frame, which again causes sigreturn() - * to return -EINTR. - */ - while (1) { - current->state = TASK_INTERRUPTIBLE; - schedule(); - /* - * Return -EINTR and set condition code here, - * so the interrupted system call actually returns - * these. - */ - regs->psr |= PSR_C; - regs->u_regs[UREG_I0] = EINTR; - if (do_signal(&oldset, regs, 0, 0)) - return; - } + return _sigpause_common(set); } static inline int @@ -1067,13 +996,13 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, * want to handle. Thus you cannot kill init even with a SIGKILL even by * mistake. */ -asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, - unsigned long orig_i0, int restart_syscall) +asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int restart_syscall) { siginfo_t info; struct sparc_deliver_cookie cookie; struct k_sigaction ka; int signr; + sigset_t *oldset; /* * XXX Disable svr4 signal handling until solaris emulation works. @@ -1089,7 +1018,9 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, cookie.restart_syscall = restart_syscall; cookie.orig_i0 = orig_i0; - if (!oldset) + if (test_thread_flag(TIF_RESTORE_SIGMASK)) + oldset = ¤t->saved_sigmask; + else oldset = ¤t->blocked; signr = get_signal_to_deliver(&info, &ka, regs, &cookie); @@ -1098,7 +1029,14 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, syscall_restart(cookie.orig_i0, regs, &ka.sa); handle_signal(signr, &ka, &info, oldset, regs, svr4_signal); - return 1; + /* a signal was successfully delivered; the saved + * sigmask will have been stored in the signal frame, + * and will be restored by sigreturn, so we can simply + * clear the TIF_RESTORE_SIGMASK flag. + */ + if (test_thread_flag(TIF_RESTORE_SIGMASK)) + clear_thread_flag(TIF_RESTORE_SIGMASK); + return; } if (cookie.restart_syscall && (regs->u_regs[UREG_I0] == ERESTARTNOHAND || @@ -1115,7 +1053,14 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, regs->pc -= 4; regs->npc -= 4; } - return 0; + + /* if there's no signal to deliver, we just put the saved sigmask + * back + */ + if (test_thread_flag(TIF_RESTORE_SIGMASK)) { + clear_thread_flag(TIF_RESTORE_SIGMASK); + sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); + } } asmlinkage int diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c index 0b0d492c953..19b25399d7e 100644 --- a/arch/sparc/kernel/sparc_ksyms.c +++ b/arch/sparc/kernel/sparc_ksyms.c @@ -66,7 +66,6 @@ struct poll { extern int svr4_getcontext (svr4_ucontext_t *, struct pt_regs *); extern int svr4_setcontext (svr4_ucontext_t *, struct pt_regs *); -void _sigpause_common (unsigned int set, struct pt_regs *); extern void (*__copy_1page)(void *, const void *); extern void __memmove(void *, const void *, __kernel_size_t); extern void (*bzero_1page)(void *); @@ -227,7 +226,6 @@ EXPORT_SYMBOL(kunmap_atomic); /* Solaris/SunOS binary compatibility */ EXPORT_SYMBOL(svr4_setcontext); EXPORT_SYMBOL(svr4_getcontext); -EXPORT_SYMBOL(_sigpause_common); EXPORT_SYMBOL(dump_thread); diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S index e457a40838f..6877ae4cd1d 100644 --- a/arch/sparc/kernel/systbls.S +++ b/arch/sparc/kernel/systbls.S @@ -75,7 +75,10 @@ sys_call_table: /*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy /*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink /*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid -/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl +/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat +/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat +/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat +/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll #ifdef CONFIG_SUNOS_EMUL /* Now the SunOS syscall table. */ @@ -181,6 +184,11 @@ sunos_sys_table: .long sunos_nosys, sunos_nosys, sunos_nosys .long sunos_nosys /*280*/ .long sunos_nosys, sunos_nosys, sunos_nosys + .long sunos_nosys, sunos_nosys, sunos_nosys + .long sunos_nosys, sunos_nosys, sunos_nosys .long sunos_nosys +/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys + .long sunos_nosys, sunos_nosys, sunos_nosys + .long sunos_nosys, sunos_nosys, sunos_nosys #endif -- cgit v1.2.3