From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 08 of 15] hvmloader: Add a simple "scratch allocator" Date: Thu, 2 Jun 2011 15:43:31 -0400 Message-ID: <20110602194331.GA32344@dumpdata.com> References: <3c920f4ec4f24e1c1347.1306921203@cosworth.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <3c920f4ec4f24e1c1347.1306921203@cosworth.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org > +void *scratch_alloc(uint32_t size, uint32_t align) > +{ > + uint32_t s, e; > + > + /* Align to at least one kilobyte. */ > + if ( align < 1024 ) > + align = 1024; > + > + s = (scratch_start + align - 1) & ~(align - 1); > + e = s + size - 1; > + > + BUG_ON(e < s); > + > + scratch_start = e; > + > + return (void *)(unsigned long)s; Why the double cast?