Skip to main content
Fixed incomplete revision of earlier suggested edit, sorry for the push
Source Link
Daniel B
  • 64k
  • 9
  • 128
  • 176

Well, on Wikipedia, there’s an example (x86_64 only) assembly listing for this very purpose (for the X86_64 architecture, however; not for your CPU):

.section .data
 
s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"
 
.section .text
 
.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx
 
    movl    $0x80000000,    %eax
    cpuid
 
    cmpl    $0x80000004,    %eax
    jl  error
 
    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi
 
.align 16
get_brand:
    movl    %esi,   %eax
    cpuid
 
    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)
 
    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand
 
print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf
 
    jmp end
 
.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf
 
.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

This method probably won’t work for you, since it seems Pentium 4/D CPUs don’t have their model name available this way. As you can see here, the CPUID data doesn’t contain what you want.

Well, on Wikipedia, there’s an example (x86_64) assembly listing for this very purpose (for the X86_64 architecture, however; not for your CPU):

.section .data
 
s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"
 
.section .text
 
.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx
 
    movl    $0x80000000,    %eax
    cpuid
 
    cmpl    $0x80000004,    %eax
    jl  error
 
    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi
 
.align 16
get_brand:
    movl    %esi,   %eax
    cpuid
 
    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)
 
    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand
 
print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf
 
    jmp end
 
.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf
 
.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

This method probably won’t work for you, since it seems Pentium 4/D CPUs don’t have their model name available this way. As you can see here, the CPUID data doesn’t contain what you want.

Well, on Wikipedia, there’s an example (x86_64 only) assembly listing for this very purpose:

.section .data
 
s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"
 
.section .text
 
.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx
 
    movl    $0x80000000,    %eax
    cpuid
 
    cmpl    $0x80000004,    %eax
    jl  error
 
    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi
 
.align 16
get_brand:
    movl    %esi,   %eax
    cpuid
 
    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)
 
    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand
 
print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf
 
    jmp end
 
.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf
 
.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

This method probably won’t work for you, since it seems Pentium 4/D CPUs don’t have their model name available this way. As you can see here, the CPUID data doesn’t contain what you want.

added 189 characters in body
Source Link
Daniel B
  • 64k
  • 9
  • 128
  • 176

Well, on Wikipedia, there’s an example (x86_64) assembly listing for this very purpose (for the X86_64 architecture, however; not for your CPU):

.section .data
 
s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"
 
.section .text
 
.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx
 
    movl    $0x80000000,    %eax
    cpuid
 
    cmpl    $0x80000004,    %eax
    jl  error
 
    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi
 
.align 16
get_brand:
    movl    %esi,   %eax
    cpuid
 
    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)
 
    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand
 
print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf
 
    jmp end
 
.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf
 
.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

IfThis method probably won’t work for you, since it seems Pentium 4/D CPUs don’t have their model name available this method does not workway. As you can see here, neither will anything elsethe CPUID data doesn’t contain what you want.

Well, on Wikipedia, there’s an example (x86_64) assembly listing for this very purpose (for the X86_64 architecture, however; not for your CPU):

.section .data
 
s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"
 
.section .text
 
.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx
 
    movl    $0x80000000,    %eax
    cpuid
 
    cmpl    $0x80000004,    %eax
    jl  error
 
    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi
 
.align 16
get_brand:
    movl    %esi,   %eax
    cpuid
 
    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)
 
    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand
 
print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf
 
    jmp end
 
.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf
 
.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

If this method does not work, neither will anything else.

Well, on Wikipedia, there’s an example (x86_64) assembly listing for this very purpose (for the X86_64 architecture, however; not for your CPU):

.section .data
 
s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"
 
.section .text
 
.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx
 
    movl    $0x80000000,    %eax
    cpuid
 
    cmpl    $0x80000004,    %eax
    jl  error
 
    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi
 
.align 16
get_brand:
    movl    %esi,   %eax
    cpuid
 
    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)
 
    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand
 
print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf
 
    jmp end
 
.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf
 
.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

This method probably won’t work for you, since it seems Pentium 4/D CPUs don’t have their model name available this way. As you can see here, the CPUID data doesn’t contain what you want.

Sadly, code is x64 only
Source Link
Daniel B
  • 64k
  • 9
  • 128
  • 176

Well, on Wikipedia, there’s an example (x86_64) assembly listing for this very purpose (for the X86_64 architecture, however; not for your CPU):

.section .data
 
s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"
 
.section .text
 
.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx
 
    movl    $0x80000000,    %eax
    cpuid
 
    cmpl    $0x80000004,    %eax
    jl  error
 
    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi
 
.align 16
get_brand:
    movl    %esi,   %eax
    cpuid
 
    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)
 
    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand
 
print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf
 
    jmp end
 
.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf
 
.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

If this method does not work, neither will anything else.

Well, on Wikipedia, there’s an example assembly listing for this very purpose (for the X86_64 architecture, however; not for your CPU):

.section .data
 
s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"
 
.section .text
 
.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx
 
    movl    $0x80000000,    %eax
    cpuid
 
    cmpl    $0x80000004,    %eax
    jl  error
 
    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi
 
.align 16
get_brand:
    movl    %esi,   %eax
    cpuid
 
    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)
 
    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand
 
print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf
 
    jmp end
 
.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf
 
.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

If this method does not work, neither will anything else.

Well, on Wikipedia, there’s an example (x86_64) assembly listing for this very purpose (for the X86_64 architecture, however; not for your CPU):

.section .data
 
s0 : .asciz "Processor Brand String: %.48s\n"
err : .asciz "Feature unsupported.\n"
 
.section .text
 
.global main
.type main,@function
.align 32
main:
    pushq   %rbp
    movq    %rsp,   %rbp
    subq    $48,    %rsp
    pushq   %rbx
 
    movl    $0x80000000,    %eax
    cpuid
 
    cmpl    $0x80000004,    %eax
    jl  error
 
    movl    $0x80000002,    %esi
    movq    %rsp,   %rdi
 
.align 16
get_brand:
    movl    %esi,   %eax
    cpuid
 
    movl    %eax,   (%rdi)
    movl    %ebx,   4(%rdi)
    movl    %ecx,   8(%rdi)
    movl    %edx,   12(%rdi)
 
    addl    $1, %esi
    addq    $16,    %rdi
    cmpl    $0x80000004,    %esi
    jle get_brand
 
print_brand:
    movq    $s0,    %rdi
    movq    %rsp,   %rsi
    xorb    %al,    %al
    call    printf
 
    jmp end
 
.align 16
error:
    movq    $err,   %rdi
    xorb    %al,    %al
    call    printf
 
.align 16
end:
    popq    %rbx
    movq    %rbp,   %rsp
    popq    %rbp
    xorl    %eax,   %eax
    ret

Dump this code in a file, say cpumodel.S, and compile it with gcc/gas:

gcc cpumodel.S -o cpumodel

Afterwards, you can run it:

$ ./cpumodel
Processor Brand String: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz

If this method does not work, neither will anything else.

Comment suggests this solution only applies to a specific architecture (not the one referred to in the OP)
Source Link
Loading
Source Link
Daniel B
  • 64k
  • 9
  • 128
  • 176
Loading