gettimeofday-x86_64.S 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (C) 2014 OSCAR lab, Stony Brook University
  2. This file is part of Graphene Library OS.
  3. Graphene Library OS is free software: you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. Graphene Library OS is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. /*
  14. * gettimeofday-x86_64.S
  15. *
  16. * This file contains architecture-specific implementation of timing
  17. * method.
  18. * The source code is imported and modified from the GNU C Library.
  19. */
  20. #include <asm/unistd.h>
  21. #include <sysdep.h>
  22. #include "sysdep-x86_64.h"
  23. /* For the calculation see asm/vsyscall.h. */
  24. #define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
  25. .text
  26. ENTRY (gettimeofday)
  27. /* Align stack. */
  28. sub $0x8, %rsp
  29. cfi_adjust_cfa_offset(8)
  30. movq $VSYSCALL_ADDR_vgettimeofday, %rax
  31. callq *%rax
  32. /* Check error return. */
  33. /* cmpl $-4095, %eax */
  34. /* jae SYSCALL_ERROR_LABEL */
  35. L(pseudo_end):
  36. add $0x8, %rsp
  37. cfi_adjust_cfa_offset(-8)
  38. ret
  39. PSEUDO_END(gettimeofday)