Changeset View
Changeset View
Standalone View
Standalone View
head/sys/riscv/riscv/support.S
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
* int casueword32(volatile uint32_t *, uint32_t, uint32_t *, uint32_t) | * int casueword32(volatile uint32_t *, uint32_t, uint32_t *, uint32_t) | ||||
*/ | */ | ||||
ENTRY(casueword32) | ENTRY(casueword32) | ||||
li a4, (VM_MAXUSER_ADDRESS-3) | li a4, (VM_MAXUSER_ADDRESS-3) | ||||
bgt a0, a4, fsu_fault_nopcb | bgt a0, a4, fsu_fault_nopcb | ||||
la a6, fsu_fault /* Load the fault handler */ | la a6, fsu_fault /* Load the fault handler */ | ||||
SET_FAULT_HANDLER(a6, a4) /* And set it */ | SET_FAULT_HANDLER(a6, a4) /* And set it */ | ||||
ENTER_USER_ACCESS(a4) | ENTER_USER_ACCESS(a4) | ||||
1: lr.w a4, 0(a0) /* Load-exclusive the data */ | lr.w a4, 0(a0) /* Load-exclusive the data */ | ||||
bne a4, a1, 2f /* If not equal then exit */ | bne a4, a1, 1f /* If not equal then exit */ | ||||
sc.w a5, a3, 0(a0) /* Store the new data */ | sc.w a5, a3, 0(a0) /* Store the new data */ | ||||
bnez a5, 1b /* Retry on failure */ | beqz a5, 2f /* Success */ | ||||
2: EXIT_USER_ACCESS(a5) | 1: li a5, 1 /* Normalize failure result */ | ||||
SET_FAULT_HANDLER(x0, a5) /* Reset the fault handler */ | 2: EXIT_USER_ACCESS(a6) | ||||
SET_FAULT_HANDLER(x0, a6) /* Reset the fault handler */ | |||||
sw a4, 0(a2) /* Store the read data */ | sw a4, 0(a2) /* Store the read data */ | ||||
li a0, 0 /* Success */ | mv a0, a5 /* Success indicator */ | ||||
ret /* Return */ | ret /* Return */ | ||||
END(casueword32) | END(casueword32) | ||||
/* | /* | ||||
* int casueword(volatile u_long *, u_long, u_long *, u_long) | * int casueword(volatile u_long *, u_long, u_long *, u_long) | ||||
*/ | */ | ||||
ENTRY(casueword) | ENTRY(casueword) | ||||
li a4, (VM_MAXUSER_ADDRESS-7) | li a4, (VM_MAXUSER_ADDRESS-7) | ||||
bgt a0, a4, fsu_fault_nopcb | bgt a0, a4, fsu_fault_nopcb | ||||
la a6, fsu_fault /* Load the fault handler */ | la a6, fsu_fault /* Load the fault handler */ | ||||
SET_FAULT_HANDLER(a6, a4) /* And set it */ | SET_FAULT_HANDLER(a6, a4) /* And set it */ | ||||
ENTER_USER_ACCESS(a4) | ENTER_USER_ACCESS(a4) | ||||
1: lr.d a4, 0(a0) /* Load-exclusive the data */ | lr.d a4, 0(a0) /* Load-exclusive the data */ | ||||
bne a4, a1, 2f /* If not equal then exit */ | bne a4, a1, 1f /* If not equal then exit */ | ||||
sc.d a5, a3, 0(a0) /* Store the new data */ | sc.d a5, a3, 0(a0) /* Store the new data */ | ||||
bnez a5, 1b /* Retry on failure */ | beqz a5, 2f /* Success */ | ||||
2: EXIT_USER_ACCESS(a5) | 1: li a5, 1 /* Normalize failure result */ | ||||
SET_FAULT_HANDLER(x0, a5) /* Reset the fault handler */ | 2: EXIT_USER_ACCESS(a6) | ||||
SET_FAULT_HANDLER(x0, a6) /* Reset the fault handler */ | |||||
sd a4, 0(a2) /* Store the read data */ | sd a4, 0(a2) /* Store the read data */ | ||||
li a0, 0 /* Success */ | mv a0, a5 /* Success indicator */ | ||||
ret /* Return */ | ret /* Return */ | ||||
END(casueword) | END(casueword) | ||||
/* | /* | ||||
* int fubyte(volatile const void *) | * int fubyte(volatile const void *) | ||||
*/ | */ | ||||
ENTRY(fubyte) | ENTRY(fubyte) | ||||
li a1, VM_MAXUSER_ADDRESS | li a1, VM_MAXUSER_ADDRESS | ||||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |