Re: [RFC PATCH v1 3/6] tools/nolibc: i386: Implement syscall with 6 arguments

From: Willy Tarreau
Date: Sun Mar 20 2022 - 10:03:47 EST


Hi David,

On Sun, Mar 20, 2022 at 01:10:33PM +0000, David Laight wrote:
> And using xchg is slow - it is always locked.

Note that we don't really care here, as it remains minimal compared to
an mmap() call.

> One possibility might be to do:
> push arg6
> push %ebp
> mov %ebp, 4(%sp)
> int 0x80
> pop %ebp
> add %esp,4
>
> Although I'm not sure you really want to allocate 4k pages
> for every malloc() call.

Well, it depends. I would argue that we don't even need malloc() but
on the other hand this is essentially used to write small regtests so
we don't really care about the waste here if someone really needs it.

I'd rather get Ammar's motivations for malloc() in the first place.

Willy