gettimeofday-x86_64.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Copyright (C) 2014 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 Lesser 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 Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser 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-x86_64.h"
  22. /* For the calculation see asm/vsyscall.h. */
  23. #define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000
  24. .text
  25. ENTRY (gettimeofday)
  26. /* Align stack. */
  27. sub $0x8, %rsp
  28. cfi_adjust_cfa_offset(8)
  29. movq $VSYSCALL_ADDR_vgettimeofday, %rax
  30. callq *%rax
  31. /* Check error return. */
  32. /* cmpl $-4095, %eax */
  33. /* jae SYSCALL_ERROR_LABEL */
  34. pseudo_end:
  35. add $0x8, %rsp
  36. cfi_adjust_cfa_offset(-8)
  37. ret
  38. END(gettimeofday)