* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
@ 2011-01-10 19:29 ` David Miller
2011-01-15 12:07 ` silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2011-01-10 19:29 UTC (permalink / raw)
To: sparclinux
From: Raúl Porcel <armin76@gentoo.org>
Date: Mon, 10 Jan 2011 20:10:36 +0100
> Hi,
>
> SILO fails to build here with e2fsprogs-1.41.14 installed, i'm attaching
> the build log.
I really appreciate how they make libext2 harder and harder to link into
embedded self-contained things like bootloaders over time.
I just pushed the following fix for this:
--------------------
second: Add dummy posix_memalign stubb for libext2
Reported-by: Raúl Porcel <armin76@gentoo.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
second/fs/ext2.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/second/fs/ext2.c b/second/fs/ext2.c
index 57f5e9a..12d00dc 100644
--- a/second/fs/ext2.c
+++ b/second/fs/ext2.c
@@ -163,3 +163,9 @@ void *realloc(void *p, int size)
{
return NULL;
}
+
+int posix_memalign(void **memptr, size_t alignment, size_t size)
+{
+ *memptr = NULL;
+ return -1;
+}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined references
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
2011-01-10 19:29 ` silo fails to build with e2fsprogs-1.41.14 (undefined David Miller
@ 2011-01-15 12:07 ` Raúl Porcel
2011-01-15 12:57 ` silo fails to build with e2fsprogs-1.41.14 (undefined Alex Buell
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Raúl Porcel @ 2011-01-15 12:07 UTC (permalink / raw)
To: sparclinux
On 01/10/2011 08:29 PM, David Miller wrote:
> From: Raúl Porcel <armin76@gentoo.org>
> Date: Mon, 10 Jan 2011 20:10:36 +0100
>
>> Hi,
>>
>> SILO fails to build here with e2fsprogs-1.41.14 installed, i'm attaching
>> the build log.
>
> I really appreciate how they make libext2 harder and harder to link into
> embedded self-contained things like bootloaders over time.
>
> I just pushed the following fix for this:
> <snip>
Hi,
Thanks, it builds, but silo fails to work:
Boot device: disk1 File and args:
SILO Version 1.4.14_git2010228_p1
Unknown ext2 error: 4294967295
Fatal error: Unable to open filesystem
Couldn't load /etc/silo.conf
No config file loaded, you can boot just from this command line
Type [prompath;]part/path_to_image [parameters] on the prompt
E.g. /iommu/sbus/espdma/esp/sd@3,0;4/vmlinux root=/dev/sda4
or 2/vmlinux.live (to load vmlinux.live from 2nd partition of boot disk)
boot:
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
2011-01-10 19:29 ` silo fails to build with e2fsprogs-1.41.14 (undefined David Miller
2011-01-15 12:07 ` silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
@ 2011-01-15 12:57 ` Alex Buell
2011-01-16 5:06 ` David Miller
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Alex Buell @ 2011-01-15 12:57 UTC (permalink / raw)
To: sparclinux
On Sat, 2011-01-15 at 13:07 +0100, Raúl Porcel wrote:
> On 01/10/2011 08:29 PM, David Miller wrote:
> > From: Raúl Porcel <armin76@gentoo.org>
> > Date: Mon, 10 Jan 2011 20:10:36 +0100
> >
> >> Hi,
> >>
> >> SILO fails to build here with e2fsprogs-1.41.14 installed, i'm attaching
> >> the build log.
> >
> > I really appreciate how they make libext2 harder and harder to link into
> > embedded self-contained things like bootloaders over time.
> >
> > I just pushed the following fix for this:
> > <snip>
>
>
> Hi,
>
> Thanks, it builds, but silo fails to work:
>
> Boot device: disk1 File and args:
> SILO Version 1.4.14_git2010228_p1
>
> Unknown ext2 error: 4294967295
>
> Fatal error: Unable to open filesystem
>
> Couldn't load /etc/silo.conf
> No config file loaded, you can boot just from this command line
> Type [prompath;]part/path_to_image [parameters] on the prompt
> E.g. /iommu/sbus/espdma/esp/sd@3,0;4/vmlinux root=/dev/sda4
> or 2/vmlinux.live (to load vmlinux.live from 2nd partition of boot disk)
> boot:
This problem exists with all versions of silo linked against
e2fsprogs-1.41.14.
I think there is a bug in e2fsprogs as it doesn't seem to properly
handle error codes returned by the posix_memalign() function. It's
either that or a proper implementation of posix_memalign() function
needs to be detected through the configure scripts.
--
Tactical Nuclear Kittens
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (2 preceding siblings ...)
2011-01-15 12:57 ` silo fails to build with e2fsprogs-1.41.14 (undefined Alex Buell
@ 2011-01-16 5:06 ` David Miller
2011-01-17 3:59 ` David Miller
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2011-01-16 5:06 UTC (permalink / raw)
To: sparclinux
From: Alex Buell <alex.buell@munted.org.uk>
Date: Sat, 15 Jan 2011 12:57:09 +0000
> I think there is a bug in e2fsprogs as it doesn't seem to properly
> handle error codes returned by the posix_memalign() function. It's
> either that or a proper implementation of posix_memalign() function
> needs to be detected through the configure scripts.
I think it requires a real properly functioning posix_memalign().
The issue is that the detection occurs when the e2fsprogs package
is built, and in userland's libc there is in fact a full and
functioning posix_memalign(). So e2fsprogs is doing nothing wrong.
The problem is that SILO is linking e2fsprogs into it's limited
environment, and we have to bolt on hacks over time as e2fsprogs
depends upon newer facilities in userland.
I'll try to fix this.
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (3 preceding siblings ...)
2011-01-16 5:06 ` David Miller
@ 2011-01-17 3:59 ` David Miller
2011-01-17 4:03 ` Alex Buell
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2011-01-17 3:59 UTC (permalink / raw)
To: sparclinux
From: Alex Buell <alex.buell@munted.org.uk>
Date: Sat, 15 Jan 2011 12:57:09 +0000
> On Sat, 2011-01-15 at 13:07 +0100, Raúl Porcel wrote:
>> Thanks, it builds, but silo fails to work:
>>
>> Boot device: disk1 File and args:
>> SILO Version 1.4.14_git2010228_p1
>>
>> Unknown ext2 error: 4294967295
>>
>> Fatal error: Unable to open filesystem
>>
>> Couldn't load /etc/silo.conf
>> No config file loaded, you can boot just from this command line
>> Type [prompath;]part/path_to_image [parameters] on the prompt
>> E.g. /iommu/sbus/espdma/esp/sd@3,0;4/vmlinux root=/dev/sda4
>> or 2/vmlinux.live (to load vmlinux.live from 2nd partition of boot disk)
>> boot:
>
> This problem exists with all versions of silo linked against
> e2fsprogs-1.41.14.
Can you guys please test this patch out? It's against the current
tree.
Thanks!
--------------------
malloc: Provide posix_memalign() implementation.
ext2progs library really wants a working version of this,
and thankfully it's not that hard to do.
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/common/malloc.c b/common/malloc.c
index cc3946d..d05061b 100644
--- a/common/malloc.c
+++ b/common/malloc.c
@@ -27,6 +27,12 @@ static char *malloc_ptr = (char *) MALLOC_BASE;
static char *last_alloc = 0;
+static char *align_ptr_to(char *ptr, unsigned long align)
+{
+ return (char *) ((((unsigned long) ptr) + (align - 1UL)) &
+ ~(align - 1UL));
+}
+
void *malloc (int size)
{
char *caddr;
@@ -34,10 +40,34 @@ void *malloc (int size)
caddr = malloc_ptr;
malloc_ptr += size;
last_alloc = caddr;
- malloc_ptr = (char *) ((((unsigned long) malloc_ptr) + 7) & (~7));
+ malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
return caddr;
}
+int posix_memalign(void **memptr, unsigned long alignment, unsigned long size)
+{
+ char *caddr;
+
+ if (alignment & (alignment - 1UL))
+ return -1;
+ if (alignment & (sizeof(void *) - 1UL))
+ return -1;
+
+ if (size = 0) {
+ *memptr = (void *) 0;
+ return 0;
+ }
+
+ caddr = align_ptr_to(malloc_ptr, alignment);
+ malloc_ptr = (caddr + size);
+ last_alloc = caddr;
+ malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
+
+ *memptr = caddr;
+
+ return 0;
+}
+
void free (void *m)
{
if (m = last_alloc)
diff --git a/second/fs/ext2.c b/second/fs/ext2.c
index 12d00dc..57f5e9a 100644
--- a/second/fs/ext2.c
+++ b/second/fs/ext2.c
@@ -163,9 +163,3 @@ void *realloc(void *p, int size)
{
return NULL;
}
-
-int posix_memalign(void **memptr, size_t alignment, size_t size)
-{
- *memptr = NULL;
- return -1;
-}
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (4 preceding siblings ...)
2011-01-17 3:59 ` David Miller
@ 2011-01-17 4:03 ` Alex Buell
2011-01-17 13:22 ` Alex Buell
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Alex Buell @ 2011-01-17 4:03 UTC (permalink / raw)
To: sparclinux
On Sun, 2011-01-16 at 19:59 -0800, David Miller wrote:
> From: Alex Buell <alex.buell@munted.org.uk>
> Date: Sat, 15 Jan 2011 12:57:09 +0000
>
> > On Sat, 2011-01-15 at 13:07 +0100, Raúl Porcel wrote:
> >> Thanks, it builds, but silo fails to work:
> >>
> >> Boot device: disk1 File and args:
> >> SILO Version 1.4.14_git2010228_p1
> >>
> >> Unknown ext2 error: 4294967295
> >>
> >> Fatal error: Unable to open filesystem
> >>
> >> Couldn't load /etc/silo.conf
> >> No config file loaded, you can boot just from this command line
> >> Type [prompath;]part/path_to_image [parameters] on the prompt
> >> E.g. /iommu/sbus/espdma/esp/sd@3,0;4/vmlinux root=/dev/sda4
> >> or 2/vmlinux.live (to load vmlinux.live from 2nd partition of boot disk)
> >> boot:
> >
> > This problem exists with all versions of silo linked against
> > e2fsprogs-1.41.14.
>
> Can you guys please test this patch out? It's against the current
> tree.
>
> Thanks!
>
> --------------------
> malloc: Provide posix_memalign() implementation.
>
> ext2progs library really wants a working version of this,
> and thankfully it's not that hard to do.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> diff --git a/common/malloc.c b/common/malloc.c
> index cc3946d..d05061b 100644
> --- a/common/malloc.c
> +++ b/common/malloc.c
> @@ -27,6 +27,12 @@ static char *malloc_ptr = (char *) MALLOC_BASE;
>
> static char *last_alloc = 0;
>
> +static char *align_ptr_to(char *ptr, unsigned long align)
> +{
> + return (char *) ((((unsigned long) ptr) + (align - 1UL)) &
> + ~(align - 1UL));
> +}
> +
> void *malloc (int size)
> {
> char *caddr;
> @@ -34,10 +40,34 @@ void *malloc (int size)
> caddr = malloc_ptr;
> malloc_ptr += size;
> last_alloc = caddr;
> - malloc_ptr = (char *) ((((unsigned long) malloc_ptr) + 7) & (~7));
> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
> return caddr;
> }
>
> +int posix_memalign(void **memptr, unsigned long alignment, unsigned long size)
> +{
> + char *caddr;
> +
> + if (alignment & (alignment - 1UL))
> + return -1;
> + if (alignment & (sizeof(void *) - 1UL))
> + return -1;
> +
> + if (size = 0) {
> + *memptr = (void *) 0;
> + return 0;
> + }
> +
> + caddr = align_ptr_to(malloc_ptr, alignment);
> + malloc_ptr = (caddr + size);
> + last_alloc = caddr;
> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
> +
> + *memptr = caddr;
> +
> + return 0;
> +}
> +
> void free (void *m)
> {
> if (m = last_alloc)
> diff --git a/second/fs/ext2.c b/second/fs/ext2.c
> index 12d00dc..57f5e9a 100644
> --- a/second/fs/ext2.c
> +++ b/second/fs/ext2.c
> @@ -163,9 +163,3 @@ void *realloc(void *p, int size)
> {
> return NULL;
> }
> -
> -int posix_memalign(void **memptr, size_t alignment, size_t size)
> -{
> - *memptr = NULL;
> - return -1;
> -}
I'll test it first thing tomorrow morning. The 'Blade 2000's busy
cross-compiling PPC packages for my dog-slow iMac at the moment.
--
Tactical Nuclear Kittens
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (5 preceding siblings ...)
2011-01-17 4:03 ` Alex Buell
@ 2011-01-17 13:22 ` Alex Buell
2011-01-17 17:02 ` silo fails to build with e2fsprogs-1.41.14 (undefined references Richard Mortimer
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Alex Buell @ 2011-01-17 13:22 UTC (permalink / raw)
To: sparclinux
On Sun, 2011-01-16 at 19:59 -0800, David Miller wrote:
> From: Alex Buell <alex.buell@munted.org.uk>
> Date: Sat, 15 Jan 2011 12:57:09 +0000
>
> > On Sat, 2011-01-15 at 13:07 +0100, Raúl Porcel wrote:
> >> Thanks, it builds, but silo fails to work:
> >>
> >> Boot device: disk1 File and args:
> >> SILO Version 1.4.14_git2010228_p1
> >>
> >> Unknown ext2 error: 4294967295
> >>
> >> Fatal error: Unable to open filesystem
> >>
> >> Couldn't load /etc/silo.conf
> >> No config file loaded, you can boot just from this command line
> >> Type [prompath;]part/path_to_image [parameters] on the prompt
> >> E.g. /iommu/sbus/espdma/esp/sd@3,0;4/vmlinux root=/dev/sda4
> >> or 2/vmlinux.live (to load vmlinux.live from 2nd partition of boot disk)
> >> boot:
> >
> > This problem exists with all versions of silo linked against
> > e2fsprogs-1.41.14.
>
> Can you guys please test this patch out? It's against the current
> tree.
>
> Thanks!
>
> --------------------
> malloc: Provide posix_memalign() implementation.
>
> ext2progs library really wants a working version of this,
> and thankfully it's not that hard to do.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> diff --git a/common/malloc.c b/common/malloc.c
> index cc3946d..d05061b 100644
> --- a/common/malloc.c
> +++ b/common/malloc.c
> @@ -27,6 +27,12 @@ static char *malloc_ptr = (char *) MALLOC_BASE;
>
> static char *last_alloc = 0;
>
> +static char *align_ptr_to(char *ptr, unsigned long align)
> +{
> + return (char *) ((((unsigned long) ptr) + (align - 1UL)) &
> + ~(align - 1UL));
> +}
> +
> void *malloc (int size)
> {
> char *caddr;
> @@ -34,10 +40,34 @@ void *malloc (int size)
> caddr = malloc_ptr;
> malloc_ptr += size;
> last_alloc = caddr;
> - malloc_ptr = (char *) ((((unsigned long) malloc_ptr) + 7) & (~7));
> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
> return caddr;
> }
>
> +int posix_memalign(void **memptr, unsigned long alignment, unsigned long size)
> +{
> + char *caddr;
> +
> + if (alignment & (alignment - 1UL))
> + return -1;
> + if (alignment & (sizeof(void *) - 1UL))
> + return -1;
> +
> + if (size = 0) {
> + *memptr = (void *) 0;
> + return 0;
> + }
> +
> + caddr = align_ptr_to(malloc_ptr, alignment);
> + malloc_ptr = (caddr + size);
> + last_alloc = caddr;
> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
> +
> + *memptr = caddr;
> +
> + return 0;
> +}
> +
> void free (void *m)
> {
> if (m = last_alloc)
> diff --git a/second/fs/ext2.c b/second/fs/ext2.c
> index 12d00dc..57f5e9a 100644
> --- a/second/fs/ext2.c
> +++ b/second/fs/ext2.c
> @@ -163,9 +163,3 @@ void *realloc(void *p, int size)
> {
> return NULL;
> }
> -
> -int posix_memalign(void **memptr, size_t alignment, size_t size)
> -{
> - *memptr = NULL;
> - return -1;
> -}
With that patch, I now get a different error:
SILO Version 1.4.14
ERROR: Last trap: Memory Address not aligned
Error -256
{0] OK
(Now I've got to boot off my rescue CD and rebuild SILO)
Is anyone else getting the same error?
--
Tactical Nuclear Kittens
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined references
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (6 preceding siblings ...)
2011-01-17 13:22 ` Alex Buell
@ 2011-01-17 17:02 ` Richard Mortimer
2011-01-17 17:23 ` silo fails to build with e2fsprogs-1.41.14 (undefined Alex Buell
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Richard Mortimer @ 2011-01-17 17:02 UTC (permalink / raw)
To: sparclinux
On 17/01/2011 13:22, Alex Buell wrote:
> On Sun, 2011-01-16 at 19:59 -0800, David Miller wrote:
>> From: Alex Buell<alex.buell@munted.org.uk>
>> Date: Sat, 15 Jan 2011 12:57:09 +0000
>>
>>> On Sat, 2011-01-15 at 13:07 +0100, Raúl Porcel wrote:
>>>> Thanks, it builds, but silo fails to work:
>>>>
>>>> Boot device: disk1 File and args:
>>>> SILO Version 1.4.14_git2010228_p1
>>>>
>>>> Unknown ext2 error: 4294967295
>>>>
>>>> Fatal error: Unable to open filesystem
>>>>
>>>> Couldn't load /etc/silo.conf
>>>> No config file loaded, you can boot just from this command line
>>>> Type [prompath;]part/path_to_image [parameters] on the prompt
>>>> E.g. /iommu/sbus/espdma/esp/sd@3,0;4/vmlinux root=/dev/sda4
>>>> or 2/vmlinux.live (to load vmlinux.live from 2nd partition of boot disk)
>>>> boot:
>>>
>>> This problem exists with all versions of silo linked against
>>> e2fsprogs-1.41.14.
>>
>> Can you guys please test this patch out? It's against the current
>> tree.
>>
>> Thanks!
>>
>> --------------------
>> malloc: Provide posix_memalign() implementation.
>>
>> ext2progs library really wants a working version of this,
>> and thankfully it's not that hard to do.
>>
>> Signed-off-by: David S. Miller<davem@davemloft.net>
>>
>> diff --git a/common/malloc.c b/common/malloc.c
>> index cc3946d..d05061b 100644
>> --- a/common/malloc.c
>> +++ b/common/malloc.c
>> @@ -27,6 +27,12 @@ static char *malloc_ptr = (char *) MALLOC_BASE;
>>
>> static char *last_alloc = 0;
>>
>> +static char *align_ptr_to(char *ptr, unsigned long align)
>> +{
>> + return (char *) ((((unsigned long) ptr) + (align - 1UL))&
>> + ~(align - 1UL));
>> +}
>> +
>> void *malloc (int size)
>> {
>> char *caddr;
>> @@ -34,10 +40,34 @@ void *malloc (int size)
>> caddr = malloc_ptr;
>> malloc_ptr += size;
>> last_alloc = caddr;
>> - malloc_ptr = (char *) ((((unsigned long) malloc_ptr) + 7)& (~7));
>> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
I think that should be 8UL because align_ptr_to does -1 to make it 7.
>> return caddr;
>> }
>>
>> +int posix_memalign(void **memptr, unsigned long alignment, unsigned long size)
>> +{
>> + char *caddr;
>> +
>> + if (alignment& (alignment - 1UL))
>> + return -1;
>> + if (alignment& (sizeof(void *) - 1UL))
>> + return -1;
>> +
>> + if (size = 0) {
>> + *memptr = (void *) 0;
>> + return 0;
>> + }
>> +
>> + caddr = align_ptr_to(malloc_ptr, alignment);
>> + malloc_ptr = (caddr + size);
>> + last_alloc = caddr;
>> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
Ditto
Regards
Richard
>> +
>> + *memptr = caddr;
>> +
>> + return 0;
>> +}
>> +
>> void free (void *m)
>> {
>> if (m = last_alloc)
>> diff --git a/second/fs/ext2.c b/second/fs/ext2.c
>> index 12d00dc..57f5e9a 100644
>> --- a/second/fs/ext2.c
>> +++ b/second/fs/ext2.c
>> @@ -163,9 +163,3 @@ void *realloc(void *p, int size)
>> {
>> return NULL;
>> }
>> -
>> -int posix_memalign(void **memptr, size_t alignment, size_t size)
>> -{
>> - *memptr = NULL;
>> - return -1;
>> -}
>
> With that patch, I now get a different error:
>
> SILO Version 1.4.14
> ERROR: Last trap: Memory Address not aligned
>
> Error -256
> {0] OK
>
> (Now I've got to boot off my rescue CD and rebuild SILO)
>
> Is anyone else getting the same error?
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (7 preceding siblings ...)
2011-01-17 17:02 ` silo fails to build with e2fsprogs-1.41.14 (undefined references Richard Mortimer
@ 2011-01-17 17:23 ` Alex Buell
2011-01-17 17:35 ` Alex Buell
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Alex Buell @ 2011-01-17 17:23 UTC (permalink / raw)
To: sparclinux
On Mon, 2011-01-17 at 17:02 +0000, Richard Mortimer wrote:
> >> - malloc_ptr = (char *) ((((unsigned long) malloc_ptr) + 7)& (~7));
> >> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
> I think that should be 8UL because align_ptr_to does -1 to make it 7.
> >> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
> Ditto
That would explain the different error, this time it was 256, the
previous error was -1^32.
I'll change the patch with the new values and see if that works.
--
Tactical Nuclear Kittens
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (8 preceding siblings ...)
2011-01-17 17:23 ` silo fails to build with e2fsprogs-1.41.14 (undefined Alex Buell
@ 2011-01-17 17:35 ` Alex Buell
2011-01-17 21:12 ` David Miller
2011-01-17 21:14 ` David Miller
11 siblings, 0 replies; 13+ messages in thread
From: Alex Buell @ 2011-01-17 17:35 UTC (permalink / raw)
To: sparclinux
On Mon, 2011-01-17 at 17:23 +0000, Alex Buell wrote:
> On Mon, 2011-01-17 at 17:02 +0000, Richard Mortimer wrote:
>
> > >> - malloc_ptr = (char *) ((((unsigned long) malloc_ptr) + 7)&
> (~7));
> > >> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
> > I think that should be 8UL because align_ptr_to does -1 to make it
> 7.
>
> > >> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
> > Ditto
>
> That would explain the different error, this time it was 256, the
> previous error was -1^32.
>
> I'll change the patch with the new values and see if that works.
Well done, that fixed the problem. Thank you. For anyone who's
interested, here's the patch in full with Richard Mortimer's changes:
diff -uNr silo-1.4.14/second/fs/ext2.c silo/second/fs/ext2.c
--- a/common/malloc.c
+++ b/common/malloc.c
@@ -27,6 +27,12 @@ static char *malloc_ptr = (char *) MALLOC_BASE;
static char *last_alloc = 0;
+static char *align_ptr_to(char *ptr, unsigned long align)
+{
+ return (char *) ((((unsigned long) ptr) + (align - 1UL)) &
+ ~(align - 1UL));
+}
+
void *malloc (int size)
{
char *caddr;
@@ -34,10 +40,34 @@ void *malloc (int size)
caddr = malloc_ptr;
malloc_ptr += size;
last_alloc = caddr;
- malloc_ptr = (char *) ((((unsigned long) malloc_ptr) + 7) & (~7));
+ malloc_ptr = align_ptr_to(malloc_ptr, 8UL);
return caddr;
}
+int posix_memalign(void **memptr, unsigned long alignment, unsigned
long size)
+{
+ char *caddr;
+
+ if (alignment & (alignment - 1UL))
+ return -1;
+ if (alignment & (sizeof(void *) - 1UL))
+ return -1;
+
+ if (size = 0) {
+ *memptr = (void *) 0;
+ return 0;
+ }
+
+ caddr = align_ptr_to(malloc_ptr, alignment);
+ malloc_ptr = (caddr + size);
+ last_alloc = caddr;
+ malloc_ptr = align_ptr_to(malloc_ptr, 8UL);
+
+ *memptr = caddr;
+
+ return 0;
+}
+
void free (void *m)
{
if (m = last_alloc)
--
Tactical Nuclear Kittens
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (9 preceding siblings ...)
2011-01-17 17:35 ` Alex Buell
@ 2011-01-17 21:12 ` David Miller
2011-01-17 21:14 ` David Miller
11 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2011-01-17 21:12 UTC (permalink / raw)
To: sparclinux
From: Alex Buell <alex.buell@munted.org.uk>
Date: Mon, 17 Jan 2011 17:35:27 +0000
> On Mon, 2011-01-17 at 17:23 +0000, Alex Buell wrote:
>> On Mon, 2011-01-17 at 17:02 +0000, Richard Mortimer wrote:
>>
>> > >> - malloc_ptr = (char *) ((((unsigned long) malloc_ptr) + 7)&
>> (~7));
>> > >> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
>> > I think that should be 8UL because align_ptr_to does -1 to make it
>> 7.
>>
>> > >> + malloc_ptr = align_ptr_to(malloc_ptr, 7UL);
>> > Ditto
>>
>> That would explain the different error, this time it was 256, the
>> previous error was -1^32.
>>
>> I'll change the patch with the new values and see if that works.
>
> Well done, that fixed the problem. Thank you. For anyone who's
> interested, here's the patch in full with Richard Mortimer's changes:
Thanks a lot, sorry for the stupid thinko :-)
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: silo fails to build with e2fsprogs-1.41.14 (undefined
2011-01-10 19:10 silo fails to build with e2fsprogs-1.41.14 (undefined references Raúl Porcel
` (10 preceding siblings ...)
2011-01-17 21:12 ` David Miller
@ 2011-01-17 21:14 ` David Miller
11 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2011-01-17 21:14 UTC (permalink / raw)
To: sparclinux
From: Alex Buell <alex.buell@munted.org.uk>
Date: Mon, 17 Jan 2011 17:35:27 +0000
> Well done, that fixed the problem. Thank you. For anyone who's
> interested, here's the patch in full with Richard Mortimer's changes:
The final working version is pushed to the silo GIT repo, please
double check that it works fine there too.
Thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread