mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
find -type f | xargs sed -i 's/[\t ]$//g' # on most files
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
bd494f4cbd
commit
5fafdf24ef
327 changed files with 4737 additions and 4738 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Emulation of Linux signals
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -50,7 +50,7 @@ static struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE]; /* siginfo queue */
|
|||
static struct sigqueue *first_free; /* first free siginfo queue entry */
|
||||
static int signal_pending; /* non zero if a signal may be pending */
|
||||
|
||||
static void host_signal_handler(int host_signum, siginfo_t *info,
|
||||
static void host_signal_handler(int host_signum, siginfo_t *info,
|
||||
void *puc);
|
||||
|
||||
static uint8_t host_to_target_signal_table[65] = {
|
||||
|
@ -102,17 +102,17 @@ static inline int target_to_host_signal(int sig)
|
|||
return target_to_host_signal_table[sig];
|
||||
}
|
||||
|
||||
static void host_to_target_sigset_internal(target_sigset_t *d,
|
||||
static void host_to_target_sigset_internal(target_sigset_t *d,
|
||||
const sigset_t *s)
|
||||
{
|
||||
int i;
|
||||
unsigned long sigmask;
|
||||
uint32_t target_sigmask;
|
||||
|
||||
|
||||
sigmask = ((unsigned long *)s)[0];
|
||||
target_sigmask = 0;
|
||||
for(i = 0; i < 32; i++) {
|
||||
if (sigmask & (1 << i))
|
||||
if (sigmask & (1 << i))
|
||||
target_sigmask |= 1 << (host_to_target_signal(i + 1) - 1);
|
||||
}
|
||||
#if TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 32
|
||||
|
@ -147,7 +147,7 @@ void target_to_host_sigset_internal(sigset_t *d, const target_sigset_t *s)
|
|||
target_sigmask = s->sig[0];
|
||||
sigmask = 0;
|
||||
for(i = 0; i < 32; i++) {
|
||||
if (target_sigmask & (1 << i))
|
||||
if (target_sigmask & (1 << i))
|
||||
sigmask |= 1 << (target_to_host_signal(i + 1) - 1);
|
||||
}
|
||||
#if TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 32
|
||||
|
@ -171,8 +171,8 @@ void target_to_host_sigset(sigset_t *d, const target_sigset_t *s)
|
|||
s1.sig[i] = tswapl(s->sig[i]);
|
||||
target_to_host_sigset_internal(d, &s1);
|
||||
}
|
||||
|
||||
void host_to_target_old_sigset(target_ulong *old_sigset,
|
||||
|
||||
void host_to_target_old_sigset(target_ulong *old_sigset,
|
||||
const sigset_t *sigset)
|
||||
{
|
||||
target_sigset_t d;
|
||||
|
@ -180,7 +180,7 @@ void host_to_target_old_sigset(target_ulong *old_sigset,
|
|||
*old_sigset = d.sig[0];
|
||||
}
|
||||
|
||||
void target_to_host_old_sigset(sigset_t *sigset,
|
||||
void target_to_host_old_sigset(sigset_t *sigset,
|
||||
const target_ulong *old_sigset)
|
||||
{
|
||||
target_sigset_t d;
|
||||
|
@ -194,7 +194,7 @@ void target_to_host_old_sigset(sigset_t *sigset,
|
|||
|
||||
/* siginfo conversion */
|
||||
|
||||
static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
|
||||
static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
|
||||
const siginfo_t *info)
|
||||
{
|
||||
int sig;
|
||||
|
@ -202,7 +202,7 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
|
|||
tinfo->si_signo = sig;
|
||||
tinfo->si_errno = 0;
|
||||
tinfo->si_code = 0;
|
||||
if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV ||
|
||||
if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV ||
|
||||
sig == SIGBUS || sig == SIGTRAP) {
|
||||
/* should never come here, but who knows. The information for
|
||||
the target is irrelevant */
|
||||
|
@ -213,12 +213,12 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
|
|||
tinfo->_sifields._rt._pid = info->si_pid;
|
||||
tinfo->_sifields._rt._uid = info->si_uid;
|
||||
/* XXX: potential problem if 64 bit */
|
||||
tinfo->_sifields._rt._sigval.sival_ptr =
|
||||
tinfo->_sifields._rt._sigval.sival_ptr =
|
||||
(target_ulong)info->si_value.sival_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void tswap_siginfo(target_siginfo_t *tinfo,
|
||||
static void tswap_siginfo(target_siginfo_t *tinfo,
|
||||
const target_siginfo_t *info)
|
||||
{
|
||||
int sig;
|
||||
|
@ -226,16 +226,16 @@ static void tswap_siginfo(target_siginfo_t *tinfo,
|
|||
tinfo->si_signo = tswap32(sig);
|
||||
tinfo->si_errno = tswap32(info->si_errno);
|
||||
tinfo->si_code = tswap32(info->si_code);
|
||||
if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV ||
|
||||
if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV ||
|
||||
sig == SIGBUS || sig == SIGTRAP) {
|
||||
tinfo->_sifields._sigfault._addr =
|
||||
tinfo->_sifields._sigfault._addr =
|
||||
tswapl(info->_sifields._sigfault._addr);
|
||||
} else if (sig == SIGIO) {
|
||||
tinfo->_sifields._sigpoll._fd = tswap32(info->_sifields._sigpoll._fd);
|
||||
} else if (sig >= TARGET_SIGRTMIN) {
|
||||
tinfo->_sifields._rt._pid = tswap32(info->_sifields._rt._pid);
|
||||
tinfo->_sifields._rt._uid = tswap32(info->_sifields._rt._uid);
|
||||
tinfo->_sifields._rt._sigval.sival_ptr =
|
||||
tinfo->_sifields._rt._sigval.sival_ptr =
|
||||
tswapl(info->_sifields._rt._sigval.sival_ptr);
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo)
|
|||
info->si_code = tswap32(tinfo->si_code);
|
||||
info->si_pid = tswap32(tinfo->_sifields._rt._pid);
|
||||
info->si_uid = tswap32(tinfo->_sifields._rt._uid);
|
||||
info->si_value.sival_ptr =
|
||||
info->si_value.sival_ptr =
|
||||
(void *)tswapl(tinfo->_sifields._rt._sigval.sival_ptr);
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ void signal_init(void)
|
|||
j = host_to_target_signal_table[i];
|
||||
target_to_host_signal_table[j] = i;
|
||||
}
|
||||
|
||||
|
||||
/* set all host signal handlers. ALL signals are blocked during
|
||||
the handlers to serialize them. */
|
||||
sigfillset(&act.sa_mask);
|
||||
|
@ -283,11 +283,11 @@ void signal_init(void)
|
|||
for(i = 1; i < NSIG; i++) {
|
||||
sigaction(i, &act, NULL);
|
||||
}
|
||||
|
||||
|
||||
memset(sigact_table, 0, sizeof(sigact_table));
|
||||
|
||||
first_free = &sigqueue_table[0];
|
||||
for(i = 0; i < MAX_SIGQUEUE_SIZE - 1; i++)
|
||||
for(i = 0; i < MAX_SIGQUEUE_SIZE - 1; i++)
|
||||
sigqueue_table[i].next = &sigqueue_table[i + 1];
|
||||
sigqueue_table[MAX_SIGQUEUE_SIZE - 1].next = NULL;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ void __attribute((noreturn)) force_sig(int sig)
|
|||
{
|
||||
int host_sig;
|
||||
host_sig = target_to_host_signal(sig);
|
||||
fprintf(stderr, "qemu: uncaught target signal %d (%s) - exiting\n",
|
||||
fprintf(stderr, "qemu: uncaught target signal %d (%s) - exiting\n",
|
||||
sig, strsignal(host_sig));
|
||||
#if 1
|
||||
_exit(-host_sig);
|
||||
|
@ -339,15 +339,15 @@ int queue_signal(int sig, target_siginfo_t *info)
|
|||
target_ulong handler;
|
||||
|
||||
#if defined(DEBUG_SIGNAL)
|
||||
fprintf(stderr, "queue_signal: sig=%d\n",
|
||||
fprintf(stderr, "queue_signal: sig=%d\n",
|
||||
sig);
|
||||
#endif
|
||||
k = &sigact_table[sig - 1];
|
||||
handler = k->sa._sa_handler;
|
||||
if (handler == TARGET_SIG_DFL) {
|
||||
/* default handler : ignore some signal. The other are fatal */
|
||||
if (sig != TARGET_SIGCHLD &&
|
||||
sig != TARGET_SIGURG &&
|
||||
if (sig != TARGET_SIGCHLD &&
|
||||
sig != TARGET_SIGURG &&
|
||||
sig != TARGET_SIGWINCH) {
|
||||
force_sig(sig);
|
||||
} else {
|
||||
|
@ -388,7 +388,7 @@ int queue_signal(int sig, target_siginfo_t *info)
|
|||
}
|
||||
}
|
||||
|
||||
static void host_signal_handler(int host_signum, siginfo_t *info,
|
||||
static void host_signal_handler(int host_signum, siginfo_t *info,
|
||||
void *puc)
|
||||
{
|
||||
int sig;
|
||||
|
@ -396,7 +396,7 @@ static void host_signal_handler(int host_signum, siginfo_t *info,
|
|||
|
||||
/* the CPU emulator uses some host signals to detect exceptions,
|
||||
we we forward to it some signals */
|
||||
if (host_signum == SIGSEGV || host_signum == SIGBUS
|
||||
if (host_signum == SIGSEGV || host_signum == SIGBUS
|
||||
#if defined(TARGET_I386) && defined(USE_CODE_COPY)
|
||||
|| host_signum == SIGFPE
|
||||
#endif
|
||||
|
@ -430,7 +430,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
|
|||
return -EINVAL;
|
||||
k = &sigact_table[sig - 1];
|
||||
#if defined(DEBUG_SIGNAL)
|
||||
fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n",
|
||||
fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n",
|
||||
sig, (int)act, (int)oact);
|
||||
#endif
|
||||
if (oact) {
|
||||
|
@ -476,7 +476,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
|
|||
#define offsetof(type, field) ((size_t) &((type *)0)->field)
|
||||
#endif
|
||||
|
||||
static inline int copy_siginfo_to_user(target_siginfo_t *tinfo,
|
||||
static inline int copy_siginfo_to_user(target_siginfo_t *tinfo,
|
||||
const target_siginfo_t *info)
|
||||
{
|
||||
tswap_siginfo(tinfo, info);
|
||||
|
@ -648,7 +648,7 @@ get_sigframe(struct emulated_sigaction *ka, CPUX86State *env, size_t frame_size)
|
|||
}
|
||||
|
||||
/* This is the legacy signal stack switching. */
|
||||
else
|
||||
else
|
||||
#endif
|
||||
if ((env->segs[R_SS].selector & 0xffff) != __USER_DS &&
|
||||
!(ka->sa.sa_flags & TARGET_SA_RESTORER) &&
|
||||
|
@ -723,7 +723,7 @@ give_sigsegv:
|
|||
force_sig(TARGET_SIGSEGV /* , current */);
|
||||
}
|
||||
|
||||
static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
|
||||
static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
|
||||
target_siginfo_t *info,
|
||||
target_sigset_t *set, CPUX86State *env)
|
||||
{
|
||||
|
@ -817,7 +817,7 @@ restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax)
|
|||
|
||||
cpu_x86_load_seg(env, R_CS, lduw(&sc->cs) | 3);
|
||||
cpu_x86_load_seg(env, R_SS, lduw(&sc->ss) | 3);
|
||||
|
||||
|
||||
{
|
||||
unsigned int tmpflags;
|
||||
tmpflags = ldl(&sc->eflags);
|
||||
|
@ -865,7 +865,7 @@ long do_sigreturn(CPUX86State *env)
|
|||
|
||||
target_to_host_sigset_internal(&set, &target_set);
|
||||
sigprocmask(SIG_SETMASK, &set, NULL);
|
||||
|
||||
|
||||
/* restore registers */
|
||||
if (restore_sigcontext(env, &frame->sc, &eax))
|
||||
goto badframe;
|
||||
|
@ -889,7 +889,7 @@ long do_rt_sigreturn(CPUX86State *env)
|
|||
#endif
|
||||
target_to_host_sigset(&set, &frame->uc.tuc_sigmask);
|
||||
sigprocmask(SIG_SETMASK, &set, NULL);
|
||||
|
||||
|
||||
if (restore_sigcontext(env, &frame->uc.tuc_mcontext, &eax))
|
||||
goto badframe;
|
||||
|
||||
|
@ -1127,7 +1127,7 @@ static void setup_frame(int usig, struct emulated_sigaction *ka,
|
|||
// return err;
|
||||
}
|
||||
|
||||
static void setup_rt_frame(int usig, struct emulated_sigaction *ka,
|
||||
static void setup_rt_frame(int usig, struct emulated_sigaction *ka,
|
||||
target_siginfo_t *info,
|
||||
target_sigset_t *set, CPUState *env)
|
||||
{
|
||||
|
@ -1547,7 +1547,7 @@ restore_fpu_state(CPUState *env, qemu_siginfo_fpu_t *fpu)
|
|||
}
|
||||
|
||||
|
||||
static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
|
||||
static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
|
||||
target_siginfo_t *info,
|
||||
target_sigset_t *set, CPUState *env)
|
||||
{
|
||||
|
@ -1851,7 +1851,7 @@ get_sigframe(struct emulated_sigaction *ka, CPUState *regs, size_t frame_size)
|
|||
return g2h((sp - frame_size) & ~7);
|
||||
}
|
||||
|
||||
static void setup_frame(int sig, struct emulated_sigaction * ka,
|
||||
static void setup_frame(int sig, struct emulated_sigaction * ka,
|
||||
target_sigset_t *set, CPUState *regs)
|
||||
{
|
||||
struct sigframe *frame;
|
||||
|
@ -1894,7 +1894,7 @@ static void setup_frame(int sig, struct emulated_sigaction * ka,
|
|||
|
||||
give_sigsegv:
|
||||
force_sig(TARGET_SIGSEGV/*, current*/);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
long do_sigreturn(CPUState *regs)
|
||||
|
@ -1933,7 +1933,7 @@ long do_sigreturn(CPUState *regs)
|
|||
:"r" (®s));
|
||||
/* Unreached */
|
||||
#endif
|
||||
|
||||
|
||||
regs->PC[regs->current_tc] = regs->CP0_EPC;
|
||||
/* I am not sure this is right, but it seems to work
|
||||
* maybe a problem with nested signals ? */
|
||||
|
@ -1945,7 +1945,7 @@ badframe:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
|
||||
static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
|
||||
target_siginfo_t *info,
|
||||
target_sigset_t *set, CPUState *env)
|
||||
{
|
||||
|
@ -1966,7 +1966,7 @@ static void setup_frame(int sig, struct emulated_sigaction *ka,
|
|||
fprintf(stderr, "setup_frame: not implemented\n");
|
||||
}
|
||||
|
||||
static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
|
||||
static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
|
||||
target_siginfo_t *info,
|
||||
target_sigset_t *set, CPUState *env)
|
||||
{
|
||||
|
@ -1995,7 +1995,7 @@ void process_pending_signals(void *cpu_env)
|
|||
target_sigset_t target_old_set;
|
||||
struct emulated_sigaction *k;
|
||||
struct sigqueue *q;
|
||||
|
||||
|
||||
if (!signal_pending)
|
||||
return;
|
||||
|
||||
|
@ -2018,7 +2018,7 @@ void process_pending_signals(void *cpu_env)
|
|||
k->first = q->next;
|
||||
if (!k->first)
|
||||
k->pending = 0;
|
||||
|
||||
|
||||
sig = gdb_handlesig (cpu_env, sig);
|
||||
if (!sig) {
|
||||
fprintf (stderr, "Lost signal\n");
|
||||
|
@ -2028,8 +2028,8 @@ void process_pending_signals(void *cpu_env)
|
|||
handler = k->sa._sa_handler;
|
||||
if (handler == TARGET_SIG_DFL) {
|
||||
/* default handler : ignore some signal. The other are fatal */
|
||||
if (sig != TARGET_SIGCHLD &&
|
||||
sig != TARGET_SIGURG &&
|
||||
if (sig != TARGET_SIGCHLD &&
|
||||
sig != TARGET_SIGURG &&
|
||||
sig != TARGET_SIGWINCH) {
|
||||
force_sig(sig);
|
||||
}
|
||||
|
@ -2044,7 +2044,7 @@ void process_pending_signals(void *cpu_env)
|
|||
blocked during the handler */
|
||||
if (!(k->sa.sa_flags & TARGET_SA_NODEFER))
|
||||
sigaddset(&set, target_to_host_signal(sig));
|
||||
|
||||
|
||||
/* block signals in the handler using Linux */
|
||||
sigprocmask(SIG_BLOCK, &set, &old_set);
|
||||
/* save the previous blocked signal state to restore it at the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue