Changeset 5916


Ignore:
Timestamp:
Feb 13, 2007, 5:12:05 PM (18 years ago)
Author:
Gary Byers
Message:

Add rdtsc (returns 60 bit non-negative fixnum) and rdtsc64 (returns
64-bit non-negative integer.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-0/X86/x86-misc.lisp

    r5882 r5916  
    200200  (jmp-subprim .SPvalues))
    201201
     202(defx86lapfunction rdtsc ()
     203  (:byte #x0f)                          ;two-byte rdtsc opcode
     204  (:byte #x31)                          ;is #x0f #x31
     205  (shlq ($ 32) (% rdx))
     206  (orq (% rdx) (% rax))
     207  (imul ($ (* 2 target::node-size)) (% rax) (% arg_z))
     208  (shrq ($ 1) (% arg_z))
     209  (single-value-return))
     210
     211;;; Return all 64 bits of the time-stamp counter as an unsigned integer.
     212(defx86lapfunction rdtsc64 ()
     213  (:byte #x0f)                          ;two-byte rdtsc opcode
     214  (:byte #x31)                          ;is #x0f #x31
     215  (shlq ($ 32) (% rdx))
     216  (orq (% rdx) (% rax))
     217  (jmp-subprim .SPmakeu64))
     218
    202219;;; It would be nice if (%setf-macptr macptr (ash (the fixnum value)
    203220;;; ash::fixnumshift)) would do this inline.
Note: See TracChangeset for help on using the changeset viewer.