mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
hw/bt: Don't use cpu_to_*w() and *_to_cpup()
Don't use cpu_to_*w() and *_to_cpup() to do byte-swapped loads and stores; instead use ld*_p() and st*_p() which correctly handle misaligned accesses. Bring the HNDL() macro into line with how we deal with PARAMHANDLE(), by using cpu_to_le16() rather than an ifdef HOST_WORDS_BIGENDIAN. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1467908460-27048-3-git-send-email-peter.maydell@linaro.org
This commit is contained in:
parent
b442642da1
commit
43120576cb
2 changed files with 9 additions and 13 deletions
10
hw/bt/hci.c
10
hw/bt/hci.c
|
@ -426,11 +426,7 @@ static void bt_submit_raw_acl(struct bt_piconet_s *net, int length, uint8_t *dat
|
|||
* be continuously allocated. We do it though, to preserve similar
|
||||
* behaviour between hosts. Some things, like the BD_ADDR cannot be
|
||||
* preserved though (for example if a real hci is used). */
|
||||
#ifdef HOST_WORDS_BIGENDIAN
|
||||
# define HNDL(raw) bswap16(raw)
|
||||
#else
|
||||
# define HNDL(raw) (raw)
|
||||
#endif
|
||||
#define HNDL(raw) cpu_to_le16(raw)
|
||||
|
||||
static const uint8_t bt_event_reserved_mask[8] = {
|
||||
0xff, 0x9f, 0xfb, 0xff, 0x07, 0x18, 0x00, 0x00,
|
||||
|
@ -1504,8 +1500,8 @@ static void bt_submit_hci(struct HCIInfo *info,
|
|||
return;
|
||||
|
||||
#define PARAM(cmd, param) (((cmd##_cp *) data)->param)
|
||||
#define PARAM16(cmd, param) le16_to_cpup(&PARAM(cmd, param))
|
||||
#define PARAMHANDLE(cmd) HNDL(PARAM(cmd, handle))
|
||||
#define PARAM16(cmd, param) lduw_le_p(&PARAM(cmd, param))
|
||||
#define PARAMHANDLE(cmd) PARAM16(cmd, handle)
|
||||
#define LENGTH_CHECK(cmd) if (length < sizeof(cmd##_cp)) goto short_hci
|
||||
/* Note: the supported commands bitmask in bt_hci_read_local_commands_rp
|
||||
* needs to be updated every time a command is implemented here! */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue