2016-10-11 1132 views
1

我曾经遇到过在0X55AA 2种情况:关于0x55AA有什么特别之处?

  • 最后2个字节的引导扇区中的遗留引导过程包含0x55AA
  • 第2个字节Option ROM必须是0x55AA

那么,有什么特别之处0x55AA

0x55AA的二进制版本是0101010110101010。是因为它是均匀交错的0和1吗?但我不认为这是一个强有力的标准。

+1

可能的重复[为什么55 AA用作IBM PC上的引导签名?](http://stackoverflow.com/questions/11075003/why-55-aa-is-used-as-the-boot- sign-on-ibm-pcs) – Downvoter

+0

实际上它是0xAA55作为16位字,它在一个小端系统上被存储为字节0x55 0xAA。 –

+0

它也被用作在CPAN上找到的很多perl模块的返回值,它们是返回一个真实值所需的。请参阅http://returnvalues.userperl.at/values.html – Aaron

回答

0

对于这种组合,没有什么神奇或神秘的东西。实施者需要一种方法来确定设备的第一个扇区是否可引导(引导签名),并且发生在扇区的最后两个字节中的组合是如此不可能,这就是为什么它被选中。

同样,可以找到SMBIOS入口点扫描BIOS的_SM_签名,必须在这样的片段边界上;

Find_SMBIOS: 
    push ds 
    push bx      ; Preserve essential 
    push si 

; Establish DS:BX to point to base of BIOS code 

    mov  ax, 0xf000 
    mov  ds, ax     ; Segment where table lives 
    xor  bx, bx     ; Initial pointer 
    mov  eax, '_SM_'    ; Scan buffer for this signature 

; Loop has maximum of 4096 interations. As table is probably at top of buffer, cycling 
; though it backwards saves time. In my test bed, BOCH's 2.6.5 BIOS-bochs-latest it was 
; 1,451 interations. 

.L0: sub  bx, 16     ; Bump pointer to previous segment 
    jnz  .J0 

; Return NULL in AX and set CF. Either AX or flag can be tested on return. 

    mov  ax, bx 
    stc 
    jmp  .Done 

; Did we find signature at this page 

.J0: cmp  [bx], eax 
    jnz  .L0      ; NZ, keep looking 

; Calculate checksum to verify position 

    mov  cx, 15 
    mov  ax, cx 
    mov  si, bx     ; DS:SI = Table entry point 

; Compute checksum on next 15 bytes 

.L1: lodsb 
    add  ah, al 
    loop .L1 

    or  ah, ah 
    jnz  .L0      ; Invalid, try to find another occurence 

; As entry point is page aligned, we can do this to determine segment. 

    shr  bx, 4 
    mov  ax, ds 
    add  ax, bx 
    clc        ; NC, found signature 

.Done: 
    pop  si 
    pop  bx      ; Restore essential 
    pop  ds 

    ret  

该签名很容易在十六进制转储中识别,它适合一个16位寄存器。在这两个标准促成因素的情况下,我不知道,但是再一次,在甚至16字节的边界上出现0x5f4d535f的概率是不太可能的。

相关问题