Deleted Added
full compact
support.s (271071) support.s (274648)
1/*-
2 * Copyright (c) 1993 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 1993 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: stable/10/sys/i386/i386/support.s 271071 2014-09-04 00:40:41Z pfg $
29 * $FreeBSD: stable/10/sys/i386/i386/support.s 274648 2014-11-18 12:53:32Z kib $
30 */
31
32#include "opt_npx.h"
33
34#include <machine/asmacros.h>
35#include <machine/cputypes.h>
36#include <machine/intr_machdep.h>
37#include <machine/pmap.h>

--- 346 unchanged lines hidden (view full) ---

384 popl %edi
385 popl %esi
386 movl PCPU(CURPCB),%edx
387 movl $0,PCB_ONFAULT(%edx)
388 movl $EFAULT,%eax
389 ret
390
391/*
30 */
31
32#include "opt_npx.h"
33
34#include <machine/asmacros.h>
35#include <machine/cputypes.h>
36#include <machine/intr_machdep.h>
37#include <machine/pmap.h>

--- 346 unchanged lines hidden (view full) ---

384 popl %edi
385 popl %esi
386 movl PCPU(CURPCB),%edx
387 movl $0,PCB_ONFAULT(%edx)
388 movl $EFAULT,%eax
389 ret
390
391/*
392 * casuword. Compare and set user word. Returns -1 or the current value.
392 * casueword. Compare and set user word. Returns -1 on fault,
393 * 0 on non-faulting access. The current value is in *oldp.
393 */
394 */
394
395ALTENTRY(casuword32)
396ENTRY(casuword)
395ALTENTRY(casueword32)
396ENTRY(casueword)
397 movl PCPU(CURPCB),%ecx
398 movl $fusufault,PCB_ONFAULT(%ecx)
399 movl 4(%esp),%edx /* dst */
400 movl 8(%esp),%eax /* old */
397 movl PCPU(CURPCB),%ecx
398 movl $fusufault,PCB_ONFAULT(%ecx)
399 movl 4(%esp),%edx /* dst */
400 movl 8(%esp),%eax /* old */
401 movl 12(%esp),%ecx /* new */
401 movl 16(%esp),%ecx /* new */
402
403 cmpl $VM_MAXUSER_ADDRESS-4,%edx /* verify address is valid */
404 ja fusufault
405
406#ifdef SMP
407 lock
408#endif
409 cmpxchgl %ecx,(%edx) /* Compare and set. */
410
411 /*
412 * The old value is in %eax. If the store succeeded it will be the
413 * value we expected (old) from before the store, otherwise it will
414 * be the current value.
415 */
416
417 movl PCPU(CURPCB),%ecx
418 movl $0,PCB_ONFAULT(%ecx)
402
403 cmpl $VM_MAXUSER_ADDRESS-4,%edx /* verify address is valid */
404 ja fusufault
405
406#ifdef SMP
407 lock
408#endif
409 cmpxchgl %ecx,(%edx) /* Compare and set. */
410
411 /*
412 * The old value is in %eax. If the store succeeded it will be the
413 * value we expected (old) from before the store, otherwise it will
414 * be the current value.
415 */
416
417 movl PCPU(CURPCB),%ecx
418 movl $0,PCB_ONFAULT(%ecx)
419 movl 12(%esp),%edx /* oldp */
420 movl %eax,(%edx)
421 xorl %eax,%eax
419 ret
422 ret
420END(casuword32)
421END(casuword)
423END(casueword32)
424END(casueword)
422
423/*
424 * Fetch (load) a 32-bit word, a 16-bit word, or an 8-bit byte from user
425
426/*
427 * Fetch (load) a 32-bit word, a 16-bit word, or an 8-bit byte from user
425 * memory. All these functions are MPSAFE.
428 * memory.
426 */
427
429 */
430
428ALTENTRY(fuword32)
429ENTRY(fuword)
431ALTENTRY(fueword32)
432ENTRY(fueword)
430 movl PCPU(CURPCB),%ecx
431 movl $fusufault,PCB_ONFAULT(%ecx)
432 movl 4(%esp),%edx /* from */
433
434 cmpl $VM_MAXUSER_ADDRESS-4,%edx /* verify address is valid */
435 ja fusufault
436
437 movl (%edx),%eax
438 movl $0,PCB_ONFAULT(%ecx)
433 movl PCPU(CURPCB),%ecx
434 movl $fusufault,PCB_ONFAULT(%ecx)
435 movl 4(%esp),%edx /* from */
436
437 cmpl $VM_MAXUSER_ADDRESS-4,%edx /* verify address is valid */
438 ja fusufault
439
440 movl (%edx),%eax
441 movl $0,PCB_ONFAULT(%ecx)
442 movl 8(%esp),%edx
443 movl %eax,(%edx)
444 xorl %eax,%eax
439 ret
445 ret
440END(fuword32)
441END(fuword)
446END(fueword32)
447END(fueword)
442
443/*
444 * fuswintr() and suswintr() are specialized variants of fuword16() and
445 * suword16(), respectively. They are called from the profiling code,
446 * potentially at interrupt time. If they fail, that's okay; good things
447 * will happen later. They always fail for now, until the trap code is
448 * able to deal with this.
449 */

--- 382 unchanged lines hidden ---
448
449/*
450 * fuswintr() and suswintr() are specialized variants of fuword16() and
451 * suword16(), respectively. They are called from the profiling code,
452 * potentially at interrupt time. If they fail, that's okay; good things
453 * will happen later. They always fail for now, until the trap code is
454 * able to deal with this.
455 */

--- 382 unchanged lines hidden ---