Skip to content

Commit

Permalink
Upstream 8ad1251
Browse files Browse the repository at this point in the history
Change in bios behavior, documentation not yet updated
  • Loading branch information
gdwnldsKSC committed Feb 29, 2024
1 parent 64d5426 commit 172ab04
Show file tree
Hide file tree
Showing 141 changed files with 3,327 additions and 1,751 deletions.
Binary file modified Binary Artifacts/Support Files/bios.bin
Binary file not shown.
Binary file modified TESTFILES/WinQemu.dll
Binary file not shown.
Binary file modified TESTFILES/WinQemu.pdb
Binary file not shown.
Binary file modified TESTFILES/bios.bin
Binary file not shown.
3 changes: 3 additions & 0 deletions WinQemu.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="qemu\hw\msix.c" />
<ClCompile Include="qemu\hw\qdev-addr.c" />
<ClCompile Include="qemu\hw\qdev-properties.c" />
<ClCompile Include="qemu\hw\qdev.c" />
<ClCompile Include="qemu\hw\smbios.c" />
<ClCompile Include="qemu\hw\ssi.c" />
Expand Down Expand Up @@ -1107,6 +1109,7 @@
<ClInclude Include="qemu\cpu-common.h" />
<ClInclude Include="qemu\hw\msix.h" />
<ClInclude Include="qemu\hw\poison.h" />
<ClInclude Include="qemu\hw\qdev-addr.h" />
<ClInclude Include="qemu\hw\qdev.h" />
<ClInclude Include="qemu\hw\smbios.h" />
<ClInclude Include="qemu\hw\ssi.h" />
Expand Down
15 changes: 12 additions & 3 deletions WinQemu.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,6 @@
<ClCompile Include="qemu\block\vvfat.c">
<Filter>qemu\block\src</Filter>
</ClCompile>
<ClCompile Include="qemu\hw\qdev.c">
<Filter>qemu\src</Filter>
</ClCompile>
<ClCompile Include="qemu\hw\sysbus.c">
<Filter>qemu\src</Filter>
</ClCompile>
Expand Down Expand Up @@ -1191,6 +1188,15 @@
<ClCompile Include="qemu\ioport-user.c">
<Filter>qemu\src</Filter>
</ClCompile>
<ClCompile Include="qemu\hw\qdev-addr.c">
<Filter>qemu\hw\src</Filter>
</ClCompile>
<ClCompile Include="qemu\hw\qdev-properties.c">
<Filter>qemu\hw\src</Filter>
</ClCompile>
<ClCompile Include="qemu\hw\qdev.c">
<Filter>qemu\hw\src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="float80-port.h">
Expand Down Expand Up @@ -1796,6 +1802,9 @@
<ClInclude Include="qemu\ioport.h">
<Filter>qemu\inc</Filter>
</ClInclude>
<ClInclude Include="qemu\hw\qdev-addr.h">
<Filter>qemu\hw\inc</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.md" />
Expand Down
2 changes: 1 addition & 1 deletion qemu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ obj-y += bt-hci-csr.o
obj-y += buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
obj-y += qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
obj-y += msmouse.o ps2.o
obj-y += qdev.o ssi.o
obj-y += qdev.o qdev-properties.o ssi.o

obj-$(CONFIG_BRLAPI) += baum.o

Expand Down
2 changes: 1 addition & 1 deletion qemu/Makefile.hw
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ obj-y += m48t59.o escc.o
# SCSI layer
obj-y += lsi53c895a.o esp.o

obj-y += dma-helpers.o sysbus.o
obj-y += dma-helpers.o sysbus.o qdev-addr.o

all: $(HWLIB)
# Dummy command so that make thinks it has done something
Expand Down
16 changes: 10 additions & 6 deletions qemu/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,24 +1183,26 @@ int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
return drv->bdrv_get_info(bs, bdi);
}

int bdrv_put_buffer(BlockDriverState *bs, const uint8_t *buf, int64_t pos, int size)
int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
int64_t pos, int size)
{
BlockDriver *drv = bs->drv;
if (!drv)
return -ENOMEDIUM;
if (!drv->bdrv_put_buffer)
if (!drv->bdrv_save_vmstate)
return -ENOTSUP;
return drv->bdrv_put_buffer(bs, buf, pos, size);
return drv->bdrv_save_vmstate(bs, buf, pos, size);
}

int bdrv_get_buffer(BlockDriverState *bs, uint8_t *buf, int64_t pos, int size)
int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
int64_t pos, int size)
{
BlockDriver *drv = bs->drv;
if (!drv)
return -ENOMEDIUM;
if (!drv->bdrv_get_buffer)
if (!drv->bdrv_load_vmstate)
return -ENOTSUP;
return drv->bdrv_get_buffer(bs, buf, pos, size);
return drv->bdrv_load_vmstate(bs, buf, pos, size);
}

/**************************************************************/
Expand Down Expand Up @@ -1399,6 +1401,7 @@ static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb)
{
BlockDriverAIOCBSync *acb = (BlockDriverAIOCBSync *)blockacb;
qemu_bh_delete(acb->bh);
acb->bh = NULL;
qemu_aio_release(acb);
}

Expand All @@ -1416,6 +1419,7 @@ static void bdrv_aio_bh_cb(void *opaque)
qemu_vfree(acb->bounce);
acb->common.cb(acb->common.opaque, acb->ret);
qemu_bh_delete(acb->bh);
acb->bh = NULL;
qemu_aio_release(acb);
}

Expand Down
7 changes: 4 additions & 3 deletions qemu/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@ void path_combine(char *dest, int dest_size,
const char *base_path,
const char *filename);

int bdrv_put_buffer(BlockDriverState *bs, const uint8_t *buf,
int64_t pos, int size);
int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
int64_t pos, int size);

int bdrv_get_buffer(BlockDriverState *bs, uint8_t *buf, int64_t pos, int size);
int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
int64_t pos, int size);

#endif
20 changes: 16 additions & 4 deletions qemu/block/qcow.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ static BlockDriverAIOCB *qcow_aio_writev(BlockDriverState *bs,

s->cluster_cache_offset = -1; /* disable compressed cache */

acb = qcow_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 0);
acb = qcow_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 1);
if (!acb)
return NULL;

Expand Down Expand Up @@ -909,9 +909,21 @@ static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)


static QEMUOptionParameter qcow_create_options[] = {
{ BLOCK_OPT_SIZE, OPT_SIZE },
{ BLOCK_OPT_BACKING_FILE, OPT_STRING },
{ BLOCK_OPT_ENCRYPT, OPT_FLAG },
{
.name = BLOCK_OPT_SIZE,
.type = OPT_SIZE,
.help = "Virtual disk size"
},
{
.name = BLOCK_OPT_BACKING_FILE,
.type = OPT_STRING,
.help = "File name of a base image"
},
{
.name = BLOCK_OPT_ENCRYPT,
.type = OPT_FLAG,
.help = "Encrypt the image"
},
{ NULL }
};

Expand Down
2 changes: 1 addition & 1 deletion qemu/block/qcow2-cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, int min_size)
#endif

new_l1_size2 = sizeof(uint64_t) * new_l1_size;
new_l1_table = qemu_mallocz(new_l1_size2);
new_l1_table = qemu_mallocz(align_offset(new_l1_size2, 512));
memcpy(new_l1_table, s->l1_table, s->l1_size * sizeof(uint64_t));

/* write new table (align to cluster) */
Expand Down
2 changes: 1 addition & 1 deletion qemu/block/qcow2-refcount.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
l1_size2 = l1_size * sizeof(uint64_t);
l1_allocated = 0;
if (l1_table_offset != s->l1_table_offset) {
l1_table = qemu_malloc(l1_size2);
l1_table = qemu_mallocz(align_offset(l1_size2, 512));
l1_allocated = 1;
if (bdrv_pread(s->hd, l1_table_offset,
l1_table, l1_size2) != l1_size2)
Expand Down
25 changes: 16 additions & 9 deletions qemu/block/qcow2.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
if (s->l1_size < s->l1_vm_state_index)
goto fail;
s->l1_table_offset = header.l1_table_offset;
s->l1_table = qemu_malloc(s->l1_size * sizeof(uint64_t));
s->l1_table = qemu_mallocz(
align_offset(s->l1_size * sizeof(uint64_t), 512));
if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) !=
s->l1_size * sizeof(uint64_t))
goto fail;
Expand Down Expand Up @@ -889,12 +890,16 @@ static void qcow_flush(BlockDriverState *bs)
bdrv_flush(s->hd);
}

static int64_t qcow_vm_state_offset(BDRVQcowState *s)
{
return (int64_t)s->l1_vm_state_index << (s->cluster_bits + s->l2_bits);
}

static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
{
BDRVQcowState *s = bs->opaque;
bdi->cluster_size = s->cluster_size;
bdi->vm_state_offset = (int64_t)s->l1_vm_state_index <<
(s->cluster_bits + s->l2_bits);
bdi->vm_state_offset = qcow_vm_state_offset(s);
return 0;
}

Expand Down Expand Up @@ -924,26 +929,28 @@ static void dump_refcounts(BlockDriverState *bs)
}
#endif

static int qcow_put_buffer(BlockDriverState *bs, const uint8_t *buf,
static int qcow_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
int64_t pos, int size)
{
BDRVQcowState *s = bs->opaque;
int growable = bs->growable;

bs->growable = 1;
bdrv_pwrite(bs, pos, buf, size);
bdrv_pwrite(bs, qcow_vm_state_offset(s) + pos, buf, size);
bs->growable = growable;

return size;
}

static int qcow_get_buffer(BlockDriverState *bs, uint8_t *buf,
static int qcow_load_vmstate(BlockDriverState *bs, uint8_t *buf,
int64_t pos, int size)
{
BDRVQcowState *s = bs->opaque;
int growable = bs->growable;
int ret;

bs->growable = 1;
ret = bdrv_pread(bs, pos, buf, size);
ret = bdrv_pread(bs, qcow_vm_state_offset(s) + pos, buf, size);
bs->growable = growable;

return ret;
Expand Down Expand Up @@ -1000,8 +1007,8 @@ static BlockDriver bdrv_qcow2 = {
.bdrv_snapshot_list = qcow2_snapshot_list,
.bdrv_get_info = qcow_get_info,

.bdrv_put_buffer = qcow_put_buffer,
.bdrv_get_buffer = qcow_get_buffer,
.bdrv_save_vmstate = qcow_save_vmstate,
.bdrv_load_vmstate = qcow_load_vmstate,

.create_options = qcow_create_options,
.bdrv_check = qcow_check,
Expand Down
17 changes: 12 additions & 5 deletions qemu/block/raw-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
static int raw_create(const char *filename, QEMUOptionParameter *options)
{
int fd;
int result = 0;
int64_t total_size = 0;

/* Read out options */
Expand All @@ -864,11 +865,17 @@ static int raw_create(const char *filename, QEMUOptionParameter *options)

fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
0644);
if (fd < 0)
return -EIO;
ftruncate(fd, total_size * 512);
close(fd);
return 0;
if (fd < 0) {
result = -errno;
} else {
if (ftruncate(fd, total_size * 512) != 0) {
result = -errno;
}
if (close(fd) != 0) {
result = -errno;
}
}
return result;
}

static void raw_flush(BlockDriverState *bs)
Expand Down
8 changes: 4 additions & 4 deletions qemu/block_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ struct BlockDriver {
QEMUSnapshotInfo **psn_info);
int (*bdrv_get_info)(BlockDriverState *bs, BlockDriverInfo *bdi);

int (*bdrv_put_buffer)(BlockDriverState *bs, const uint8_t *buf,
int64_t pos, int size);
int (*bdrv_get_buffer)(BlockDriverState *bs, uint8_t *buf,
int64_t pos, int size);
int (*bdrv_save_vmstate)(BlockDriverState *bs, const uint8_t *buf,
int64_t pos, int size);
int (*bdrv_load_vmstate)(BlockDriverState *bs, uint8_t *buf,
int64_t pos, int size);

/* removable device specific */
int (*bdrv_is_inserted)(BlockDriverState *bs);
Expand Down
6 changes: 6 additions & 0 deletions qemu/configure
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ ar="ar"
make="make"
install="install"
strip="strip"
objcopy="objcopy"
ld="ld"

# parse CC options first
for opt do
Expand All @@ -53,6 +55,8 @@ done
cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
strip="${cross_prefix}${strip}"
objcopy="${cross_prefix}${objcopy}"
ld="${cross_prefix}${ld}"

# check that the C compiler works.
cat > $TMPC <<EOF
Expand Down Expand Up @@ -1483,6 +1487,8 @@ echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
echo "CC=$cc" >> $config_mak
echo "HOST_CC=$host_cc" >> $config_mak
echo "AR=$ar" >> $config_mak
echo "OBJCOPY=$objcopy" >> $config_mak
echo "LD=$ld" >> $config_mak
# XXX: only use CFLAGS and LDFLAGS ?
# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
# compilation of dyngen tool (useful for win32 build on Linux host)
Expand Down
9 changes: 4 additions & 5 deletions qemu/cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

/*
Expand Down Expand Up @@ -421,7 +420,7 @@ int cpu_exec(CPUState *env1)
env->hflags2 |= HF2_NMI_MASK;
do_interrupt(EXCP02_NMI, 0, 0, 0, 1);
next_tb = 0;
} else if (interrupt_request & CPU_INTERRUPT_MCE) {
} else if (interrupt_request & CPU_INTERRUPT_MCE) {
env->interrupt_request &= ~CPU_INTERRUPT_MCE;
do_interrupt(EXCP12_MCHK, 0, 0, 0, 0);
next_tb = 0;
Expand Down Expand Up @@ -496,7 +495,7 @@ int cpu_exec(CPUState *env1)
}
#elif defined(TARGET_SPARC)
if ((interrupt_request & CPU_INTERRUPT_HARD) &&
(env->psret != 0)) {
cpu_interrupts_enabled(env)) {
int pil = env->interrupt_index & 15;
int type = env->interrupt_index & 0xf0;

Expand All @@ -507,7 +506,7 @@ int cpu_exec(CPUState *env1)
env->exception_index = env->interrupt_index;
do_interrupt(env);
env->interrupt_index = 0;
#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
#if !defined(CONFIG_USER_ONLY)
cpu_check_irqs(env);
#endif
next_tb = 0;
Expand Down
Loading

0 comments on commit 172ab04

Please sign in to comment.