WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

Re: [Xen-ia64-devel] Mini-OS registers and libgcc

To: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Subject: Re: [Xen-ia64-devel] Mini-OS registers and libgcc
From: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 Feb 2008 13:59:05 +0100
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 13 Feb 2008 04:59:19 -0800
Domainkey-signature: s=s768; d=fujitsu-siemens.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:Received:Received: From:To:Subject:Date:User-Agent:Cc:References:In-Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding: Content-Disposition:Message-Id; b=1e/dMhXjzpeoABszIWbDcJ7ov0vGmsgqCXk2QAt3gNrUt4AVDFaiwhse HmeMUdiunDrqxwp6ZL1T2KJnbaZPOi2rNgWZnhx7SQ3byfUCgG0rbh4m6 RHhtfE9OjTImeny;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20080213120554.GB4378@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20080212141219.GA4336@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <200802131153.59866.dietmar.hahn@xxxxxxxxxxxxxxxxxxx> <20080213120554.GB4378@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6 (enterprise 20070904.708012)
Hi Samuel,

comments are within the text!

Am Mittwoch, 13. Februar 2008 schrieb Samuel Thibault:
> Hello,
>
> Dietmar Hahn, le Wed 13 Feb 2008 11:53:59 +0100, a écrit :
> > Am Dienstag, 12. Februar 2008 schrieb Samuel Thibault:
> > > Is there a reason for using -mfixed-range=f2-f5,f12-f15,f32-f127
> > > when compiling Mini-OS?  Is it really needed since it doesn't
> > > have a user-land? (though I guess some support would be needed in
> > > switch_context for instance)
> >
> > To handle this in a clean way the trap_frame has to be expanded and some
> > fp registers have to stored/restored in trap handling.
>
> Ok. Would this be needed in order to be able to use libgcc.a?

No, both things are independent from each other.

>
> > > Then, are there other reasons for using __*div/di*.S instead of just
> > > linking with libgcc?
> >
> > It's possible to use libgcc.a but the flag -mconstant-gp has to be
> > removed from the mini-os makefiles and a clean way to add libgcc.a is
> > needed.
>
> Something like the attached patch?
>
> Actually I'm asking because for other purpose, I would need __divdi on
> x86_32, and using libgcc.a is a really simple solution.

Ok I understand - the attached patch runs fine.

> > By the way current mini-os crashed with Unaligned Reference.
> > A small change is needed:
> >  static void maybe_split(struct xmalloc_hdr *hdr, size_t size, size_t
> > block) {
> >      struct xmalloc_hdr *extra;
> > -    size_t leftover = block - size;
> > +    size_t leftover;
> > +#if defined(__ia64__)
> > +    size = (size +7 ) & ~7;  /* alignment needed on 8 byte boundary. */
> > +#endif
> > +    leftover = block - size;
>
> Does the following patch work?
>
> diff -r 3cc84775d725 extras/mini-os/lib/xmalloc.c
> --- a/extras/mini-os/lib/xmalloc.c    Tue Feb 12 17:04:32 2008 +0000
> +++ b/extras/mini-os/lib/xmalloc.c    Wed Feb 13 12:03:52 2008 +0000
> @@ -62,10 +62,19 @@ struct xmalloc_pad
>      size_t hdr_size;
>  };
>
> +/* Return size, increased to alignment with align. */
> +static inline size_t align_up(size_t size, size_t align)
> +{
> +    return (size + align - 1) & ~(align - 1);
> +}
> +
>  static void maybe_split(struct xmalloc_hdr *hdr, size_t size, size_t
> block) {
>      struct xmalloc_hdr *extra;
> -    size_t leftover = block - size;
> +    size_t leftover;
> +    size = align_up(size, __alignof__(struct xmalloc_hdr));
> +    size = align_up(size, __alignof__(struct xmalloc_pad));
> +    leftover = block - size;
>
>      /* If enough is left to make a block, put it on free list. */
>      if ( leftover >= (2 * (sizeof(struct xmalloc_hdr) + sizeof(struct
> xmalloc_pad))) ) @@ -98,12 +107,6 @@ static struct xmalloc_hdr
> *xmalloc_new_p
>      maybe_split(hdr, size, PAGE_SIZE);
>
>      return hdr;
> -}
> -
> -/* Return size, increased to alignment with align. */
> -static inline size_t align_up(size_t size, size_t align)
> -{
> -    return (size + align - 1) & ~(align - 1);
>  }
>
>  /* Big object?  Just use the page allocator. */
>
> Samuel

This patch works fine too!

Dietmar.

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

<Prev in Thread] Current Thread [Next in Thread>