Changeset d6dcdd2e in mainline for arch/ia32/src


Ignore:
Timestamp:
2005-09-13T21:20:56Z (21 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
01e48c1
Parents:
b1cf98c
Message:

Optimize some assembler functions.

Location:
arch/ia32/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/src/cpuid.s

    rb1cf98c rd6dcdd2e  
    2727#
    2828
    29 # The code below just interfaces the CPUID instruction.
    30 # CPU recognition logic is contained in higher-level functions.
    31 
    3229.text
    3330
    3431.global has_cpuid
    35 .global cpuid
    36 .global rdtsc
    3732
    3833
    3934## Determine CPUID support
    4035#
    41 # Return 0 in EAX if CPUID is not support, 1 if supported.
     36# Return 0 in EAX if CPUID is not supported, 1 if supported.
    4237#
    4338has_cpuid:
    44         push %ebx
    45        
    4639        pushf                   # store flags
    4740        popl %eax               # read flags
    48         movl %eax,%ebx          # copy flags
    49         btcl $21,%ebx           # swap the ID bit
    50         pushl %ebx
     41        movl %eax,%edx          # copy flags
     42        btcl $21,%edx           # swap the ID bit
     43        pushl %edx
    5144        popf                    # propagate the change into flags
    5245        pushf
    53         popl %ebx               # read flags   
     46        popl %edx               # read flags   
    5447        andl $(1<<21),%eax      # interested only in ID bit
    55         andl $(1<<21),%ebx
    56         xorl %ebx,%eax          # 0 if not supported, 1 if supported
    57        
    58         pop %ebx
     48        andl $(1<<21),%edx
     49        xorl %edx,%eax          # 0 if not supported, 1 if supported
    5950        ret
    60 
    61 
    62 ## Get CPUID data
    63 #
    64 # This code is just an interfaces the CPUID instruction, CPU recognition
    65 # logic is contained in higher-level functions.
    66 #
    67 # The C prototype is:
    68 #   void cpuid(__u32 cmd, struct cpu_info *info)
    69 #
    70 # @param cmd  CPUID command.
    71 # @param info Buffer to store CPUID output.
    72 #
    73 cpuid:
    74         pushl %ebp
    75         movl %esp,%ebp
    76         pusha
    77 
    78         movl 8(%ebp),%eax       # load the command into %eax
    79         movl 12(%ebp),%esi      # laod the address of the info struct
    80 
    81         cpuid   
    82         movl %eax,0(%esi)
    83         movl %ebx,4(%esi)
    84         movl %ecx,8(%esi)
    85         movl %edx,12(%esi)
    86 
    87         popa
    88         popl %ebp
    89         ret
    90 
    91 rdtsc:
    92         rdtsc
    93         ret
  • arch/ia32/src/delay.s

    rb1cf98c rd6dcdd2e  
    3737
    3838asm_delay_loop:
    39         pushl %ecx
    40         movl 8(%esp),%ecx       # move argument to %ecx
     39        movl 4(%esp),%ecx       # move argument to %ecx
    41400:      lahf
    4241        dec %ecx
    4342        jnz 0b
    44         popl %ecx
    4543        ret
    4644
    4745asm_fake_loop:
    48         pushl %ecx
    49         movl 8(%esp),%ecx       # move argument to %ecx
     46        movl 4(%esp),%ecx       # move argument to %ecx
    50470:      lahf
    5148        dec %ecx
    5249        jz 0b
    53         popl %ecx
    5450        ret
Note: See TracChangeset for help on using the changeset viewer.