qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] ARM syscall 186.
@ 2004-12-06  8:55 James Pellow
  2004-12-06 19:45 ` Fabrice Bellard
  0 siblings, 1 reply; 3+ messages in thread
From: James Pellow @ 2004-12-06  8:55 UTC (permalink / raw)
  To: qemu-devel

Hi All,

In the quest for a running gentoo, I found the need for ARM syscall 186.  This 
is required to get ncurses to install.  This seems to work for me, though I 
have only tested it in the context of an ncurses install.  Let me know if 
something isn't right and I will fix it.  I spent a bit more time looking at 
the proper way to handle things this time, so I am pretty sure this is 
actually correct :)  Thanks for any feedback.  Here is the patch:

------------------------------------------------------------------------------------------------------------

diff -ruN qemu-0.6.1/linux-user/syscall.c qemu-0.6.1_new/linux-user/syscall.c
--- qemu-0.6.1/linux-user/syscall.c     2004-11-14 12:51:33.000000000 -0800
+++ qemu-0.6.1_new/linux-user/syscall.c 2004-12-06 00:05:26.139467848 -0800
@@ -2700,7 +2700,23 @@
     case TARGET_NR_capset:
         goto unimplemented;
     case TARGET_NR_sigaltstack:
-        goto unimplemented;
+        {
+           struct target_stack_t *ss_target  = (void *)arg1;
+           struct target_stack_t *oss_target = (void *)arg2;
+           stack_t ss, oss;
+
+           ss.ss_sp    = (void *)tswapl(ss_target->ss_sp);
+           ss.ss_flags = tswap32(ss_target->ss_flags);
+           ss.ss_size  = tswapl(ss_target->ss_size);
+
+           ret = get_errno(sigaltstack(&ss, &oss));
+           if (!is_error(ret) && oss_target != NULL) {
+               oss_target->ss_sp    = tswapl((long)oss.ss_sp);
+               oss_target->ss_flags = tswap32(oss.ss_flags);
+               oss_target->ss_size  = tswapl(oss.ss_size);
+           }
+        }
+        break;
     case TARGET_NR_sendfile:
         goto unimplemented;
 #ifdef TARGET_NR_getpmsg
diff -ruN qemu-0.6.1/linux-user/syscall_defs.h 
qemu-0.6.1_new/linux-user/syscall_defs.h
--- qemu-0.6.1/linux-user/syscall_defs.h        2004-11-14 12:51:33.000000000 
-0800
+++ qemu-0.6.1_new/linux-user/syscall_defs.h    2004-12-05 22:40:00.249721536 
-0800
@@ -97,6 +97,12 @@
 #define TARGET_IOWU(type,nr)   TARGET_IOC(TARGET_IOC_WRITE,(type),
(nr),TARGET_IOC_SIZEMASK)
 #define TARGET_IOWRU(type,nr)  TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,
(type),(nr),TARGET_IOC_SIZEMASK)

+struct target_stack_t {
+    target_long ss_sp;
+    int         ss_flags;
+    target_long ss_size;
+};
+
 struct target_sockaddr {
     uint16_t sa_family;
     uint8_t sa_data[14];

---------------------------------------------------------------------------------------------------------------

Cheers,

-- 
*****************************
James A. Pellow, President
Alent Design Solutions
www.alentdesignsolutions.com
(509) 526-0682
*****************************

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

* Re: [Qemu-devel] ARM syscall 186.
  2004-12-06  8:55 [Qemu-devel] ARM syscall 186 James Pellow
@ 2004-12-06 19:45 ` Fabrice Bellard
  2004-12-06 20:39   ` James Pellow
  0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Bellard @ 2004-12-06 19:45 UTC (permalink / raw)
  To: james, qemu-devel

Hi,

Your patch is not correct because it should change the emulated stack, 
not the host stack. You must make modifications in signal.c to have it 
working and you should never call the host sigaltstack() syscall.

Fabrice.

James Pellow wrote:
> Hi All,
> 
> In the quest for a running gentoo, I found the need for ARM syscall 186.  This 
> is required to get ncurses to install.  This seems to work for me, though I 
> have only tested it in the context of an ncurses install.  Let me know if 
> something isn't right and I will fix it.  I spent a bit more time looking at 
> the proper way to handle things this time, so I am pretty sure this is 
> actually correct :)  Thanks for any feedback.  Here is the patch:
> 
> ------------------------------------------------------------------------------------------------------------
> 
> diff -ruN qemu-0.6.1/linux-user/syscall.c qemu-0.6.1_new/linux-user/syscall.c
> --- qemu-0.6.1/linux-user/syscall.c     2004-11-14 12:51:33.000000000 -0800
> +++ qemu-0.6.1_new/linux-user/syscall.c 2004-12-06 00:05:26.139467848 -0800
> @@ -2700,7 +2700,23 @@
>      case TARGET_NR_capset:
>          goto unimplemented;
>      case TARGET_NR_sigaltstack:
> -        goto unimplemented;
> +        {
> +           struct target_stack_t *ss_target  = (void *)arg1;
> +           struct target_stack_t *oss_target = (void *)arg2;
> +           stack_t ss, oss;
> +
> +           ss.ss_sp    = (void *)tswapl(ss_target->ss_sp);
> +           ss.ss_flags = tswap32(ss_target->ss_flags);
> +           ss.ss_size  = tswapl(ss_target->ss_size);
> +
> +           ret = get_errno(sigaltstack(&ss, &oss));
> +           if (!is_error(ret) && oss_target != NULL) {
> +               oss_target->ss_sp    = tswapl((long)oss.ss_sp);
> +               oss_target->ss_flags = tswap32(oss.ss_flags);
> +               oss_target->ss_size  = tswapl(oss.ss_size);
> +           }
> +        }
> +        break;
>      case TARGET_NR_sendfile:
>          goto unimplemented;
>  #ifdef TARGET_NR_getpmsg
> diff -ruN qemu-0.6.1/linux-user/syscall_defs.h 
> qemu-0.6.1_new/linux-user/syscall_defs.h
> --- qemu-0.6.1/linux-user/syscall_defs.h        2004-11-14 12:51:33.000000000 
> -0800
> +++ qemu-0.6.1_new/linux-user/syscall_defs.h    2004-12-05 22:40:00.249721536 
> -0800
> @@ -97,6 +97,12 @@
>  #define TARGET_IOWU(type,nr)   TARGET_IOC(TARGET_IOC_WRITE,(type),
> (nr),TARGET_IOC_SIZEMASK)
>  #define TARGET_IOWRU(type,nr)  TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,
> (type),(nr),TARGET_IOC_SIZEMASK)
> 
> +struct target_stack_t {
> +    target_long ss_sp;
> +    int         ss_flags;
> +    target_long ss_size;
> +};
> +
>  struct target_sockaddr {
>      uint16_t sa_family;
>      uint8_t sa_data[14];
> 
> ---------------------------------------------------------------------------------------------------------------
> 
> Cheers,
> 

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

* Re: [Qemu-devel] ARM syscall 186.
  2004-12-06 19:45 ` Fabrice Bellard
@ 2004-12-06 20:39   ` James Pellow
  0 siblings, 0 replies; 3+ messages in thread
From: James Pellow @ 2004-12-06 20:39 UTC (permalink / raw)
  To: Fabrice Bellard; +Cc: qemu-devel

HI Fabrice,

Thanks for your reply.  I figured that out since I sent in the patch, but at 
least it was a good exercise in understanding the syscall stuff.  I have 
talken a look at signal.c and am working on an improved patch.

Thanks,

James

On Monday 06 December 2004 11:45 am, Fabrice Bellard wrote:
> Hi,
>
> Your patch is not correct because it should change the emulated stack,
> not the host stack. You must make modifications in signal.c to have it
> working and you should never call the host sigaltstack() syscall.
>
> Fabrice.
>
> James Pellow wrote:
> > Hi All,
> >
> > In the quest for a running gentoo, I found the need for ARM syscall 186. 
> > This is required to get ncurses to install.  This seems to work for me,
> > though I have only tested it in the context of an ncurses install.  Let
> > me know if something isn't right and I will fix it.  I spent a bit more
> > time looking at the proper way to handle things this time, so I am pretty
> > sure this is actually correct :)  Thanks for any feedback.  Here is the
> > patch:
> >
> > -------------------------------------------------------------------------
> >-----------------------------------
> >
> > diff -ruN qemu-0.6.1/linux-user/syscall.c
> > qemu-0.6.1_new/linux-user/syscall.c --- qemu-0.6.1/linux-user/syscall.c  
> >   2004-11-14 12:51:33.000000000 -0800 +++
> > qemu-0.6.1_new/linux-user/syscall.c 2004-12-06 00:05:26.139467848 -0800
> > @@ -2700,7 +2700,23 @@
> >      case TARGET_NR_capset:
> >          goto unimplemented;
> >      case TARGET_NR_sigaltstack:
> > -        goto unimplemented;
> > +        {
> > +           struct target_stack_t *ss_target  = (void *)arg1;
> > +           struct target_stack_t *oss_target = (void *)arg2;
> > +           stack_t ss, oss;
> > +
> > +           ss.ss_sp    = (void *)tswapl(ss_target->ss_sp);
> > +           ss.ss_flags = tswap32(ss_target->ss_flags);
> > +           ss.ss_size  = tswapl(ss_target->ss_size);
> > +
> > +           ret = get_errno(sigaltstack(&ss, &oss));
> > +           if (!is_error(ret) && oss_target != NULL) {
> > +               oss_target->ss_sp    = tswapl((long)oss.ss_sp);
> > +               oss_target->ss_flags = tswap32(oss.ss_flags);
> > +               oss_target->ss_size  = tswapl(oss.ss_size);
> > +           }
> > +        }
> > +        break;
> >      case TARGET_NR_sendfile:
> >          goto unimplemented;
> >  #ifdef TARGET_NR_getpmsg
> > diff -ruN qemu-0.6.1/linux-user/syscall_defs.h
> > qemu-0.6.1_new/linux-user/syscall_defs.h
> > --- qemu-0.6.1/linux-user/syscall_defs.h        2004-11-14
> > 12:51:33.000000000 -0800
> > +++ qemu-0.6.1_new/linux-user/syscall_defs.h    2004-12-05
> > 22:40:00.249721536 -0800
> > @@ -97,6 +97,12 @@
> >  #define TARGET_IOWU(type,nr)   TARGET_IOC(TARGET_IOC_WRITE,(type),
> > (nr),TARGET_IOC_SIZEMASK)
> >  #define TARGET_IOWRU(type,nr) 
> > TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,
> > (type),(nr),TARGET_IOC_SIZEMASK)
> >
> > +struct target_stack_t {
> > +    target_long ss_sp;
> > +    int         ss_flags;
> > +    target_long ss_size;
> > +};
> > +
> >  struct target_sockaddr {
> >      uint16_t sa_family;
> >      uint8_t sa_data[14];
> >
> > -------------------------------------------------------------------------
> >--------------------------------------
> >
> > Cheers,

-- 
*****************************
James A. Pellow, President
Alent Design Solutions
www.alentdesignsolutions.com
(509) 526-0682
*****************************

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

end of thread, other threads:[~2004-12-06 20:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-06  8:55 [Qemu-devel] ARM syscall 186 James Pellow
2004-12-06 19:45 ` Fabrice Bellard
2004-12-06 20:39   ` James Pellow

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).