[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/3] bswap: Add new stn_*_p() and ldn_*_p() memo
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 1/3] bswap: Add new stn_*_p() and ldn_*_p() memory access functions |
Date: |
Mon, 11 Jun 2018 18:51:55 +0100 |
On 11 June 2018 at 18:43, Philippe Mathieu-Daudé <address@hidden> wrote:
> Hi Peter,
>
> On 06/11/2018 02:10 PM, Peter Maydell wrote:
>> +/* Store v to p as a sz byte value in host order */
>> +#define DO_STN_LDN_P(END) \
>> + static inline void stn_## END ## _p(void *ptr, int sz, uint64_t v) \
>> + { \
>> + switch (sz) { \
>> + case 1: \
>> + stb_p(ptr, v); \
>> + break; \
>> + case 2: \
>> + stw_ ## END ## _p(ptr, v); \
>> + break; \
>> + case 4: \
>> + stl_ ## END ## _p(ptr, v); \
>> + break; \
>> + case 8: \
>> + stq_ ## END ## _p(ptr, v); \
>> + break; \
>> + default: \
>> + g_assert_not_reached(); \
>
> As with the recent discussion with Markus about whether using abort() or
> g_assert_not_reached(), I'd prefer to keep abort() here (which is what
> exec.c currently uses).
>
> [http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg01869.html]
I couldn't find anything obvious about the merits of abort() vs
g_assert_not_reached() in that email. g_assert_not_reached() is clear
about what it's doing and we use it in hundreds of places in the
codebase, whereas abort() is used for various things, including
situations where flow-of-execution clearly can get to that location.
So I prefer g_assert_not_reached().
thanks
-- PMM
- [Qemu-devel] [PATCH 0/3] Add ldn_*_p() and stn_*_p() and use them in exec.c, Peter Maydell, 2018/06/11
- [Qemu-devel] [PATCH 1/3] bswap: Add new stn_*_p() and ldn_*_p() memory access functions, Peter Maydell, 2018/06/11
- [Qemu-devel] [PATCH 3/3] exec.c: Use stn_p() and ldn_p() instead of explicit switches, Peter Maydell, 2018/06/11
- [Qemu-devel] [PATCH 2/3] exec.c: Don't accidentally sign-extend 4-byte loads in subpage_read(), Peter Maydell, 2018/06/11
- Re: [Qemu-devel] [PATCH 0/3] Add ldn_*_p() and stn_*_p() and use them in exec.c, no-reply, 2018/06/11
- Re: [Qemu-devel] [PATCH 0/3] Add ldn_*_p() and stn_*_p() and use them in exec.c, no-reply, 2018/06/11
- Re: [Qemu-devel] [PATCH 0/3] Add ldn_*_p() and stn_*_p() and use them in exec.c, Peter Maydell, 2018/06/15