nasm20241125002cpuid.asm


;; (C) David Vajda
;; x86/i386/i586/amd64 CPUID
;; 2024-11-25

global  _start
section .data
    IntelStr:   db  "0000 000 000", 10, 13
section .text
_start:
    mov eax, 0x00
    cpuid
    mov esi, IntelStr
    mov [esi], ebx
    add esi, 4
    mov [esi], edx
    add esi, 4
    mov [esi], ecx

    mov ecx, IntelStr
    mov edx, 14
    mov eax, 4
    mov ebx, 1
    int 0x80

    mov eax, 1
    mov ebx, 0
    int 0x80

Ausgabe


david@work:~$ nasm -f elf32 nasm20241125002cpuid.asm
david@work:~$  ld -m elf_i386 nasm20241125002cpuid.o -o nasm20241125002cpuid
david@work:~$ ./nasm20241125002cpuid
GenuineIntel
david@work:~$