summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2008-03-04 11:44:33 -0600
committerAvi Kivity <avi@qumranet.com>2008-03-05 09:05:16 +0200
commit5862e735d66cf42358811da568ede75147320758 (patch)
tree2a8633b439422afe2bcc056018cb5fd134683481 /kvm/extboot
parentkvm: external module: backward compatibility for desc_ptr (diff)
downloadqemu-kvm-5862e735d66cf42358811da568ede75147320758.tar.gz
qemu-kvm-5862e735d66cf42358811da568ede75147320758.tar.bz2
qemu-kvm-5862e735d66cf42358811da568ede75147320758.zip
kvm: extboot: Fix read drive parameters to solve Grub Error 18
In certain circumstances, the calculated CHS can result in a total number of sectors that is less than the actual number of sectors. I'm not entirely sure why this upsets grub, but it seems to be the source of the Grub Error 18 that sometimes occurs when using extboot. The solution is to implement the read drive parameters function and return the actual numbers of sectors. This requires changing the QEMU <=> extboot interface as this was not previously passed to extboot. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'kvm/extboot')
-rw-r--r--kvm/extboot/extboot.S63
1 files changed, 13 insertions, 50 deletions
diff --git a/kvm/extboot/extboot.S b/kvm/extboot/extboot.S
index 584d36d56..9eb933383 100644
--- a/kvm/extboot/extboot.S
+++ b/kvm/extboot/extboot.S
@@ -351,7 +351,7 @@ disk_reset:
sub $1, %ax
mov %ax, 4(%bp)
- alloca $8
+ alloca $16
movw $0, 0(%bx) /* read c,h,s */
push %bx
@@ -426,7 +426,7 @@ read_disk_drive_parameters:
push %bx
/* allocate memory for packet, pointer gets returned in bx */
- alloca $8
+ alloca $16
/* issue command */
movw $0, 0(%bx) /* cmd = 0, read c,h,s */
@@ -481,7 +481,7 @@ alternate_disk_reset:
read_disk_drive_size:
push %bx
- alloca $8
+ alloca $16
movw $0, 0(%bx) /* cmd = 0, read c,h,s */
push %bx
@@ -572,29 +572,20 @@ extended_write_sectors:
extended_read_write_sectors $0x02
get_extended_drive_parameters:
- mov $1, %ah
- stc
- ret
-#if 0
- /* this function is seriously borked */
-1:
push %ax
push %bp
push %cx
push %dx
- allocbpa $8
+ allocbpa $16
movw $0, 0(%bp) /* read c,h,s */
push %bp
call send_command
add $2, %sp
- /* check the size of the passed in data */
- cmpw $26, 0(%si)
- mov 0(%si), %ax
- dump %ax
- jle 0b
+ /* write size */
+ movw $26, 0(%si)
/* set flags to 2 */
movw $2, 2(%si)
@@ -617,46 +608,19 @@ get_extended_drive_parameters:
xor %ax, %ax
mov %ax, 14(%si)
- /* calculate total sectors */
-
- /* cx:dx = cylinders */
- mov 2(%bp), %dx
- xor %cx, %cx
-
- /* *= heads */
- push 4(%bp)
- push $0
- push %dx
- push %cx
- call mul32
- add $8, %sp
-
- /* *= sectors */
- push 6(%bp)
- push $0
- push %dx
- push %cx
- call mul32
- add $8, %sp
-
- /* total number of sectors */
- mov %dx, 16(%si)
- mov %cx, 18(%si)
- xor %ax, %ax
+ /* set total number of sectors */
+ mov 8(%bp), %ax
+ mov %ax, 16(%si)
+ mov 10(%bp), %ax
+ mov %ax, 18(%si)
+ mov 12(%bp), %ax
mov %ax, 20(%si)
+ mov 14(%bp), %ax
mov %ax, 22(%si)
/* number of bytes per sector */
movw $512, 24(%si)
- /* optional segmention:offset to EDD config */
- cmpw $30, 0(%si)
- jl 1f
-
- movw $0xFFFF, 26(%si)
- movw $0xFFFF, 28(%si)
-
-1:
freebpa
pop %dx
@@ -667,7 +631,6 @@ get_extended_drive_parameters:
mov $0, %ah
clc
ret
-#endif
terminate_disk_emulation:
mov $1, %ah