linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh: Fix build arch_ptrace function by init_fpu
@ 2011-03-29 11:36 Nobuhiro Iwamatsu
  2011-03-30  0:02 ` Kuninori Morimoto
  2011-03-30  1:20 ` Nobuhiro Iwamatsu
  0 siblings, 2 replies; 3+ messages in thread
From: Nobuhiro Iwamatsu @ 2011-03-29 11:36 UTC (permalink / raw)
  To: linux-sh

init_fpu can use only with CPU having FPU.
his was used in arch_ptrace, but came to use even the CPU which did not
have an FPU.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 arch/sh/kernel/ptrace_32.c |    4 ++++
 arch/sh/kernel/ptrace_64.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 2130ca6..e00ddad 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -394,9 +394,11 @@ long arch_ptrace(struct task_struct *child, long request,
 					tmp = 0;
 			} else {
 				unsigned long index;
+#ifdef CONFIG_SH_FPU
 				ret = init_fpu(child);
 				if (ret)
 					break;
+#endif
 				index = addr - offsetof(struct user, fpu);
 				tmp = ((unsigned long *)child->thread.xstate)
 					[index >> 2];
@@ -428,9 +430,11 @@ long arch_ptrace(struct task_struct *child, long request,
 		else if (addr >= offsetof(struct user, fpu) &&
 			 addr < offsetof(struct user, u_fpvalid)) {
 			unsigned long index;
+#ifdef CONFIG_SH_FPU
 			ret = init_fpu(child);
 			if (ret)
 				break;
+#endif
 			index = addr - offsetof(struct user, fpu);
 			set_stopped_child_used_math(child);
 			((unsigned long *)child->thread.xstate)
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index c8f9764..d675b0e 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -403,9 +403,11 @@ long arch_ptrace(struct task_struct *child, long request,
 		else if ((addr >= offsetof(struct user, fpu)) &&
 			 (addr <  offsetof(struct user, u_fpvalid))) {
 			unsigned long index;
+#ifdef CONFIG_SH_FPU
 			ret = init_fpu(child);
 			if (ret)
 				break;
+#endif
 			index = addr - offsetof(struct user, fpu);
 			tmp = get_fpu_long(child, index);
 		} else if (addr = offsetof(struct user, u_fpvalid)) {
@@ -445,9 +447,11 @@ long arch_ptrace(struct task_struct *child, long request,
 		else if ((addr >= offsetof(struct user, fpu)) &&
 			 (addr <  offsetof(struct user, u_fpvalid))) {
 			unsigned long index;
+#ifdef CONFIG_SH_FPU
 			ret = init_fpu(child);
 			if (ret)
 				break;
+#endif
 			index = addr - offsetof(struct user, fpu);
 			ret = put_fpu_long(child, index, data);
 		}
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sh: Fix build arch_ptrace function by init_fpu
  2011-03-29 11:36 [PATCH] sh: Fix build arch_ptrace function by init_fpu Nobuhiro Iwamatsu
@ 2011-03-30  0:02 ` Kuninori Morimoto
  2011-03-30  1:20 ` Nobuhiro Iwamatsu
  1 sibling, 0 replies; 3+ messages in thread
From: Kuninori Morimoto @ 2011-03-30  0:02 UTC (permalink / raw)
  To: linux-sh


Dear Iwamatsu san

> init_fpu can use only with CPU having FPU.
> his was used in arch_ptrace, but came to use even the CPU which did not
> have an FPU.
> 
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> ---
>  arch/sh/kernel/ptrace_32.c |    4 ++++
>  arch/sh/kernel/ptrace_64.c |    4 ++++
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
> index 2130ca6..e00ddad 100644
> --- a/arch/sh/kernel/ptrace_32.c
> +++ b/arch/sh/kernel/ptrace_32.c
> @@ -394,9 +394,11 @@ long arch_ptrace(struct task_struct *child, long request,
>  					tmp = 0;
>  			} else {
>  				unsigned long index;
> +#ifdef CONFIG_SH_FPU
>  				ret = init_fpu(child);
>  				if (ret)
>  					break;
> +#endif

How about modify "init_fpu" function side instead of this patch ?
I don't know detail but like this ?

int init_fpu(xxx) {

#ifdef CONFIG_SH_FPU
       ....
       ....
       ...
#endif

    return 0;
}


>  				index = addr - offsetof(struct user, fpu);
>  				tmp = ((unsigned long *)child->thread.xstate)
>  					[index >> 2];
> @@ -428,9 +430,11 @@ long arch_ptrace(struct task_struct *child, long request,
>  		else if (addr >= offsetof(struct user, fpu) &&
>  			 addr < offsetof(struct user, u_fpvalid)) {
>  			unsigned long index;
> +#ifdef CONFIG_SH_FPU
>  			ret = init_fpu(child);
>  			if (ret)
>  				break;
> +#endif
>  			index = addr - offsetof(struct user, fpu);
>  			set_stopped_child_used_math(child);
>  			((unsigned long *)child->thread.xstate)
> diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
> index c8f9764..d675b0e 100644
> --- a/arch/sh/kernel/ptrace_64.c
> +++ b/arch/sh/kernel/ptrace_64.c
> @@ -403,9 +403,11 @@ long arch_ptrace(struct task_struct *child, long request,
>  		else if ((addr >= offsetof(struct user, fpu)) &&
>  			 (addr <  offsetof(struct user, u_fpvalid))) {
>  			unsigned long index;
> +#ifdef CONFIG_SH_FPU
>  			ret = init_fpu(child);
>  			if (ret)
>  				break;
> +#endif
>  			index = addr - offsetof(struct user, fpu);
>  			tmp = get_fpu_long(child, index);
>  		} else if (addr = offsetof(struct user, u_fpvalid)) {
> @@ -445,9 +447,11 @@ long arch_ptrace(struct task_struct *child, long request,
>  		else if ((addr >= offsetof(struct user, fpu)) &&
>  			 (addr <  offsetof(struct user, u_fpvalid))) {
>  			unsigned long index;
> +#ifdef CONFIG_SH_FPU
>  			ret = init_fpu(child);
>  			if (ret)
>  				break;
> +#endif
>  			index = addr - offsetof(struct user, fpu);
>  			ret = put_fpu_long(child, index, data);
>  		}
> -- 
> 1.7.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Best regards
--
Kuninori Morimoto
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sh: Fix build arch_ptrace function by init_fpu
  2011-03-29 11:36 [PATCH] sh: Fix build arch_ptrace function by init_fpu Nobuhiro Iwamatsu
  2011-03-30  0:02 ` Kuninori Morimoto
@ 2011-03-30  1:20 ` Nobuhiro Iwamatsu
  1 sibling, 0 replies; 3+ messages in thread
From: Nobuhiro Iwamatsu @ 2011-03-30  1:20 UTC (permalink / raw)
  To: linux-sh

Hi,

2011/3/30 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
>
> Dear Iwamatsu san
>
>> init_fpu can use only with CPU having FPU.
>> his was used in arch_ptrace, but came to use even the CPU which did not
>> have an FPU.
>>
>> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
>> ---
>>  arch/sh/kernel/ptrace_32.c |    4 ++++
>>  arch/sh/kernel/ptrace_64.c |    4 ++++
>>  2 files changed, 8 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
>> index 2130ca6..e00ddad 100644
>> --- a/arch/sh/kernel/ptrace_32.c
>> +++ b/arch/sh/kernel/ptrace_32.c
>> @@ -394,9 +394,11 @@ long arch_ptrace(struct task_struct *child, long request,
>>                                       tmp = 0;
>>                       } else {
>>                               unsigned long index;
>> +#ifdef CONFIG_SH_FPU
>>                               ret = init_fpu(child);
>>                               if (ret)
>>                                       break;
>> +#endif
>
> How about modify "init_fpu" function side instead of this patch ?
> I don't know detail but like this ?

By your method, this problem is not settled.
Because init_fpu defined in asm/fpu.h becomes be enable by CONFIG_SH_FPU.

Best regard,
  Nobuhiro
-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-30  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 11:36 [PATCH] sh: Fix build arch_ptrace function by init_fpu Nobuhiro Iwamatsu
2011-03-30  0:02 ` Kuninori Morimoto
2011-03-30  1:20 ` Nobuhiro Iwamatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).