|
diff文件
Index: asm.S
===================================================================
--- asm.S (revision 115)
+++ asm.S (working copy)
@@ -10135,7 +10135,61 @@
movl %edi, %ebx
9:
- /* Read the MBR, or the boot sector of the extended partition. */
+ movl -16(%ebx), %eax
+ addl -4(%ebx), %eax
+ call 101f
+ testl %eax, %eax
+ jz 9f # return with failure
+
+ /* Check if it is valid. */
+ movl $(PART_TABLE_TMPBUF+446), %esi
+ cmpw $0xAA55, 64(%esi)
+ jne 9f
+
+ cmpl $0xff, ABS(EXT_C(current_slice))
+ je 100f
+ movl $0xFF, ABS(EXT_C(current_slice))
+ cmpb $0xee, 4(%esi)
+ jne 100f
+ movl $1,%eax
+ call 101f
+ testl %eax, %eax
+ jz 9f
+ movl $PART_TABLE_TMPBUF,%esi
+ cmpl $0x20494645,(%esi)
+ jne 9f
+ movl 72(%esi),%eax
+ movl %eax,PART_TABLE_BUF + 0xC
+110:
+ movl PART_TABLE_BUF + 0xC,%eax
+ incl PART_TABLE_BUF + 0xC
+ call 101f
+ testl %eax, %eax
+ jz 9f
+ movl $PART_TABLE_TMPBUF,%esi
+ movl $4,%ecx
+111:
+ movl 32(%esi),%eax
+ testl %eax,%eax
+ jz 9f
+ stosl
+ subl %eax,40(%esi)
+ movl 40(%esi),%eax
+ stosl
+ xorb %al,%al
+ stosb
+ movb $0xee,%al
+ stosb
+ incb -4(%ebp)
+ movl -4(%ebp), %eax
+ stosw
+ xorl %eax,%eax
+ stosl
+ addl $0x80,%esi
+ loop 111b
+ jmp 110b
+
+101:
pushl $0xedde0d90 # read
pushl $0 # buf_hi
pushl $(PART_TABLE_TMPBUF)
@@ -10143,20 +10197,12 @@
pushl $(SECTOR_SIZE)
pushl $0 # byte_offset
pushl $0 # sector_hi
- /* calculate the start sector number for read */
- movl -16(%ebx), %eax
- addl -4(%ebx), %eax
pushl %eax # sector
pushl ABS(EXT_C(current_drive))
call EXT_C(rawread)
addl $36, %esp
- testl %eax, %eax
- jz 9f # return with failure
-
- /* Check if it is valid. */
- movl $(PART_TABLE_TMPBUF+446), %esi
- cmpw $0xAA55, 64(%esi)
- jne 9f
+ ret
+100:
pushl %esi
call 98f
popl %esi
首先尝试WEE,是因为我对比了一下,感觉WEE修改会简单一些,另外,GPT硬盘总是以LBA方式访问的,刚好WEE也符合这一条件.
还有GRLDR如果修改的话,不知道前16扇区还有没有空间加GPT分区代码.
|
|