GSoC2009 Liu Notes

From Syslinux Wiki

Jump to: navigation, search

Contents

[edit] Notes: Yuanhan Liu, Add EXT4 Support in EXTLINUX and Convert the Filesystem Part Code to C

[edit] Code reading notes

Here takes some notes while reading the Syslinux source code.

[edit] The js instruction problem

After seeing the following code in diskstart.inc make me reminds of the interview of Syslinux GSoC2009 in the IRC.

       mov [DriveNumber],dl	; Save drive number in DL
       and dl,dl		; If floppy disk (00-7F), assume no partition table
       js harddisk

It's quite same as the following code asked by hpa in the interview:

       and eax, eax
       js .foo
       call edx
  .foo:

yeah, it's a simple question, but at that moment I'm not good at the flags so a wrong answer answered. In fact, the fisrt code explains it well. As we know, the hard disk drive number counts from 0x80 that means the most significant bit is always 1 make the js be true to jump the destination. while in C, we can simply implement it in the following way:

       if ( drive_num >= 0x80 ) {
               /* harddisk */
       } else {
               /* floppy */
       }

[edit] The chosen of CBIOS or EBIOS by getlinsec

hpa made a trick here. It's not done in function getlinsec but in the EDD check program in a patch way; that's the trick. In the diskstart.inc, there's a EDD check program. If EDD checked, then:

       ;
       ; We have EDD support...
       ;
       mov byte [getlinsec.jmp+1],(getlinsec_ebios-(getlinsec.jmp+2))

getlinsec function will jump to getlinsec_cbios by default; after this, it will jump to getlinsec_ebios instead.

   getlinsec:
           add eax,[bsHidden]		; Add partition offset
           xor edx,edx			; Zero-extend LBA (eventually allow 64 bits)
   .jmp:		jmp strict short getlinsec_cbios

[edit] See also

Personal tools