Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
2.7 KiB

  1. #!/usr/local/bin/perl -w
  2. ##
  3. ## Copyright (c) 2000, Intel Corporation
  4. ## All rights reserved.
  5. ##
  6. ## WARRANTY DISCLAIMER
  7. ##
  8. ## THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  9. ## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  10. ## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  11. ## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
  12. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  13. ## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  14. ## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  15. ## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  16. ## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
  17. ## NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE
  18. ## MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  19. ##
  20. ## Intel Corporation is the author of the Materials, and requests that all
  21. ## problem reports or change requests be submitted to it directly at
  22. ## http://developer.intel.com/opensource.
  23. ##
  24. $GenDir = shift(@ARGV);
  25. $EmdbDir = shift(@ARGV);
  26. ################################################
  27. # CONSTANTS AND VARIABLES
  28. ################################################
  29. $EM_ISA_INST = 0x1;
  30. $EM_MERCED_INST = 0x2;
  31. $EM_EMDB_INST = $EM_ISA_INST | $EM_MERCED_INST;
  32. ################################################
  33. open(EMDB, "$EmdbDir/emdb.txt") || die "Can't open emdb.txt\n";
  34. open(EMDB_MERCED, "$EmdbDir/emdb_merced.txt") || die "Can't open emdb_merced.txt\n";
  35. open(DEC_COLUMN, ">$GenDir/emdb_cpu_flag.txt") || die "Can't open emdb_cpu_flag.txt\n";
  36. ### Column names
  37. @col_names = ("inst_id", "cpu_flag");
  38. ### Type names
  39. @type_names = ("Inst_id_t", "int");
  40. ### Prefix names
  41. @prefix_names = ("---", "---");
  42. format DEC_COLUMN =
  43. @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<
  44. $id, $cpu_flag
  45. .
  46. select(DEC_COLUMN);
  47. ### Print column names
  48. ($id, $cpu_flag) = @col_names;
  49. $id = "&" . $id;
  50. write;
  51. ### Print type names
  52. ($id, $cpu_flag) = @type_names;
  53. $id = "?" . $id;
  54. write;
  55. ### Print prefix names
  56. ($id, $cpu_flag) = @prefix_names;
  57. $id = "@" . $id;
  58. write;
  59. ### emdb.txt instructions
  60. while (<EMDB>)
  61. {
  62. if (/^EM/)
  63. {
  64. ($id) = split(/\s+/, $_);
  65. $Cpu_Flag{$id} = $EM_EMDB_INST;
  66. }
  67. }
  68. ### emdb_merced.txt instructions
  69. while (<EMDB_MERCED>)
  70. {
  71. if (/^EM/)
  72. {
  73. ($id) = split(/\s+/, $_);
  74. $Cpu_Flag{$id} = $EM_MERCED_INST;
  75. }
  76. }
  77. foreach $id (keys(%Cpu_Flag))
  78. {
  79. $cpu_flag = "0x".hex($Cpu_Flag{$id});
  80. write;
  81. }
  82. close(EMDB);
  83. close(EMDB_MERCED);
  84. close(DEC_COLUMN);