Changeset d6dcdd2e in mainline for arch/ia32/src
- Timestamp:
- 2005-09-13T21:20:56Z (21 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 01e48c1
- Parents:
- b1cf98c
- Location:
- arch/ia32/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/cpuid.s
rb1cf98c rd6dcdd2e 27 27 # 28 28 29 # The code below just interfaces the CPUID instruction.30 # CPU recognition logic is contained in higher-level functions.31 32 29 .text 33 30 34 31 .global has_cpuid 35 .global cpuid36 .global rdtsc37 32 38 33 39 34 ## Determine CPUID support 40 35 # 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. 42 37 # 43 38 has_cpuid: 44 push %ebx45 46 39 pushf # store flags 47 40 popl %eax # read flags 48 movl %eax,%e bx # copy flags49 btcl $21,%e bx # swap the ID bit50 pushl %e bx41 movl %eax,%edx # copy flags 42 btcl $21,%edx # swap the ID bit 43 pushl %edx 51 44 popf # propagate the change into flags 52 45 pushf 53 popl %e bx # read flags46 popl %edx # read flags 54 47 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 59 50 ret 60 61 62 ## Get CPUID data63 #64 # This code is just an interfaces the CPUID instruction, CPU recognition65 # 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 %ebp75 movl %esp,%ebp76 pusha77 78 movl 8(%ebp),%eax # load the command into %eax79 movl 12(%ebp),%esi # laod the address of the info struct80 81 cpuid82 movl %eax,0(%esi)83 movl %ebx,4(%esi)84 movl %ecx,8(%esi)85 movl %edx,12(%esi)86 87 popa88 popl %ebp89 ret90 91 rdtsc:92 rdtsc93 ret -
arch/ia32/src/delay.s
rb1cf98c rd6dcdd2e 37 37 38 38 asm_delay_loop: 39 pushl %ecx 40 movl 8(%esp),%ecx # move argument to %ecx 39 movl 4(%esp),%ecx # move argument to %ecx 41 40 0: lahf 42 41 dec %ecx 43 42 jnz 0b 44 popl %ecx45 43 ret 46 44 47 45 asm_fake_loop: 48 pushl %ecx 49 movl 8(%esp),%ecx # move argument to %ecx 46 movl 4(%esp),%ecx # move argument to %ecx 50 47 0: lahf 51 48 dec %ecx 52 49 jz 0b 53 popl %ecx54 50 ret
Note:
See TracChangeset
for help on using the changeset viewer.
