qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <Laurent@vivier.eu>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Riku Voipio <riku.voipio@iki.fi>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] linux-user: correctly align types in thunking code
Date: Sat, 08 Dec 2012 18:10:41 +0100	[thread overview]
Message-ID: <1354986641.12642.19.camel@Quad> (raw)
In-Reply-To: <CAFEAcA8fvNZfQ2T8HLwPKB4tCBPoaPARUmY-t6kEtHCWU4KYzg@mail.gmail.com>

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

Le samedi 08 décembre 2012 à 16:40 +0000, Peter Maydell a écrit :
> On 8 December 2012 15:18, Laurent Vivier <laurent@vivier.eu> wrote:
> > Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> 
> This kind of patch really needs an explanation (and ideally
> test case) of what the bug is that it is attempting to fix...

Yes... of course, but sometime no one reads my patches, so I was
lazy ;-)

The 3 first patches I sent today allow to run netstat and route in a
linux container with qemu linux-user (qemu-m68k in my case).

The first one, obviously, allows to have IP addresses in correct order
in the case of "netstat -nr".

The second one, allows to use the command "route". This is a follow up
of patch:

        commit c2e3dee6e03527baf8698698cce76b1a3174969a
        Author: Laurent Vivier <laurent@vivier.eu>
        Date:   Sun Feb 13 23:37:34 2011 +0100
        
            linux-user: Define target alignment size

In my case m68k aligns "int" on 2 not 4. You can check this with the
following program:

#include <stdio.h>
#include <net/route.h>
#include <stddef.h>

int main(void)
{
        struct rtentry rt;
        printf("rt_pad1 %ld %zd\n", offsetof(struct rtentry, rt_pad1),
                sizeof(rt.rt_pad1));
        printf("rt_dst %ld %zd\n", offsetof(struct rtentry, rt_dst),
                sizeof(rt.rt_dst));
        printf("rt_gateway %ld %zd\n", offsetof(struct rtentry, rt_gateway),
                sizeof(rt.rt_gateway));
        printf("rt_genmask %ld %zd\n", offsetof(struct rtentry, rt_genmask),
                sizeof(rt.rt_genmask));
        printf("rt_flags %ld %zd\n", offsetof(struct rtentry, rt_flags),
                sizeof(rt.rt_flags));
        printf("rt_pad2 %ld %zd\n", offsetof(struct rtentry, rt_pad2),
                sizeof(rt.rt_pad2));
        printf("rt_pad3 %ld %zd\n", offsetof(struct rtentry, rt_pad3),
                sizeof(rt.rt_pad3));
        printf("rt_pad4 %ld %zd\n", offsetof(struct rtentry, rt_pad4),
                sizeof(rt.rt_pad4));
        printf("rt_metric %ld %zd\n", offsetof(struct rtentry, rt_metric),
                sizeof(rt.rt_metric));
        printf("rt_dev %ld %zd\n", offsetof(struct rtentry, rt_dev),
                sizeof(rt.rt_dev));
}

On x86_64:

        rt_pad1 0 8
        rt_dst 8 16
        rt_gateway 24 16
        rt_genmask 40 16
        rt_flags 56 2
        rt_pad2 58 2
        rt_pad3 64 8
        rt_pad4 74 6
        rt_metric 80 2
        rt_dev 88 8

on m68k:

        rt_pad1 0 4
        rt_dst 4 16
        rt_gateway 20 16
        rt_genmask 36 16
        rt_flags 52 2
        rt_pad2 54 2
        rt_pad3 56 4
        rt_pad4 62 2
        rt_metric 64 2
        rt_dev 66 4


The third one, allows to set the interface for the command "route", for
instance : route add -net default gw 10.0.3.1 eth0

Obviously, If patches seem correct for everyone, I can resend them with
comments and in a serie.

Bonus: To test this, find attached a little script that will compile
qemu-m68k, install debian etch-m68k in a linux container. Then you will
be able to run debian m68k system with "sudo lxc-start -n virtm68k".
(tested on an ubuntu 12.10, you should check that lxc creates a lxcbr0
bridge with IP address 10.0.3.1). Check variable at the beginning for
the paths used.

Regards,
Laurent
--
"Just play. Have fun. Enjoy the game."

[-- Attachment #2: create-m68k-lxc.sh --]
[-- Type: application/x-shellscript, Size: 4150 bytes --]

  reply	other threads:[~2012-12-08 17:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-08 15:18 [Qemu-devel] [PATCH] linux-user: correctly align types in thunking code Laurent Vivier
2012-12-08 16:40 ` Peter Maydell
2012-12-08 17:10   ` Laurent Vivier [this message]
2012-12-08 16:55 ` Andreas Färber
2012-12-08 17:13   ` Laurent Vivier
  -- strict thread matches above, loose matches on Subject: below --
2012-12-20 20:55 Laurent Vivier
2013-01-01 23:08 ` Laurent Vivier
2018-05-10 20:59 Laurent Vivier
2018-05-11 10:43 ` Peter Maydell

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=1354986641.12642.19.camel@Quad \
    --to=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).