qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Blue Swirl" <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Questions/comments on TCG
Date: Sat, 8 Mar 2008 16:07:49 +0200	[thread overview]
Message-ID: <f43fc5580803080607i285f795ds7ab89241d6cba70d@mail.gmail.com> (raw)
In-Reply-To: <f43fc5580803071230r7415350fr2712a828af9fc49b@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1708 bytes --]

On 3/7/08, Blue Swirl <blauwirbel@gmail.com> wrote:
> On 3/7/08, Stuart Brady <sdbrady@ntlworld.com> wrote:
>  > On Fri, Mar 07, 2008 at 08:47:03PM +0200, Blue Swirl wrote:
>  >  > On 3/7/08, Stuart Brady <sdbrady@ntlworld.com> wrote:
>  >
>  > > > tcg_target_reg_alloc_order[] has 32 elements, but only 14 are used.
>  >  > >  The rest hold 0, specifying TCG_REG_G0.
>  >  >
>  >  > I see. That could be asking for trouble.
>  >
>  >
>  > Possibly not, as g0 is marked as reserved, but it looks to me like bug,
>  >  regardless of whether it causes any harm, so I've submitted a patch.
>  >
>  >
>  >  > > I don't understand -- o7 is required when returning in exit_tb, so if it
>  >  > >  is used, it must be saved and restored.
>  >  >
>  >  > Not exit_tb, but call.
>  >
>  >
>  > Right, op_call does need to link, and that clobbers the link register,
>  >  so it must be restored -- but I've a feeling that this isn't happening.
>  >  I expect you could copy o7 to/from i5 before/after the call (or jmpl)...
>  >  although I'm not sure if you'd also need to save the frame pointer.
>
>
> Another possibility is to add function epilogue with save and add
>  restore to ret (or use v9 return).

I added the save and restore instructions, because if the generated
code made any calls, the registers were overwritten.

Currently on Sparc64 host a small helloworld program executes until
the system call, then Qemu dies with illegal instruction. It looks
like this is caused by setjmp/longjmp register mangling bugs in Linux
glibc, my workaround does not help. I'd be interested to hear if this
works any better on Solaris/Sparc or *BSD/Sparc. On Sparc32 TB linking
does not work, so Qemu dies on TB switch.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: helloworld.c --]
[-- Type: text/x-csrc; name=helloworld.c, Size: 267 bytes --]

#define __KERNEL__
#include <asm/unistd.h>
static int errno;
static __inline__ _syscall1(void,exit,int,exitval)
static inline _syscall3(int,write,int,fd,const char *,buf,long,count)

int _start()
{
  write(2, "Hello World!\n", sizeof("Hello World!\n"));
  exit(0);
}

[-- Attachment #3: helloworld.sparc32 --]
[-- Type: application/octet-stream, Size: 712 bytes --]

  reply	other threads:[~2008-03-08 14:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-07 12:37 [Qemu-devel] Questions/comments on TCG Stuart Brady
2008-03-07 16:07 ` Blue Swirl
2008-03-07 18:19   ` Stuart Brady
2008-03-07 18:47     ` Blue Swirl
2008-03-07 19:55       ` Stuart Brady
2008-03-07 20:30         ` Blue Swirl
2008-03-08 14:07           ` Blue Swirl [this message]
2008-03-07 18:28 ` [Qemu-devel] [PATCH] Remove blank elements in tcg_target_reg_alloc_order[] Stuart Brady

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f43fc5580803080607i285f795ds7ab89241d6cba70d@mail.gmail.com \
    --to=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).