tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: fetch32/store32 et al



On Sat, 24 Oct 2009, Mindaugas Rasiukevicius wrote:

> Hello,
> 
> Unless anyone objects, I would like to replace current fuword(), suword()
> and friends with a little bit better API:
> 
>       int     fetch32(void *addr, uint32_t *c);
>       int     store32(void *addr, uint32_t c);
> 
> And equivalent routines to fetch/store 8, 16 and 64 (if needed) bit values.
> Routines would return 0 on success and EFAULT on failure.
> 
> Rationale:  1) there are already bugs in the tree where incorrect sizes of
> "word" are assumed (e.g. see amd64 fuword)  2) currently, fuword() et al
> cannot return -1 as a value.

Careful.  Looks like you're switching from unsigned to signed.  This can 
cause all sorts of unexpected behavior in some cases if the return values 
aren't properly masked.

Eduardo


Home | Main Index | Thread Index | Old Index