[5650] Use an option rom instead of boot sector for -kernel
Revision: 5650
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5650 Author: aliguori Date: 2008-11-08 16:27:07 +0000 (Sat, 08 Nov 2008)
Log Message:
-----------
Use an option rom instead of boot sector for -kernel
Generate an option rom instead of using a hijacked boot sector for kernel booting. This just requires adding a small option ROM header and a few more instructions to the boot sector to take over the int19 vector and run our boot code.
A disk is no longer needed when using -kernel on x86.
Modified Paths:
--------------
trunk/block.c
trunk/block.h
trunk/block_int.h
trunk/hw/pc.c
Modified: trunk/block.c
===================================================================
block.c +0 -32
@@ -527,14 +527,6 @@if (!drv)return -ENOMEDIUM ; -if (sector_num ==0 && bs->boot_sector_enabled && nb_sectors >0 ) { -memcpy (buf, bs->boot_sector_data,512 ); - sector_num++; - nb_sectors--; - buf +=512 ; -if (nb_sectors ==0 ) -return 0 ; - }if (drv->bdrv_pread) {int ret, len; len = nb_sectors *512 ;
@@ -567,9 +559,6 @@return -ENOMEDIUM ;if (bs->read_only)return -EACCES ; -if (sector_num ==0 && bs->boot_sector_enabled && nb_sectors >0 ) { -memcpy (bs->boot_sector_data, buf,512 ); - }if (drv->bdrv_pwrite) {int ret, len; len = nb_sectors *512 ;
@@ -750,16 +739,6 @@ *nb_sectors_ptr = length; } -/* force a given boot sector. */ -void bdrv_set_boot_sector (BlockDriverState *bs,const uint8_t *data,int size) -{ - bs->boot_sector_enabled =1 ; -if (size >512 ) - size =512 ; -memcpy (bs->boot_sector_data, data, size); -memset (bs->boot_sector_data + size,0 ,512 - size); -} -void bdrv_set_geometry_hint (BlockDriverState *bs,int cyls,int heads,int secs) {
@@ -1155,14 +1134,6 @@if (!drv)return NULL ; -/* XXX: we assume that nb_sectors == 0 is suppored by the async read */ -if (sector_num ==0 && bs->boot_sector_enabled && nb_sectors >0 ) { -memcpy (buf, bs->boot_sector_data,512 ); - sector_num++; - nb_sectors--; - buf +=512 ; - } - ret = drv->bdrv_aio_read (bs, sector_num, buf, nb_sectors, cb, opaque);if (ret) {
@@ -1185,9 +1156,6 @@return NULL ;if (bs->read_only)return NULL ; -if (sector_num ==0 && bs->boot_sector_enabled && nb_sectors >0 ) { -memcpy (bs->boot_sector_data, buf,512 ); - } ret = drv->bdrv_aio_write (bs, sector_num, buf, nb_sectors, cb, opaque);
Modified: trunk/block.h
===================================================================
block.h +0 -1
@@ -79,7 +79,6 @@int64_t bdrv_getlength (BlockDriverState *bs);void bdrv_get_geometry (BlockDriverState *bs,uint64_t *nb_sectors_ptr);int bdrv_commit (BlockDriverState *bs); -void bdrv_set_boot_sector (BlockDriverState *bs,const uint8_t *data,int size);/* async block I/O */ typedef struct BlockDriverAIOCB BlockDriverAIOCB ;typedef void BlockDriverCompletionFunc (void *opaque,int ret);
Modified: trunk/block_int.h
===================================================================
block_int.h +0 -3
@@ -104,9 +104,6 @@BlockDriver *drv;/* NULL means no media */ void *opaque; -int boot_sector_enabled; -uint8_t boot_sector_data[512 ]; -char filename[1024 ];char backing_file[1024 ];/* if non zero, the image is a diff of this file image */
Modified: trunk/hw/pc.c
===================================================================
hw/pc.c +50 -22
116 lines not on this page · raw message