Merge remote-tracking branch 'stefanha/trivial-patches' into staging
* stefanha/trivial-patches: w32: Always use standard instead of native format strings net/socket: Fix compiler warning (regression for MinGW) linux-user: Remove redundant null check and replace free by g_free qemu-timer: simplify qemu_run_timers TextConsole: saturate escape parameter in TTY_STATE_CSI curses: don't initialize curses when qemu is daemonized dtrace backend: add function to reserved words pflash_cfi01: Fix warning caused by unreachable code ioh3420: Remove unreachable code lm4549: Fix buffer overflow cadence_uart: Fix buffer overflow qemu-sockets: Fix potential memory leak qemu-ga: Remove unreachable code after g_error target-i386: Allow tsc-frequency to be larger then 2.147G
This commit is contained in:
commit
3988475b9b
@ -44,6 +44,11 @@
|
|||||||
/* Use gnu_printf when supported (qemu uses standard format strings). */
|
/* Use gnu_printf when supported (qemu uses standard format strings). */
|
||||||
# define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2)))
|
# define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2)))
|
||||||
# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
|
# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
|
||||||
|
# if defined(_WIN32)
|
||||||
|
/* Map __printf__ to __gnu_printf__ because we want standard format strings
|
||||||
|
* even when MinGW or GLib include files use __printf__. */
|
||||||
|
# define __printf__ __gnu_printf__
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define GCC_WEAK __attribute__((weak))
|
#define GCC_WEAK __attribute__((weak))
|
||||||
|
@ -938,8 +938,11 @@ static void console_putchar(TextConsole *s, int ch)
|
|||||||
case TTY_STATE_CSI: /* handle escape sequence parameters */
|
case TTY_STATE_CSI: /* handle escape sequence parameters */
|
||||||
if (ch >= '0' && ch <= '9') {
|
if (ch >= '0' && ch <= '9') {
|
||||||
if (s->nb_esc_params < MAX_ESC_PARAMS) {
|
if (s->nb_esc_params < MAX_ESC_PARAMS) {
|
||||||
s->esc_params[s->nb_esc_params] =
|
int *param = &s->esc_params[s->nb_esc_params];
|
||||||
s->esc_params[s->nb_esc_params] * 10 + ch - '0';
|
int digit = (ch - '0');
|
||||||
|
|
||||||
|
*param = (*param <= (INT_MAX - digit) / 10) ?
|
||||||
|
*param * 10 + digit : INT_MAX;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (s->nb_esc_params < MAX_ESC_PARAMS)
|
if (s->nb_esc_params < MAX_ESC_PARAMS)
|
||||||
|
@ -404,7 +404,7 @@ static uint64_t uart_read(void *opaque, target_phys_addr_t offset,
|
|||||||
uint32_t c = 0;
|
uint32_t c = 0;
|
||||||
|
|
||||||
offset >>= 2;
|
offset >>= 2;
|
||||||
if (offset > R_MAX) {
|
if (offset >= R_MAX) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (offset == R_TX_RX) {
|
} else if (offset == R_TX_RX) {
|
||||||
uart_read_rx_fifo(s, &c);
|
uart_read_rx_fifo(s, &c);
|
||||||
|
@ -125,7 +125,6 @@ static int ioh3420_initfn(PCIDevice *d)
|
|||||||
rc = pcie_chassis_add_slot(s);
|
rc = pcie_chassis_add_slot(s);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
goto err_pcie_cap;
|
goto err_pcie_cap;
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
pcie_cap_root_init(d);
|
pcie_cap_root_init(d);
|
||||||
rc = pcie_aer_init(d, IOH_EP_AER_OFFSET);
|
rc = pcie_aer_init(d, IOH_EP_AER_OFFSET);
|
||||||
|
@ -224,7 +224,7 @@ uint32_t lm4549_write_samples(lm4549_state *s, uint32_t left, uint32_t right)
|
|||||||
This model supports 16-bit playback.
|
This model supports 16-bit playback.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (s->buffer_level >= LM4549_BUFFER_SIZE) {
|
if (s->buffer_level > LM4549_BUFFER_SIZE - 2) {
|
||||||
DPRINTF("write_sample Buffer full\n");
|
DPRINTF("write_sample Buffer full\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -321,7 +321,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
|
|||||||
}
|
}
|
||||||
pfl->wcycle++;
|
pfl->wcycle++;
|
||||||
pfl->cmd = cmd;
|
pfl->cmd = cmd;
|
||||||
return;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
switch (pfl->cmd) {
|
switch (pfl->cmd) {
|
||||||
case 0x10: /* Single Byte Program */
|
case 0x10: /* Single Byte Program */
|
||||||
@ -376,7 +376,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
|
|||||||
default:
|
default:
|
||||||
goto error_flash;
|
goto error_flash;
|
||||||
}
|
}
|
||||||
return;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
switch (pfl->cmd) {
|
switch (pfl->cmd) {
|
||||||
case 0xe8: /* Block write */
|
case 0xe8: /* Block write */
|
||||||
@ -407,7 +407,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
|
|||||||
default:
|
default:
|
||||||
goto error_flash;
|
goto error_flash;
|
||||||
}
|
}
|
||||||
return;
|
break;
|
||||||
case 3: /* Confirm mode */
|
case 3: /* Confirm mode */
|
||||||
switch (pfl->cmd) {
|
switch (pfl->cmd) {
|
||||||
case 0xe8: /* Block write */
|
case 0xe8: /* Block write */
|
||||||
@ -423,7 +423,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
|
|||||||
default:
|
default:
|
||||||
goto error_flash;
|
goto error_flash;
|
||||||
}
|
}
|
||||||
return;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Should never happen */
|
/* Should never happen */
|
||||||
DPRINTF("%s: invalid write state\n", __func__);
|
DPRINTF("%s: invalid write state\n", __func__);
|
||||||
|
@ -3628,9 +3628,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
|
|||||||
unlock_user(argptr, arg, target_size);
|
unlock_user(argptr, arg, target_size);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
if (big_buf) {
|
g_free(big_buf);
|
||||||
free(big_buf);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ static ssize_t net_socket_receive_dgram(NetClientState *nc, const uint8_t *buf,
|
|||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ret = sendto(s->fd, buf, size, 0,
|
ret = qemu_sendto(s->fd, buf, size, 0,
|
||||||
(struct sockaddr *)&s->dgram_dst,
|
(struct sockaddr *)&s->dgram_dst,
|
||||||
sizeof(s->dgram_dst));
|
sizeof(s->dgram_dst));
|
||||||
} while (ret == -1 && errno == EINTR);
|
} while (ret == -1 && errno == EINTR);
|
||||||
|
@ -360,3 +360,8 @@ int qemu_create_pidfile(const char *filename)
|
|||||||
/* keep pidfile open & locked forever */
|
/* keep pidfile open & locked forever */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_daemonized(void)
|
||||||
|
{
|
||||||
|
return daemonize;
|
||||||
|
}
|
||||||
|
@ -223,9 +223,14 @@ int qemu_pipe(int pipefd[2]);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
/* MinGW needs a type cast for the 'buf' argument. */
|
||||||
#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
|
#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
|
||||||
|
#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
|
||||||
|
sendto(sockfd, (const void *)buf, len, flags, destaddr, addrlen)
|
||||||
#else
|
#else
|
||||||
#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags)
|
#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags)
|
||||||
|
#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
|
||||||
|
sendto(sockfd, buf, len, flags, destaddr, addrlen)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Error handling. */
|
/* Error handling. */
|
||||||
|
@ -114,12 +114,10 @@ static gboolean register_signal_handlers(void)
|
|||||||
ret = sigaction(SIGINT, &sigact, NULL);
|
ret = sigaction(SIGINT, &sigact, NULL);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
g_error("error configuring signal handler: %s", strerror(errno));
|
g_error("error configuring signal handler: %s", strerror(errno));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
ret = sigaction(SIGTERM, &sigact, NULL);
|
ret = sigaction(SIGTERM, &sigact, NULL);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
g_error("error configuring signal handler: %s", strerror(errno));
|
g_error("error configuring signal handler: %s", strerror(errno));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -46,4 +46,6 @@ typedef struct timeval qemu_timeval;
|
|||||||
typedef struct timespec qemu_timespec;
|
typedef struct timespec qemu_timespec;
|
||||||
int qemu_utimens(const char *path, const qemu_timespec *times);
|
int qemu_utimens(const char *path, const qemu_timespec *times);
|
||||||
|
|
||||||
|
bool is_daemonized(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,4 +92,9 @@ typedef struct {
|
|||||||
} qemu_timeval;
|
} qemu_timeval;
|
||||||
int qemu_gettimeofday(qemu_timeval *tp);
|
int qemu_gettimeofday(qemu_timeval *tp);
|
||||||
|
|
||||||
|
static inline bool is_daemonized(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -353,7 +353,7 @@ int inet_dgram_opts(QemuOpts *opts)
|
|||||||
if (0 != (rc = getaddrinfo(addr, port, &ai, &local))) {
|
if (0 != (rc = getaddrinfo(addr, port, &ai, &local))) {
|
||||||
fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port,
|
fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port,
|
||||||
gai_strerror(rc));
|
gai_strerror(rc));
|
||||||
return -1;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create socket */
|
/* create socket */
|
||||||
|
@ -372,21 +372,20 @@ bool qemu_timer_expired(QEMUTimer *timer_head, int64_t current_time)
|
|||||||
|
|
||||||
void qemu_run_timers(QEMUClock *clock)
|
void qemu_run_timers(QEMUClock *clock)
|
||||||
{
|
{
|
||||||
QEMUTimer **ptimer_head, *ts;
|
QEMUTimer *ts;
|
||||||
int64_t current_time;
|
int64_t current_time;
|
||||||
|
|
||||||
if (!clock->enabled)
|
if (!clock->enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current_time = qemu_get_clock_ns(clock);
|
current_time = qemu_get_clock_ns(clock);
|
||||||
ptimer_head = &clock->active_timers;
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
ts = *ptimer_head;
|
ts = clock->active_timers;
|
||||||
if (!qemu_timer_expired_ns(ts, current_time)) {
|
if (!qemu_timer_expired_ns(ts, current_time)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* remove timer from the list before calling the callback */
|
/* remove timer from the list before calling the callback */
|
||||||
*ptimer_head = ts->next;
|
clock->active_timers = ts->next;
|
||||||
ts->next = NULL;
|
ts->next = NULL;
|
||||||
|
|
||||||
/* run the callback (the timer list can be modified) */
|
/* run the callback (the timer list can be modified) */
|
||||||
|
@ -87,7 +87,7 @@ def stap(events):
|
|||||||
if len(e.args) > 0:
|
if len(e.args) > 0:
|
||||||
for name in e.args.names():
|
for name in e.args.names():
|
||||||
# Append underscore to reserved keywords
|
# Append underscore to reserved keywords
|
||||||
if name in ('limit', 'in', 'next', 'self'):
|
if name in ('limit', 'in', 'next', 'self', 'function'):
|
||||||
name += '_'
|
name += '_'
|
||||||
out(' %s = $arg%d;' % (name, i))
|
out(' %s = $arg%d;' % (name, i))
|
||||||
i += 1
|
i += 1
|
||||||
|
@ -1064,7 +1064,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
|
|||||||
{
|
{
|
||||||
X86CPU *cpu = X86_CPU(obj);
|
X86CPU *cpu = X86_CPU(obj);
|
||||||
const int64_t min = 0;
|
const int64_t min = 0;
|
||||||
const int64_t max = INT_MAX;
|
const int64_t max = INT64_MAX;
|
||||||
int64_t value;
|
int64_t value;
|
||||||
|
|
||||||
visit_type_int(v, &value, name, errp);
|
visit_type_int(v, &value, name, errp);
|
||||||
|
2
vl.c
2
vl.c
@ -3657,7 +3657,9 @@ int main(int argc, char **argv, char **envp)
|
|||||||
break;
|
break;
|
||||||
#if defined(CONFIG_CURSES)
|
#if defined(CONFIG_CURSES)
|
||||||
case DT_CURSES:
|
case DT_CURSES:
|
||||||
|
if (!is_daemonized()) {
|
||||||
curses_display_init(ds, full_screen);
|
curses_display_init(ds, full_screen);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_SDL)
|
#if defined(CONFIG_SDL)
|
||||||
|
Loading…
Reference in New Issue
Block a user