x86_64-support.pl 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #! /usr/bin/env perl
  2. # Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. package x86_64support;
  9. # require "x86_64-support.pl";
  10. # $ptr_size=&pointer_size($flavour);
  11. # $ptr_reg=&pointer_register($flavour,$reg);
  12. sub ::pointer_size
  13. {
  14. my($flavour)=@_;
  15. my $ptr_size=8; $ptr_size=4 if ($flavour eq "elf32");
  16. return $ptr_size;
  17. }
  18. sub ::pointer_register
  19. {
  20. my($flavour,$reg)=@_;
  21. if ($flavour eq "elf32") {
  22. if ($reg eq "%rax") {
  23. return "%eax";
  24. } elsif ($reg eq "%rbx") {
  25. return "%ebx";
  26. } elsif ($reg eq "%rcx") {
  27. return "%ecx";
  28. } elsif ($reg eq "%rdx") {
  29. return "%edx";
  30. } elsif ($reg eq "%rdi") {
  31. return "%edi";
  32. } elsif ($reg eq "%rsi") {
  33. return "%esi";
  34. } elsif ($reg eq "%rbp") {
  35. return "%ebp";
  36. } elsif ($reg eq "%rsp") {
  37. return "%esp";
  38. } else {
  39. return $reg."d";
  40. }
  41. } else {
  42. return $reg;
  43. }
  44. }
  45. 1;