Date: Mon, 23 Oct 2006 10:25:04 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 108303 for review Message-ID: <200610231025.k9NAP47c062609@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=108303 Change 108303 by gonzo@gonzo_hq on 2006/10/23 10:24:50 o Implement subyte, suword, suword32, fuword and copyout functions required to execute init(8). Whoa! Now we crash gxemul in __start symbol of init(8). Time to hack crt1.c! Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/support.S#8 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/support.S#8 (text+ko) ==== @@ -30,6 +30,7 @@ #include <machine/cpuregs.h> __FBSDID("$FreeBSD$"); +#include <sys/errno.h> #include "assym.s" /* @@ -128,10 +129,15 @@ * <v0>int subyte(<a0>void *addr, <a1>int byte) */ ENTRY(subyte) - break - li v0, -1 - jr ra - nop + lw t2, pcpup + lw v1, PC_CURPCB(t2) + la v0, _C_LABEL(fswberr) + blt a0, zero, _C_LABEL(fswberr) + sw v0, PCB_ONFAULT(v1) + sb a1, 0(a0) # store byte + sw zero, PCB_ONFAULT(v1) + j ra + move v0, zero END(subyte) /* @@ -161,35 +167,36 @@ * <v0>int suword(<a0>void *addr, <a1>long word) */ ENTRY(suword) - break - li v0, -1 - jr ra - nop + lw t2, pcpup + lw v1, PC_CURPCB(t2) + la v0, _C_LABEL(fswberr) + blt a0, zero, _C_LABEL(fswberr) + sw v0, PCB_ONFAULT(v1) + sw a1, 0(a0) # store word + sw zero, PCB_ONFAULT(v1) + j ra + move v0, zero END(suword) /* * suword32(9) * <v0>int suword32(<a0>void *addr, <a1>int word) + * XXXMIPS: this implementation works only for MIPS32 */ ENTRY(suword32) - break - li v0, -1 - jr ra - nop + lw t2, pcpup + lw v1, PC_CURPCB(t2) + la v0, _C_LABEL(fswberr) + blt a0, zero, _C_LABEL(fswberr) + sw v0, PCB_ONFAULT(v1) + sw a1, 0(a0) # store word + sw zero, PCB_ONFAULT(v1) + j ra + move v0, zero + END(suword32) /* - * suword64(9) - * <v0>int suword64(<a0>void *addr, <a1>long word) - */ -ENTRY(suword64) - break - li v0, -1 - jr ra - nop -END(suword64) - -/* * Stubs for fetch(9) XXX fubyte() Fetches a byte of data from the user-space address base. @@ -243,10 +250,14 @@ * <v0>long fuword(<a0>const void *addr) */ ENTRY(fuword) - break - li v0, -1 - jr ra - nop + lw t2, pcpup + lw v1, PC_CURPCB(t2) + la v0, _C_LABEL(fswberr) + blt a0, zero, _C_LABEL(fswberr) + sw v0, PCB_ONFAULT(v1) + lw v0, 0(a0) # store byte + j ra + sw zero, PCB_ONFAULT(v1) END(fuword) /* @@ -283,12 +294,39 @@ * copyout(9) * <v0>int copyout(<a0>const void *kernaddr, <a1>void *useraddr, <a2>size_t len) */ -ENTRY(copyout) - break - jr ra - nop +NESTED(copyout, CALLFRAME_SIZ, ra) + subu sp, sp, CALLFRAME_SIZ + .mask 0x80000000, -4 + sw ra, CALLFRAME_RA(sp) + blt a1, zero, _C_LABEL(copyerr) + move v0, a0 # swap a0, a1 for call to memcpy + move a0, a1 + move a1, v0 + lw t2, pcpup + lw v1, PC_CURPCB(t2) + la v0, _C_LABEL(copyerr) + jal memcpy + sw v0, PCB_ONFAULT(v1) + + lw t2, pcpup + lw v1, PC_CURPCB(t2) + lw ra, CALLFRAME_RA(sp) + addu sp, sp, CALLFRAME_SIZ + sw zero, PCB_ONFAULT(v1) + j ra + move v0, zero END(copyout) +LEAF(copyerr) + lw t2, pcpup + lw v1, PC_CURPCB(t2) + lw ra, CALLFRAME_RA(sp) + addu sp, sp, CALLFRAME_SIZ + sw zero, PCB_ONFAULT(v1) + j ra + li v0, EFAULT # return EFAULT +END(copyerr) + /* * setjmp(9) * <v0>int setjmp(<a0>jmp_buf) @@ -335,14 +373,33 @@ nop END(longjmp) +/* + * Error routine for {f,s}uswintr. The fault handler in trap.c + * checks for pcb_onfault set to this fault handler and + * "bails out" before calling the VM fault handler. + * (We can not call VM code from interrupt level.) + */ +LEAF(fswintrberr) + nop + sw a2, PCB_ONFAULT(v1) + j ra + li v0, -1 +END(fswintrberr) + +LEAF(fswberr) +XLEAF(baderr) + sw zero, PCB_ONFAULT(v1) + j ra + li v0, -1 +END(fswberr) + /* * XXXMIPS: */ .data .globl intrcnt .globl eintrcnt - intrcnt: .space 1 eintrcnt: @@ -351,7 +408,6 @@ .globl intrnames .globl eintrnames - intrnames: .space 3 eintrnames:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610231025.k9NAP47c062609>