cpcmd.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:1k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  *  arch/s390/kernel/cpcmd.c
  3.  *
  4.  *  S390 version
  5.  *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
  6.  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
  7.  */
  8. #include <linux/stddef.h>
  9. #include <linux/kernel.h>
  10. #include <linux/string.h>
  11. #include <asm/ebcdic.h>
  12. #include <asm/cpcmd.h>
  13. void cpcmd(char *cmd, char *response, int rlen)
  14. {
  15.         const int mask = 0x40000000L;
  16.         char obuffer[128];
  17.         int olen;
  18.         olen = strlen(cmd);
  19.         strcpy(obuffer, cmd);
  20.         ASCEBC(obuffer,olen);
  21.         if (response != NULL && rlen > 0) {
  22.                 asm volatile ("LRA   2,0(%0)nt"
  23.                               "LR    4,%1nt"
  24.                               "O     4,%4nt"
  25.                               "LRA   3,0(%2)nt"
  26.                               "LR    5,%3nt"
  27.                               ".long 0x83240008 # Diagnose 83nt"
  28.                               : /* no output */
  29.                               : "a" (obuffer), "d" (olen),
  30.                                 "a" (response), "d" (rlen), "m" (mask)
  31.                               : "2", "3", "4", "5" );
  32.                 EBCASC(response, rlen);
  33.         } else {
  34.                 asm volatile ("LRA   2,0(%0)nt"
  35.                               "LR    3,%1nt"
  36.                               ".long 0x83230008 # Diagnose 83nt"
  37.                               : /* no output */
  38.                               : "a" (obuffer), "d" (olen)
  39.                               : "2", "3"  );
  40.         }
  41. }