Use unsigned loads in fubyte, fuword16, generic_bs_r_1, generic_bs_r_2

as these functions should do zero-extend.

Discovered by running pci_read_cap(), and by hint from James Clarke.

Reviewed by:	James Clarke <jrtc27@jrtc27.com>
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D23236
This commit is contained in:
Ruslan Bukin 2020-01-17 16:48:20 +00:00
parent 909107075c
commit 36e33a8ef0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356834
2 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2016 Ruslan Bukin <br@bsdpad.com>
* Copyright (c) 2016-2020 Ruslan Bukin <br@bsdpad.com>
* All rights reserved.
*
* Portions of this software were developed by SRI International and the
@ -38,13 +38,13 @@ __FBSDID("$FreeBSD$");
ENTRY(generic_bs_r_1)
add a3, a1, a2
lb a0, 0(a3)
lbu a0, 0(a3)
ret
END(generic_bs_r_1)
ENTRY(generic_bs_r_2)
add a3, a1, a2
lh a0, 0(a3)
lhu a0, 0(a3)
ret
END(generic_bs_r_2)

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2015-2018 Ruslan Bukin <br@bsdpad.com>
* Copyright (c) 2015-2020 Ruslan Bukin <br@bsdpad.com>
* All rights reserved.
*
* Portions of this software were developed by SRI International and the
@ -102,7 +102,7 @@ ENTRY(fubyte)
la a6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(a6, a1) /* And set it */
ENTER_USER_ACCESS(a1)
lb a0, 0(a0) /* Try loading the data */
lbu a0, 0(a0) /* Try loading the data */
EXIT_USER_ACCESS(a1)
SET_FAULT_HANDLER(x0, a1) /* Reset the fault handler */
ret /* Return */
@ -117,7 +117,7 @@ ENTRY(fuword16)
la a6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(a6, a1) /* And set it */
ENTER_USER_ACCESS(a1)
lh a0, 0(a0) /* Try loading the data */
lhu a0, 0(a0) /* Try loading the data */
EXIT_USER_ACCESS(a1)
SET_FAULT_HANDLER(x0, a1) /* Reset the fault handler */
ret /* Return */