Re: [PATCH v2 04/12] bsd-user: various helper routines for sysctl

2023-02-14 Thread Richard Henderson
On 2/14/23 11:31, Warner Losh wrote: Right now they aren't used at all for ABI64...  But that's in later patches...  We only do special things for  LONG or ULONG on ABI32... Otherwise, the normal paths wouldn't call these at all. Yes, I've just seen patch 9, and agree they aren't needed for a

Re: [PATCH v2 04/12] bsd-user: various helper routines for sysctl

2023-02-14 Thread Warner Losh
On Tue, Feb 14, 2023 at 1:52 PM Richard Henderson < richard.hender...@linaro.org> wrote: > On 2/13/23 14:27, Warner Losh wrote: > > +#ifdef TARGET_ABI32 > > +/* > > + * Limit the amount of available memory to be most of the 32-bit address > > + * space. 0x100c000 was arrived at through trial and e

Re: [PATCH v2 04/12] bsd-user: various helper routines for sysctl

2023-02-14 Thread Richard Henderson
On 2/13/23 14:27, Warner Losh wrote: +#ifdef TARGET_ABI32 +/* + * Limit the amount of available memory to be most of the 32-bit address + * space. 0x100c000 was arrived at through trial and error as a good + * definition of 'most'. + */ +static const abi_ulong target_max_mem = UINT32_MAX - 0x100c

[PATCH v2 04/12] bsd-user: various helper routines for sysctl

2023-02-14 Thread Warner Losh
cap_memory - Caps the memory to just below MAXINT scale_to_target_pages - Account for difference in host / targe page size h2t_long_sat - converts a int64_t to a int32_t, saturating at max / min values h2t_ulong_sat - converts a uint64_t to a uint32_t, saturating at max value Signed-off-by: Warner