Changeset View
Changeset View
Standalone View
Standalone View
head/sys/riscv/riscv/support.S
Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | EENTRY(suword64) | ||||
SET_FAULT_HANDLER(a6, a2) /* And set it */ | SET_FAULT_HANDLER(a6, a2) /* And set it */ | ||||
sd a1, 0(a0) /* Try storing the data */ | sd a1, 0(a0) /* Try storing the data */ | ||||
SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ | SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ | ||||
li a0, 0 /* Success */ | li a0, 0 /* Success */ | ||||
ret /* Return */ | ret /* Return */ | ||||
EEND(suword64) | EEND(suword64) | ||||
END(suword) | END(suword) | ||||
/* | |||||
* fuswintr and suswintr are just like fusword and susword except that if | |||||
* the page is not in memory or would cause a trap, then we return an error. | |||||
* The important thing is to prevent sleep() and switch(). | |||||
*/ | |||||
/* | |||||
* Special handler so the trap code knows not to sleep. | |||||
*/ | |||||
ENTRY(fsu_intr_fault) | |||||
SET_FAULT_HANDLER(x0, a1) /* Reset the handler function */ | |||||
li a0, -1 | |||||
ret | |||||
END(fsu_fault) | |||||
/* | |||||
* int fuswintr(void *) | |||||
*/ | |||||
ENTRY(fuswintr) | |||||
li a1, (VM_MAXUSER_ADDRESS-3) | |||||
bgt a0, a1, fsu_fault_nopcb | |||||
la a6, fsu_intr_fault /* Load the fault handler */ | |||||
SET_FAULT_HANDLER(a6, a1) /* And set it */ | |||||
lw a0, 0(a0) /* Try loading the data */ | |||||
SET_FAULT_HANDLER(x0, x1) /* Reset the fault handler */ | |||||
ret /* Return */ | |||||
END(fuswintr) | |||||
/* | |||||
* int suswintr(void *base, int word) | |||||
*/ | |||||
ENTRY(suswintr) | |||||
li a2, (VM_MAXUSER_ADDRESS-3) | |||||
bgt a0, a2, fsu_fault_nopcb | |||||
la a6, fsu_intr_fault /* Load the fault handler */ | |||||
SET_FAULT_HANDLER(a6, a2) /* And set it */ | |||||
sw a1, 0(a0) /* Try storing the data */ | |||||
SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ | |||||
li a0, 0 /* Success */ | |||||
ret /* Return */ | |||||
END(suswintr) | |||||
ENTRY(setjmp) | ENTRY(setjmp) | ||||
/* Store the stack pointer */ | /* Store the stack pointer */ | ||||
sd sp, 0(a0) | sd sp, 0(a0) | ||||
addi a0, a0, 8 | addi a0, a0, 8 | ||||
/* Store the general purpose registers and ra */ | /* Store the general purpose registers and ra */ | ||||
sd s0, (0 * 8)(a0) | sd s0, (0 * 8)(a0) | ||||
sd s1, (1 * 8)(a0) | sd s1, (1 * 8)(a0) | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |