Changeset 7df54df in mainline for arch/amd64/src/asm_utils.S


Ignore:
Timestamp:
2005-09-02T14:00:48Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
32f6e1bd
Parents:
73838ed
Message:

Fixed stack settings in boot.S in real mode.
Added ia32 memmap support.
Added cpuid support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/asm_utils.S

    r73838ed r7df54df  
    4444        movq $halt, (%rsp)
    4545        jmp printf
     46
     47.global has_cpuid
     48.global rdtsc
     49
     50
     51## Determine CPUID support
     52#
     53# Return 0 in EAX if CPUID is not support, 1 if supported.
     54#
     55has_cpuid:
     56        pushq %rbx
     57       
     58        pushfq                  # store flags
     59        popq %rax               # read flags
     60        movq %rax,%rbx          # copy flags
     61        btcl $21,%ebx           # swap the ID bit
     62        pushq %rbx
     63        popfq                   # propagate the change into flags
     64        pushfq
     65        popq %rbx               # read flags   
     66        andl $(1<<21),%eax      # interested only in ID bit
     67        andl $(1<<21),%ebx
     68        xorl %ebx,%eax          # 0 if not supported, 1 if supported
     69       
     70        popq %rbx
     71        ret
     72
     73
     74rdtsc:
     75        xorq %rax,%rax
     76        rdtsc
     77        ret
     78       
    4679
    4780# Push all general purpose registers on stack except %rbp, %rsp
Note: See TracChangeset for help on using the changeset viewer.