• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/arch/powerpc/platforms/cell/
1/*
2 * SPU core dump code
3 *
4 * (C) Copyright 2006 IBM Corp.
5 *
6 * Author: Dwayne Grant McConnell <decimal@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/file.h>
24#include <linux/module.h>
25#include <linux/syscalls.h>
26
27#include <asm/spu.h>
28
29static struct spu_coredump_calls *spu_coredump_calls;
30static DEFINE_MUTEX(spu_coredump_mutex);
31
32int arch_notes_size(void)
33{
34	long ret;
35
36	ret = -ENOSYS;
37	mutex_lock(&spu_coredump_mutex);
38	if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
39		ret = spu_coredump_calls->arch_notes_size();
40		module_put(spu_coredump_calls->owner);
41	}
42	mutex_unlock(&spu_coredump_mutex);
43	return ret;
44}
45
46void arch_write_notes(struct file *file)
47{
48	mutex_lock(&spu_coredump_mutex);
49	if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
50		spu_coredump_calls->arch_write_notes(file);
51		module_put(spu_coredump_calls->owner);
52	}
53	mutex_unlock(&spu_coredump_mutex);
54}
55
56int register_arch_coredump_calls(struct spu_coredump_calls *calls)
57{
58	int ret = 0;
59
60
61	mutex_lock(&spu_coredump_mutex);
62	if (spu_coredump_calls)
63		ret = -EBUSY;
64	else
65		spu_coredump_calls = calls;
66	mutex_unlock(&spu_coredump_mutex);
67	return ret;
68}
69EXPORT_SYMBOL_GPL(register_arch_coredump_calls);
70
71void unregister_arch_coredump_calls(struct spu_coredump_calls *calls)
72{
73	BUG_ON(spu_coredump_calls != calls);
74
75	mutex_lock(&spu_coredump_mutex);
76	spu_coredump_calls = NULL;
77	mutex_unlock(&spu_coredump_mutex);
78}
79EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);
80