GRUB src code: forced reference?
Posted: Sat Jun 23, 2012 11:03 pm
I was looking at grub2 stage1 source code and saw this:
"boot_drive" is defined in the same file as follows:
First of all what is a "forced disk reference"?
The code above doesn't make sense to me. It loads %al with 0xff, then compares the same %al with 0xff, then jumps to 1. In what case movb %al, %dl is executed?
By the way, is 0xff a drive code used in INT 13H? Is there a list of those codes somewhere?
Here is the complete source code, just in case: http://paste.ideaslabs.com/show/VekL2gH914
Code: Select all
/*
* Check if we have a forced disk reference here
*/
movb boot_drive, %al
cmpb $0xff, %al
je 1f
movb %al, %dl
1:
Code: Select all
boot_drive:
.byte 0xff /* the disk to load kernel from */
/* 0xff means use the boot drive */
The code above doesn't make sense to me. It loads %al with 0xff, then compares the same %al with 0xff, then jumps to 1. In what case movb %al, %dl is executed?
By the way, is 0xff a drive code used in INT 13H? Is there a list of those codes somewhere?
Here is the complete source code, just in case: http://paste.ideaslabs.com/show/VekL2gH914