Date: Sun, 30 Jul 2006 12:57:32 +0200 From: Divacky Roman <xdivac02@stud.fit.vutbr.cz> To: hackers@freebsd.org Subject: VM question related to faults Message-ID: <20060730105731.GA64955@stud.fit.vutbr.cz>
next in thread | raw e-mail | index | archive | help
hi, while working on SoC linuxolator project I am in a need of this: I need to do some operation on memory like mem1 = mem1 + mem2 etc. where the mem1/mem2 access can trigger fault. (memory not mapped or something) currently I solve this by using pcb_onfault. this must be done in asm (kib@ told me) so currently the code looks like this: futex_fault: movl PCPU(CURPCB), %edx movl $0, PCB_ONFAULT(%edx) movl $-EFAULT, %eax ret /* int futex_xchgl(int oparg, caddr_t uaddr, int *oldval); */ .globl futex_xchgl futex_xchgl: movl PCPU(CURPCB), %eax movl $futex_fault, PCB_ONFAULT(%eax) movl 4(%esp), %eax movl 8(%esp), %edx xchgl %eax, (%edx) movl 0xc(%esp), %edx movl %eax, (%edx) xorl %eax, %eax movl PCPU(CURPCB), %edx movl $0, PCB_ONFAULT(%edx) ret this is not very nice nor portable. I wonder if its possible to do something like this: LOCK_VM_SOMEHOW(); if (!memory_accessible(mem1) || !memory_accessible(mem2)) return EFAULT; mem1 = mem1 + mem2; UNLOCK_VM_SOMEHOW(); if its possible - what is the LOCK_VM_SOMEHOW lock? and what is the memory_accessible() function? thnx for pointing me to the right directions roman ---------------------- www.liberalnistrana.cz
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060730105731.GA64955>