From: "Christian MICHON" <christian.michon@gmail.com>
To: uClibc <uclibc@uclibc.org>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [optional patch] in order to compile qemu-0.9.0 for uclibc-0.9.29
Date: Sat, 25 Aug 2007 16:16:07 +0200 [thread overview]
Message-ID: <46d6db660708250716n6ed54042lfa63efb29d1a8e2e@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 625 bytes --]
Hi lists,
for those who would optionally need qemu-0.9.0 (not the CVS current,
the official release) compiled versus uclibc-0.9.29 on x86, please
find attached a patch which allows it. i've not tested other
architectures like arm/sparc.
it's basically a removal of aio (not present in uclibc) and of
floatx80 math operations (not all available in uclibc).
this is optional: your mileage may vary. the cool thing about it is
that next release of detaolb 0.6 will include qemu binaries. kqemu
works too if you compile it yourself for detaolb.
--
Christian
--
http://detaolb.sourceforge.net/, a linux distribution for Qemu
[-- Attachment #2: qemu-0.9.0-uclibc.patch --]
[-- Type: application/octet-stream, Size: 8460 bytes --]
diff --git a/block-raw.c b/block-raw.c
index 29882e1..9634f8a 100644
--- a/block-raw.c
+++ b/block-raw.c
@@ -25,7 +25,6 @@
#include "block_int.h"
#include <assert.h>
#ifndef _WIN32
-#include <aio.h>
#ifndef QEMU_TOOL
#include "exec-all.h"
@@ -160,224 +159,31 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
/***********************************************************/
/* Unix AIO using POSIX AIO */
-typedef struct RawAIOCB {
- BlockDriverAIOCB common;
- struct aiocb aiocb;
- struct RawAIOCB *next;
-} RawAIOCB;
-
-static int aio_sig_num = SIGUSR2;
-static RawAIOCB *first_aio; /* AIO issued */
-static int aio_initialized = 0;
-
-static void aio_signal_handler(int signum)
-{
-#ifndef QEMU_TOOL
- CPUState *env = cpu_single_env;
- if (env) {
- /* stop the currently executing cpu because a timer occured */
- cpu_interrupt(env, CPU_INTERRUPT_EXIT);
-#ifdef USE_KQEMU
- if (env->kqemu_enabled) {
- kqemu_cpu_interrupt(env);
- }
-#endif
- }
-#endif
-}
-
void qemu_aio_init(void)
{
- struct sigaction act;
-
- aio_initialized = 1;
-
- sigfillset(&act.sa_mask);
- act.sa_flags = 0; /* do not restart syscalls to interrupt select() */
- act.sa_handler = aio_signal_handler;
- sigaction(aio_sig_num, &act, NULL);
-
-#if defined(__GLIBC__) && defined(__linux__)
- {
- /* XXX: aio thread exit seems to hang on RedHat 9 and this init
- seems to fix the problem. */
- struct aioinit ai;
- memset(&ai, 0, sizeof(ai));
- ai.aio_threads = 1;
- ai.aio_num = 1;
- ai.aio_idle_time = 365 * 100000;
- aio_init(&ai);
- }
-#endif
}
void qemu_aio_poll(void)
{
- RawAIOCB *acb, **pacb;
- int ret;
-
- for(;;) {
- pacb = &first_aio;
- for(;;) {
- acb = *pacb;
- if (!acb)
- goto the_end;
- ret = aio_error(&acb->aiocb);
- if (ret == ECANCELED) {
- /* remove the request */
- *pacb = acb->next;
- qemu_aio_release(acb);
- } else if (ret != EINPROGRESS) {
- /* end of aio */
- if (ret == 0) {
- ret = aio_return(&acb->aiocb);
- if (ret == acb->aiocb.aio_nbytes)
- ret = 0;
- else
- ret = -EINVAL;
- } else {
- ret = -ret;
- }
- /* remove the request */
- *pacb = acb->next;
- /* call the callback */
- acb->common.cb(acb->common.opaque, ret);
- qemu_aio_release(acb);
- break;
- } else {
- pacb = &acb->next;
- }
- }
- }
- the_end: ;
}
-/* Wait for all IO requests to complete. */
void qemu_aio_flush(void)
{
- qemu_aio_wait_start();
- qemu_aio_poll();
- while (first_aio) {
- qemu_aio_wait();
- }
- qemu_aio_wait_end();
}
-/* wait until at least one AIO was handled */
-static sigset_t wait_oset;
-
void qemu_aio_wait_start(void)
{
- sigset_t set;
-
- if (!aio_initialized)
- qemu_aio_init();
- sigemptyset(&set);
- sigaddset(&set, aio_sig_num);
- sigprocmask(SIG_BLOCK, &set, &wait_oset);
}
void qemu_aio_wait(void)
{
- sigset_t set;
- int nb_sigs;
-
#ifndef QEMU_TOOL
- if (qemu_bh_poll())
- return;
+ qemu_bh_poll();
#endif
- sigemptyset(&set);
- sigaddset(&set, aio_sig_num);
- sigwait(&set, &nb_sigs);
- qemu_aio_poll();
}
void qemu_aio_wait_end(void)
{
- sigprocmask(SIG_SETMASK, &wait_oset, NULL);
-}
-
-static RawAIOCB *raw_aio_setup(BlockDriverState *bs,
- int64_t sector_num, uint8_t *buf, int nb_sectors,
- BlockDriverCompletionFunc *cb, void *opaque)
-{
- BDRVRawState *s = bs->opaque;
- RawAIOCB *acb;
-
- if (fd_open(bs) < 0)
- return NULL;
-
- acb = qemu_aio_get(bs, cb, opaque);
- if (!acb)
- return NULL;
- acb->aiocb.aio_fildes = s->fd;
- acb->aiocb.aio_sigevent.sigev_signo = aio_sig_num;
- acb->aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
- acb->aiocb.aio_buf = buf;
- acb->aiocb.aio_nbytes = nb_sectors * 512;
- acb->aiocb.aio_offset = sector_num * 512;
- acb->next = first_aio;
- first_aio = acb;
- return acb;
-}
-
-static BlockDriverAIOCB *raw_aio_read(BlockDriverState *bs,
- int64_t sector_num, uint8_t *buf, int nb_sectors,
- BlockDriverCompletionFunc *cb, void *opaque)
-{
- RawAIOCB *acb;
-
- acb = raw_aio_setup(bs, sector_num, buf, nb_sectors, cb, opaque);
- if (!acb)
- return NULL;
- if (aio_read(&acb->aiocb) < 0) {
- qemu_aio_release(acb);
- return NULL;
- }
- return &acb->common;
-}
-
-static BlockDriverAIOCB *raw_aio_write(BlockDriverState *bs,
- int64_t sector_num, const uint8_t *buf, int nb_sectors,
- BlockDriverCompletionFunc *cb, void *opaque)
-{
- RawAIOCB *acb;
-
- acb = raw_aio_setup(bs, sector_num, (uint8_t*)buf, nb_sectors, cb, opaque);
- if (!acb)
- return NULL;
- if (aio_write(&acb->aiocb) < 0) {
- qemu_aio_release(acb);
- return NULL;
- }
- return &acb->common;
-}
-
-static void raw_aio_cancel(BlockDriverAIOCB *blockacb)
-{
- int ret;
- RawAIOCB *acb = (RawAIOCB *)blockacb;
- RawAIOCB **pacb;
-
- ret = aio_cancel(acb->aiocb.aio_fildes, &acb->aiocb);
- if (ret == AIO_NOTCANCELED) {
- /* fail safe: if the aio could not be canceled, we wait for
- it */
- while (aio_error(&acb->aiocb) == EINPROGRESS);
- }
-
- /* remove the callback from the queue */
- pacb = &first_aio;
- for(;;) {
- if (*pacb == NULL) {
- break;
- } else if (*pacb == acb) {
- *pacb = acb->next;
- qemu_aio_release(acb);
- break;
- }
- pacb = &acb->next;
- }
}
static void raw_close(BlockDriverState *bs)
@@ -480,10 +286,6 @@ BlockDriver bdrv_raw = {
raw_create,
raw_flush,
- .bdrv_aio_read = raw_aio_read,
- .bdrv_aio_write = raw_aio_write,
- .bdrv_aio_cancel = raw_aio_cancel,
- .aiocb_size = sizeof(RawAIOCB),
.protocol_name = "file",
.bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite,
@@ -816,10 +618,6 @@ BlockDriver bdrv_host_device = {
NULL,
raw_flush,
- .bdrv_aio_read = raw_aio_read,
- .bdrv_aio_write = raw_aio_write,
- .bdrv_aio_cancel = raw_aio_cancel,
- .aiocb_size = sizeof(RawAIOCB),
.bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite,
.bdrv_getlength = raw_getlength,
diff --git a/fpu/softfloat-native.c b/fpu/softfloat-native.c
index f20d5c4..ae3d384 100644
--- a/fpu/softfloat-native.c
+++ b/fpu/softfloat-native.c
@@ -3,16 +3,11 @@
#include "softfloat.h"
#include <math.h>
+#define trunc(value) ((float)((int)(value)))
+
void set_float_rounding_mode(int val STATUS_PARAM)
{
STATUS(float_rounding_mode) = val;
-#if defined(_BSD) && !defined(__APPLE__) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10)
- fpsetround(val);
-#elif defined(__arm__)
- /* nothing to do */
-#else
- fesetround(val);
-#endif
}
#ifdef FLOATX80
diff --git a/fpu/softfloat-native.h b/fpu/softfloat-native.h
index 8c27708..444bc8e 100644
--- a/fpu/softfloat-native.h
+++ b/fpu/softfloat-native.h
@@ -5,7 +5,6 @@
#include <ieeefp.h>
#define fabsf(f) ((float)fabs(f))
#else
-#include <fenv.h>
#endif
/*
@@ -76,10 +75,10 @@ enum {
};
#else
enum {
- float_round_nearest_even = FE_TONEAREST,
- float_round_down = FE_DOWNWARD,
- float_round_up = FE_UPWARD,
- float_round_to_zero = FE_TOWARDZERO
+ float_round_nearest_even = 0,
+ float_round_down = 0x400,
+ float_round_up = 0x800,
+ float_round_to_zero = 0xc00
};
#endif
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index a326af8..9a9e1cd 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -80,12 +80,10 @@ typedef int64_t sbits64;
*----------------------------------------------------------------------------*/
#ifdef CONFIG_SOFTFLOAT
/* bit exact soft float support */
-#define FLOATX80
#define FLOAT128
#else
/* native float support */
#if (defined(__i386__) || defined(__x86_64__)) && !defined(_BSD)
-#define FLOATX80
#endif
#endif /* !CONFIG_SOFTFLOAT */
reply other threads:[~2007-08-25 20:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46d6db660708250716n6ed54042lfa63efb29d1a8e2e@mail.gmail.com \
--to=christian.michon@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=uclibc@uclibc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).