Changeset View
Changeset View
Standalone View
Standalone View
sys/mips/mips/support.S
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Primitives | * Primitives | ||||
*/ | */ | ||||
.text | .text | ||||
/* | /* | ||||
* See if access to addr with a len type instruction causes a machine check. | |||||
* len is length of access (1=byte, 2=short, 4=int) | |||||
* | |||||
* badaddr(addr, len) | |||||
* char *addr; | |||||
* int len; | |||||
*/ | |||||
LEAF(badaddr) | |||||
PTR_LA v0, baderr | |||||
GET_CPU_PCPU(v1) | |||||
PTR_L v1, PC_CURPCB(v1) | |||||
bne a1, 1, 2f | |||||
PTR_S v0, U_PCB_ONFAULT(v1) | |||||
b 5f | |||||
lbu v0, (a0) | |||||
2: | |||||
bne a1, 2, 4f | |||||
nop | |||||
b 5f | |||||
lhu v0, (a0) | |||||
4: | |||||
lw v0, (a0) | |||||
5: | |||||
PTR_S zero, U_PCB_ONFAULT(v1) | |||||
j ra | |||||
move v0, zero # made it w/o errors | |||||
baderr: | |||||
j ra | |||||
li v0, 1 # trap sends us here | |||||
END(badaddr) | |||||
/* | |||||
* int copystr(void *kfaddr, void *kdaddr, size_t maxlen, size_t *lencopied) | * int copystr(void *kfaddr, void *kdaddr, size_t maxlen, size_t *lencopied) | ||||
* Copy a NIL-terminated string, at most maxlen characters long. Return the | * Copy a NIL-terminated string, at most maxlen characters long. Return the | ||||
* number of characters copied (including the NIL) in *lencopied. If the | * number of characters copied (including the NIL) in *lencopied. If the | ||||
* string is too long, return ENAMETOOLONG; else return 0. | * string is too long, return ENAMETOOLONG; else return 0. | ||||
*/ | */ | ||||
LEAF(copystr) | LEAF(copystr) | ||||
move t0, a2 | move t0, a2 | ||||
beq a2, zero, 4f | beq a2, zero, 4f | ||||
▲ Show 20 Lines • Show All 890 Lines • Show Last 20 Lines |