darwin-xnu/osfmk/i386/ntoh.s
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
   3 *
   4 * @APPLE_LICENSE_HEADER_START@
   5 * 
   6 * The contents of this file constitute Original Code as defined in and
   7 * are subject to the Apple Public Source License Version 1.1 (the
   8 * "License").  You may not use this file except in compliance with the
   9 * License.  Please obtain a copy of the License at
  10 * http://www.apple.com/publicsource and read it before using this file.
  11 * 
  12 * This Original Code and all software distributed under the License are
  13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  17 * License for the specific language governing rights and limitations
  18 * under the License.
  19 * 
  20 * @APPLE_LICENSE_HEADER_END@
  21 */
  22/*
  23 * @OSF_COPYRIGHT@
  24 */
  25/*
  26 * HISTORY
  27 * 
  28 * Revision 1.1.1.1  1998/09/22 21:05:37  wsanchez
  29 * Import of Mac OS X kernel (~semeria)
  30 *
  31 * Revision 1.1.1.1  1998/03/07 02:25:38  wsanchez
  32 * Import of OSF Mach kernel (~mburg)
  33 *
  34 * Revision 1.1.6.1  1994/09/23  01:59:41  ezf
  35 *      change marker to not FREE
  36 *      [1994/09/22  21:25:28  ezf]
  37 *
  38 * Revision 1.1.2.2  1993/06/02  23:26:45  jeffc
  39 *      Added to OSF/1 R1.3 from NMK15.0.
  40 *      [1993/06/02  21:06:38  jeffc]
  41 * 
  42 * Revision 1.1  1992/09/30  02:43:08  robert
  43 *      Initial revision
  44 * 
  45 * $EndLog$
  46 */
  47/* CMU_HIST */
  48/*
  49 * Revision 2.4  91/05/14  16:12:50  mrt
  50 *      Correcting copyright
  51 * 
  52 * Revision 2.3  91/02/14  15:04:55  mrt
  53 *      Changed to new Mach copyright
  54 * 
  55 * 
  56 * Revision 2.2  90/05/03  15:34:56  dbg
  57 *      First checkin.
  58 * 
  59 *      New a.out and coff compatible .s files.
  60 *      [89/10/16            rvb]
  61 *
  62 * Revision 1.3  89/02/26  12:35:37  gm0w
  63 *      Changes for cleanup.
  64 * 
  65 * 16-Feb-89  Robert Baron (rvb) at Carnegie-Mellon University
  66 *      Created.
  67 *
  68 */
  69/* CMU_ENDHIST */
  70/* 
  71 * Mach Operating System
  72 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
  73 * All Rights Reserved.
  74 * 
  75 * Permission to use, copy, modify and distribute this software and its
  76 * documentation is hereby granted, provided that both the copyright
  77 * notice and this permission notice appear in all copies of the
  78 * software, derivative works or modified versions, and any portions
  79 * thereof, and that both notices appear in supporting documentation.
  80 * 
  81 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  82 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  83 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  84 * 
  85 * Carnegie Mellon requests users of this software to return to
  86 * 
  87 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  88 *  School of Computer Science
  89 *  Carnegie Mellon University
  90 *  Pittsburgh PA 15213-3890
  91 * 
  92 * any improvements or extensions that they make and grant Carnegie Mellon
  93 * the rights to redistribute these changes.
  94 */
  95/*
  96 */
  97
  98#include <i386/asm.h>
  99
 100Entry(ntohl)
 101ENTRY(htonl)
 102        movl    4(%esp), %eax
 103        rorw    $8, %ax
 104        ror     $16,%eax
 105        rorw    $8, %ax
 106        ret
 107
 108
 109Entry(ntohs)
 110ENTRY(htons)
 111        movzwl  4(%esp), %eax
 112        rorw    $8, %ax
 113        ret
 114
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.