subr_uio.c (f0188618f2abe08246731cf09b0b0a99609fd34c) | subr_uio.c (4f3dc900231ae7975a614581b973ce530836a0c9) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. 9 * | 1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. 9 * |
10 * Copyright (c) 2014 The FreeBSD Foundation 11 * 12 * Portions of this software were developed by Konstantin Belousov 13 * under sponsorship from the FreeBSD Foundation. 14 * |
|
10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. --- 415 unchanged lines hidden (view full) --- 433 map = &td->td_proc->p_vmspace->vm_map; 434 size = (vm_size_t)round_page(sz); 435 436 if (vm_map_remove(map, addr, addr + size) != KERN_SUCCESS) 437 return (EINVAL); 438 439 return (0); 440} | 15 * Redistribution and use in source and binary forms, with or without 16 * modification, are permitted provided that the following conditions 17 * are met: 18 * 1. Redistributions of source code must retain the above copyright 19 * notice, this list of conditions and the following disclaimer. 20 * 2. Redistributions in binary form must reproduce the above copyright 21 * notice, this list of conditions and the following disclaimer in the 22 * documentation and/or other materials provided with the distribution. --- 415 unchanged lines hidden (view full) --- 438 map = &td->td_proc->p_vmspace->vm_map; 439 size = (vm_size_t)round_page(sz); 440 441 if (vm_map_remove(map, addr, addr + size) != KERN_SUCCESS) 442 return (EINVAL); 443 444 return (0); 445} |
446 447#ifdef NO_FUEWORD 448/* 449 * XXXKIB The temporal implementation of fue*() functions which do not 450 * handle usermode -1 properly, mixing it with the fault code. Keep 451 * this until MD code is written. Currently sparc64, mips and arm do 452 * not have proper implementation. 453 */ 454 455int 456fueword(const void *base, long *val) 457{ 458 long res; 459 460 res = fuword(base); 461 if (res == -1) 462 return (-1); 463 *val = res; 464 return (0); 465} 466 467int 468fueword32(const void *base, int32_t *val) 469{ 470 int32_t res; 471 472 res = fuword32(base); 473 if (res == -1) 474 return (-1); 475 *val = res; 476 return (0); 477} 478 479#ifdef _LP64 480int 481fueword64(const void *base, int64_t *val) 482{ 483 int32_t res; 484 485 res = fuword64(base); 486 if (res == -1) 487 return (-1); 488 *val = res; 489 return (0); 490} 491#endif 492 493int 494casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, 495 uint32_t newval) 496{ 497 int32_t ov; 498 499 ov = casuword32(base, oldval, newval); 500 if (ov == -1) 501 return (-1); 502 *oldvalp = ov; 503 return (0); 504} 505 506int 507casueword(volatile u_long *p, u_long oldval, u_long *oldvalp, u_long newval) 508{ 509 u_long ov; 510 511 ov = casuword(p, oldval, newval); 512 if (ov == -1) 513 return (-1); 514 *oldvalp = ov; 515 return (0); 516} 517#else /* NO_FUEWORD */ 518int32_t 519fuword32(const void *addr) 520{ 521 int rv; 522 int32_t val; 523 524 rv = fueword32(addr, &val); 525 return (rv == -1 ? -1 : val); 526} 527 528#ifdef _LP64 529int64_t 530fuword64(const void *addr) 531{ 532 int rv; 533 int64_t val; 534 535 rv = fueword64(addr, &val); 536 return (rv == -1 ? -1 : val); 537} 538#endif /* _LP64 */ 539 540long 541fuword(const void *addr) 542{ 543 long val; 544 int rv; 545 546 rv = fueword(addr, &val); 547 return (rv == -1 ? -1 : val); 548} 549 550uint32_t 551casuword32(volatile uint32_t *addr, uint32_t old, uint32_t new) 552{ 553 int rv; 554 uint32_t val; 555 556 rv = casueword32(addr, old, &val, new); 557 return (rv == -1 ? -1 : val); 558} 559 560u_long 561casuword(volatile u_long *addr, u_long old, u_long new) 562{ 563 int rv; 564 u_long val; 565 566 rv = casueword(addr, old, &val, new); 567 return (rv == -1 ? -1 : val); 568} 569 570#endif /* NO_FUEWORD */ |
|