• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 36 رای - 2.56 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: Read the CPU ID bit and output to the display
حالت موضوعی
#1
نقل قول:CPU ID
Read the CPU ID bit and output to the display
در سورس زیر که با اسمبلی نوشته شده id سی پی یو رو بدست میاره و به نمایش میزاره
کد:
; nasm -f elf -o cpu.o cpu.asm
; ld -s -o cpu cpu.o
section .data
var:  DB 0              ; declare var with value 0
msg:  DB "CPU ID: "        ; declare message
len:  equ $-msg         ; the length of msg

section .bss
vendor_id    resd    12    ; reserver length of 12

section .text
global _start

_start:
    mov  eax, 0
    cpuid                ; call cpu
    mov  [vendor_id],ebx
    mov  [vendor_id+4], ebx
    mov  [vendor_id+8],ecx

    mov  edx, len            ; pass message length
    mov  ecx, msg             ; pass message
    mov  ebx, 1            ; write to stdout
    mov  eax, 4            ; call syswrite

    int 0x80            ; call the kernel

    mov edx, 12            ; pass length of 12
    mov ecx, vendor_id        ; pass vendor id
    mov ebx, 1            ; write to stdout
    mov eax, 4            ; call syswrite

    int 0x80            ; call the kernel

    mov eax, 1            ; call sys_exit
    mov ebx, 0            ; return zero
    int  0x80            ; call the kernel
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


پرش به انجمن:


Browsing: 1 مهمان