home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / vax / inline / langpats.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-08  |  5.3 KB  |  274 lines

  1. /*-
  2.  * Copyright (c) 1984, 1986 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
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  */
  33.  
  34. #ifndef lint
  35. static char sccsid[] = "@(#)langpats.c    7.3 (Berkeley) 5/8/91";
  36. #endif /* not lint */
  37.  
  38. #include "inline.h"
  39.  
  40. /*
  41.  * Pattern table for kernel specific routines.
  42.  * These patterns are based on the old asm.sed script.
  43.  */
  44. struct pats language_ptab[] = {
  45.  
  46. #ifdef vax
  47.     { 0, "_spl0\n",
  48. "    mfpr    $18,r0\n\
  49.     mtpr    $0,$18\n" },
  50.  
  51.     { 0, "_spl1\n",
  52. "    mfpr    $18,r0\n\
  53.     mtpr    $1,$18\n" },
  54.  
  55.     { 0, "_splsoftclock\n",
  56. "    mfpr    $18,r0\n\
  57.     mtpr    $0x8,$18\n" },
  58.  
  59.     { 0, "_splnet\n",
  60. "    mfpr    $18,r0\n\
  61.     mtpr    $0xc,$18\n" },
  62.  
  63.     { 0, "_splimp\n",
  64. "    mfpr    $18,r0\n\
  65.     mtpr    $0x16,$18\n" },
  66.  
  67.     { 0, "_spl4\n",
  68. "    mfpr    $18,r0\n\
  69.     mtpr    $0x14,$18\n" },
  70.  
  71.     { 0, "_splbio\n",
  72. "    mfpr    $18,r0\n\
  73.     mtpr    $0x15,$18\n" },
  74.  
  75.     { 0, "_spltty\n",
  76. "    mfpr    $18,r0\n\
  77.     mtpr    $0x15,$18\n" },
  78.  
  79.     { 0, "_spl5\n",
  80. "    mfpr    $18,r0\n\
  81.     mtpr    $0x15,$18\n" },
  82.  
  83.     { 0, "_spl6\n",
  84. "    mfpr    $18,r0\n\
  85.     mtpr    $0x16,$18\n" },
  86.  
  87.     { 0, "_spl7\n",
  88. "    mfpr    $18,r0\n\
  89.     mtpr    $0x17,$18\n" },
  90.  
  91.     { 0, "_splclock\n",
  92. "    mfpr    $18,r0\n\
  93.     mtpr    $0x18,$18\n" },
  94.  
  95.     { 0, "_splhigh\n",
  96. "    mfpr    $18,r0\n\
  97.     mtpr    $0x1f,$18\n" },
  98.  
  99.     { 1, "_splx\n",
  100. "    movl    (sp)+,r0\n\
  101.     mtpr    r0,$18\n" },
  102.  
  103.     { 1, "_mfpr\n",
  104. "    movl    (sp)+,r5\n\
  105.     mfpr    r5,r0\n" },
  106.  
  107.     { 2, "_mtpr\n",
  108. "    movl    (sp)+,r4\n\
  109.     movl    (sp)+,r5\n\
  110.     mtpr    r5,r4\n" },
  111.  
  112.     { 0, "_setsoftclock\n",
  113. "    mtpr    $0x8,$0x14\n" },
  114.  
  115.     { 1, "_resume\n",
  116. "    movl    (sp)+,r5\n\
  117.     ashl    $9,r5,r0\n\
  118.     movpsl    -(sp)\n\
  119.     jsb    _Resume\n" },
  120.  
  121.     { 3, "_copyin\n",
  122. "    movl    (sp)+,r1\n\
  123.     movl    (sp)+,r3\n\
  124.     movl    (sp)+,r5\n\
  125.     jsb    _Copyin\n" },
  126.  
  127.     { 3, "_copyout\n",
  128. "    movl    (sp)+,r1\n\
  129.     movl    (sp)+,r3\n\
  130.     movl    (sp)+,r5\n\
  131.     jsb    _Copyout\n" },
  132.  
  133.     { 1, "_fubyte\n",
  134. "    movl    (sp)+,r0\n\
  135.     jsb    _Fubyte\n" },
  136.  
  137.     { 1, "_fuibyte\n",
  138. "    movl    (sp)+,r0\n\
  139.     jsb    _Fubyte\n" },
  140.  
  141.     { 1, "_fuword\n",
  142. "    movl    (sp)+,r0\n\
  143.     jsb    _Fuword\n" },
  144.  
  145.     { 1, "_fuiword\n",
  146. "    movl    (sp)+,r0\n\
  147.     jsb    _Fuword\n" },
  148.  
  149.     { 2, "_subyte\n",
  150. "    movl    (sp)+,r0\n\
  151.     movl    (sp)+,r1\n\
  152.     jsb    _Subyte\n" },
  153.  
  154.     { 2, "_suibyte\n",
  155. "    movl    (sp)+,r0\n\
  156.     movl    (sp)+,r1\n\
  157.     jsb    _Subyte\n" },
  158.  
  159.     { 2, "_suword\n",
  160. "    movl    (sp)+,r0\n\
  161.     movl    (sp)+,r1\n\
  162.     jsb    _Suword\n" },
  163.  
  164.     { 2, "_suiword\n",
  165. "    movl    (sp)+,r0\n\
  166.     movl    (sp)+,r1\n\
  167.     jsb    _Suword\n" },
  168.  
  169.     { 1, "_setrq\n",
  170. "    movl    (sp)+,r0\n\
  171.     jsb    _Setrq\n" },
  172.  
  173.     { 1, "_remrq\n",
  174. "    movl    (sp)+,r0\n\
  175.     jsb    _Remrq\n" },
  176.  
  177.     { 0, "_swtch\n",
  178. "    movpsl    -(sp)\n\
  179.     jsb    _Swtch\n" },
  180.  
  181.     { 1, "_ffs\n",
  182. "    movl    (sp)+,r1\n\
  183.     ffs    $0,$32,r1,r0\n\
  184.     bneq    1f\n\
  185.     mnegl    $1,r0\n\
  186. 1:\n\
  187.     incl    r0\n" },
  188.  
  189.     { 1, "_htons\n",
  190. "    movl    (sp)+,r5\n\
  191.     rotl    $8,r5,r0\n\
  192.     rotl    $-8,r5,r1\n\
  193.     movb    r1,r0\n\
  194.     movzwl    r0,r0\n" },
  195.  
  196.     { 1, "_ntohs\n",
  197. "    movl    (sp)+,r5\n\
  198.     rotl    $8,r5,r0\n\
  199.     rotl    $-8,r5,r1\n\
  200.     movb    r1,r0\n\
  201.     movzwl    r0,r0\n" },
  202.  
  203.     { 1, "_htonl\n",
  204. "    movl    (sp)+,r5\n\
  205.     rotl    $-8,r5,r0\n\
  206.     insv    r0,$16,$8,r0\n\
  207.     rotl    $8,r5,r1\n\
  208.     movb    r1,r0\n" },
  209.  
  210.     { 1, "_ntohl\n",
  211. "    movl    (sp)+,r5\n\
  212.     rotl    $-8,r5,r0\n\
  213.     insv    r0,$16,$8,r0\n\
  214.     rotl    $8,r5,r1\n\
  215.     movb    r1,r0\n" },
  216.  
  217.     { 2, "__insque\n",
  218. "    movl    (sp)+,r4\n\
  219.     movl    (sp)+,r5\n\
  220.     insque    (r4),(r5)\n" },
  221.  
  222.     { 1, "__remque\n",
  223. "    movl    (sp)+,r5\n\
  224.     remque    (r5),r0\n" },
  225.  
  226.     { 2, "__queue\n",
  227. "    movl    (sp)+,r0\n\
  228.     movl    (sp)+,r1\n\
  229.     insque    (r1),*4(r0)\n" },
  230.  
  231.     { 1, "__dequeue\n",
  232. "    movl    (sp)+,r0\n\
  233.     remque    *(r0),r0\n" },
  234.  
  235.     { 2, "_imin\n",
  236. "    movl    (sp)+,r0\n\
  237.     movl    (sp)+,r5\n\
  238.     cmpl    r0,r5\n\
  239.     bleq    1f\n\
  240.     movl    r5,r0\n\
  241. 1:\n" },
  242.  
  243.     { 2, "_imax\n",
  244. "    movl    (sp)+,r0\n\
  245.     movl    (sp)+,r5\n\
  246.     cmpl    r0,r5\n\
  247.     bgeq    1f\n\
  248.     movl    r5,r0\n\
  249. 1:\n" },
  250.  
  251.     { 2, "_min\n",
  252. "    movl    (sp)+,r0\n\
  253.     movl    (sp)+,r5\n\
  254.     cmpl    r0,r5\n\
  255.     blequ    1f\n\
  256.     movl    r5,r0\n\
  257. 1:\n" },
  258.  
  259.     { 2, "_max\n",
  260. "    movl    (sp)+,r0\n\
  261.     movl    (sp)+,r5\n\
  262.     cmpl    r0,r5\n\
  263.     bgequ    1f\n\
  264.     movl    r5,r0\n\
  265. 1:\n" },
  266. #endif vax
  267.  
  268. #ifdef mc68000
  269. /* someday... */
  270. #endif mc68000
  271.  
  272.     { 0, "", "" }
  273. };
  274.