type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
functions | uint64_t ram_bytes_remaining(void)
{
return ram_save_remaining() * TARGET_PAGE_SIZE;
} |
functions | uint64_t ram_bytes_transferred(void)
{
return bytes_transferred;
} |
functions | uint64_t ram_bytes_total(void)
{
return last_ram_offset;
} |
functions | int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
{
ram_addr_t addr;
uint64_t bytes_transferred_last;
double bwidth = 0;
uint64_t expected_time = 0;
if (stage < 0) {
cpu_physical_memory_set_dirty_tracking(0);
return 0;
} |
functions | int ram_load(QEMUFile *f, void *opaque, int version_id)
{
ram_addr_t addr;
int flags;
if (version_id != 3)
return -EINVAL;
do {
addr = qemu_get_be64(f);
flags = addr & ~TARGET_PAGE_MASK;
addr &= TARGET_PAGE_MASK;
if (flags & RAM_SAVE_FLAG_MEM_SIZE) {
... |
functions | else if (flags & RAM_SAVE_FLAG_PAGE) {
qemu_get_buffer(f, qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE);
} |
functions | void qemu_service_io(void)
{
qemu_notify_event();
} |
functions | int qemu_register_machine(QEMUMachine *m)
{
QEMUMachine **pm;
pm = &first_machine;
while (*pm != NULL)
pm = &(*pm)->next;
m->next = NULL;
*pm = m;
return 0;
} |
functions | void gui_update(void *opaque)
{
uint64_t interval = GUI_REFRESH_INTERVAL;
DisplayState *ds = opaque;
DisplayChangeListener *dcl = ds->listeners;
dpy_refresh(ds);
while (dcl != NULL) {
if (dcl->gui_timer_interval &&
dcl->gui_timer_interval < interval)
interval = dcl-... |
functions | void nographic_update(void *opaque)
{
uint64_t interval = GUI_REFRESH_INTERVAL;
qemu_mod_timer(nographic_timer, interval + qemu_get_clock(rt_clock));
} |
functions | void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
{
QLIST_REMOVE (e, entries);
qemu_free (e);
} |
functions | void vm_state_notify(int running, int reason)
{
VMChangeStateEntry *e;
for (e = vm_change_state_head.lh_first; e; e = e->entries.le_next) {
e->cb(e->opaque, running, reason);
} |
functions | void vm_start(void)
{
if (!vm_running) {
cpu_enable_ticks();
vm_running = 1;
vm_state_notify(1, 0);
qemu_rearm_alarm_timer(alarm_timer);
resume_all_vcpus();
} |
functions | int qemu_shutdown_requested(void)
{
int r = shutdown_requested;
shutdown_requested = 0;
return r;
} |
functions | int qemu_reset_requested(void)
{
int r = reset_requested;
reset_requested = 0;
return r;
} |
functions | int qemu_powerdown_requested(void)
{
int r = powerdown_requested;
powerdown_requested = 0;
return r;
} |
functions | void do_vm_stop(int reason)
{
if (vm_running) {
cpu_disable_ticks();
vm_running = 0;
pause_all_vcpus();
vm_state_notify(0, reason);
} |
functions | void qemu_register_reset(QEMUResetHandler *func, void *opaque)
{
QEMUResetEntry *re = qemu_mallocz(sizeof(QEMUResetEntry));
re->func = func;
re->opaque = opaque;
QTAILQ_INSERT_TAIL(&reset_handlers, re, entry);
} |
functions | void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
{
QEMUResetEntry *re;
QTAILQ_FOREACH(re, &reset_handlers, entry) {
if (re->func == func && re->opaque == opaque) {
QTAILQ_REMOVE(&reset_handlers, re, entry);
qemu_free(re);
return;
} |
functions | void qemu_system_reset(void)
{
QEMUResetEntry *re, *nre;
/* reset all devices */
QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
re->func(re->opaque);
} |
functions | void qemu_system_reset_request(void)
{
if (no_reboot) {
shutdown_requested = 1;
} |
functions | void qemu_system_shutdown_request(void)
{
shutdown_requested = 1;
qemu_notify_event();
} |
functions | void qemu_system_powerdown_request(void)
{
powerdown_requested = 1;
qemu_notify_event();
} |
functions | void qemu_system_vmstop_request(int reason)
{
vmstop_requested = reason;
qemu_notify_event();
} |
functions | void qemu_event_increment(void)
{
static const char byte = 0;
if (io_thread_fd == -1)
return;
write(io_thread_fd, &byte, sizeof(byte));
} |
functions | void qemu_event_read(void *opaque)
{
int fd = (unsigned long)opaque;
ssize_t len;
/* Drain the notify pipe */
do {
char buffer[512];
len = read(fd, buffer, sizeof(buffer));
} |
functions | int qemu_event_init(void)
{
int err;
int fds[2];
err = qemu_pipe(fds);
if (err == -1)
return -errno;
err = fcntl_setfl(fds[0], O_NONBLOCK);
if (err < 0)
goto fail;
err = fcntl_setfl(fds[1], O_NONBLOCK);
if (err < 0)
goto fail;
qemu_set_fd_handler2(fds[0], ... |
functions | void dummy_event_handler(void *opaque)
{
} |
functions | int qemu_event_init(void)
{
qemu_event_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
if (!qemu_event_handle) {
fprintf(stderr, "Failed CreateEvent: %ld\n", GetLastError());
return -1;
} |
functions | void qemu_event_increment(void)
{
if (!SetEvent(qemu_event_handle)) {
fprintf(stderr, "qemu_event_increment: SetEvent failed: %ld\n",
GetLastError());
exit (1);
} |
functions | int qemu_init_main_loop(void)
{
return qemu_event_init();
} |
functions | void qemu_init_vcpu(void *_env)
{
CPUState *env = _env;
env->nr_cores = smp_cores;
env->nr_threads = smp_threads;
if (kvm_enabled())
kvm_init_vcpu(env);
return;
} |
functions | int qemu_cpu_self(void *env)
{
return 1;
} |
functions | void resume_all_vcpus(void)
{
} |
functions | void pause_all_vcpus(void)
{
} |
functions | void qemu_cpu_kick(void *env)
{
return;
} |
functions | void qemu_notify_event(void)
{
CPUState *env = cpu_single_env;
if (env) {
cpu_exit(env);
} |
functions | void qemu_mutex_lock_iothread(void) {} |
functions | void qemu_mutex_unlock_iothread(void) {} |
functions | void vm_stop(int reason)
{
do_vm_stop(reason);
} |
functions | int qemu_init_main_loop(void)
{
int ret;
ret = qemu_event_init();
if (ret)
return ret;
qemu_cond_init(&qemu_pause_cond);
qemu_mutex_init(&qemu_fair_mutex);
qemu_mutex_init(&qemu_global_mutex);
qemu_mutex_lock(&qemu_global_mutex);
unblock_io_signals();
qemu_thread_self(&io_... |
functions | void qemu_wait_io_event(CPUState *env)
{
while (!tcg_has_work())
qemu_cond_timedwait(env->halt_cond, &qemu_global_mutex, 1000);
qemu_mutex_unlock(&qemu_global_mutex);
/*
* Users of qemu_global_mutex can be starved, having no chance
* to acquire it since this path will get to it first.
... |
functions | void qemu_cpu_kick(void *_env)
{
CPUState *env = _env;
qemu_cond_broadcast(env->halt_cond);
if (kvm_enabled())
qemu_thread_signal(env->thread, SIGUSR1);
} |
functions | int qemu_cpu_self(void *_env)
{
CPUState *env = _env;
QemuThread this;
qemu_thread_self(&this);
return qemu_thread_equal(&this, env->thread);
} |
functions | void cpu_signal(int sig)
{
if (cpu_single_env)
cpu_exit(cpu_single_env);
} |
functions | void block_io_signals(void)
{
sigset_t set;
struct sigaction sigact;
sigemptyset(&set);
sigaddset(&set, SIGUSR2);
sigaddset(&set, SIGIO);
sigaddset(&set, SIGALRM);
pthread_sigmask(SIG_BLOCK, &set, NULL);
sigemptyset(&set);
sigaddset(&set, SIGUSR1);
pthread_sigmask(SIG_UNBLOCK, ... |
functions | void unblock_io_signals(void)
{
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGUSR2);
sigaddset(&set, SIGIO);
sigaddset(&set, SIGALRM);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
sigemptyset(&set);
sigaddset(&set, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &set, NULL);
} |
functions | void qemu_signal_lock(unsigned int msecs)
{
qemu_mutex_lock(&qemu_fair_mutex);
while (qemu_mutex_trylock(&qemu_global_mutex)) {
qemu_thread_signal(tcg_cpu_thread, SIGUSR1);
if (!qemu_mutex_timedlock(&qemu_global_mutex, msecs))
break;
} |
functions | void qemu_mutex_lock_iothread(void)
{
if (kvm_enabled()) {
qemu_mutex_lock(&qemu_fair_mutex);
qemu_mutex_lock(&qemu_global_mutex);
qemu_mutex_unlock(&qemu_fair_mutex);
} |
functions | void qemu_mutex_unlock_iothread(void)
{
qemu_mutex_unlock(&qemu_global_mutex);
} |
functions | int all_vcpus_paused(void)
{
CPUState *penv = first_cpu;
while (penv) {
if (!penv->stopped)
return 0;
penv = (CPUState *)penv->next_cpu;
} |
functions | void pause_all_vcpus(void)
{
CPUState *penv = first_cpu;
while (penv) {
penv->stop = 1;
qemu_thread_signal(penv->thread, SIGUSR1);
qemu_cpu_kick(penv);
penv = (CPUState *)penv->next_cpu;
} |
functions | void resume_all_vcpus(void)
{
CPUState *penv = first_cpu;
while (penv) {
penv->stop = 0;
penv->stopped = 0;
qemu_thread_signal(penv->thread, SIGUSR1);
qemu_cpu_kick(penv);
penv = (CPUState *)penv->next_cpu;
} |
functions | void tcg_init_vcpu(void *_env)
{
CPUState *env = _env;
/* share a single thread for all cpus with TCG */
if (!tcg_cpu_thread) {
env->thread = qemu_mallocz(sizeof(QemuThread));
env->halt_cond = qemu_mallocz(sizeof(QemuCond));
qemu_cond_init(env->halt_cond);
qemu_thread_create(... |
functions | void kvm_start_vcpu(CPUState *env)
{
env->thread = qemu_mallocz(sizeof(QemuThread));
env->halt_cond = qemu_mallocz(sizeof(QemuCond));
qemu_cond_init(env->halt_cond);
qemu_thread_create(env->thread, kvm_cpu_thread_fn, env);
while (env->created == 0)
qemu_cond_timedwait(&qemu_cpu_cond, &qemu_g... |
functions | void qemu_init_vcpu(void *_env)
{
CPUState *env = _env;
env->nr_cores = smp_cores;
env->nr_threads = smp_threads;
if (kvm_enabled())
kvm_start_vcpu(env);
else
tcg_init_vcpu(env);
} |
functions | void qemu_notify_event(void)
{
qemu_event_increment();
} |
functions | void vm_stop(int reason)
{
QemuThread me;
qemu_thread_self(&me);
if (!qemu_thread_equal(&me, &io_thread)) {
qemu_system_vmstop_request(reason);
/*
* FIXME: should not return to device code in case
* vm_stop() has been requested.
*/
if (cpu_single_env) {
... |
functions | int qemu_cpu_exec(CPUState *env)
{
int ret;
#ifdef CONFIG_PROFILER
int64_t ti;
#endif
#ifdef CONFIG_PROFILER
ti = profile_getclock();
#endif
if (use_icount) {
int64_t count;
int decr;
qemu_icount -= (env->icount_decr.u16.low + env->icount_extra);
env->icount_decr.u16.low... |
functions | endif
if (use_icount) {
/* Fold pending instructions back into the
instruction counter, and clear the interrupt flag. */
qemu_icount -= (env->icount_decr.u16.low
+ env->icount_extra);
env->icount_decr.u32 = 0;
env->icount_extra = 0;
} |
functions | int cpu_has_work(CPUState *env)
{
if (env->stop)
return 1;
if (env->stopped)
return 0;
if (!env->halted)
return 1;
if (qemu_cpu_has_work(env))
return 1;
return 0;
} |
functions | int tcg_has_work(void)
{
CPUState *env;
for (env = first_cpu; env != NULL; env = env->next_cpu)
if (cpu_has_work(env))
return 1;
return 0;
} |
functions | int qemu_uuid_parse(const char *str, uint8_t *uuid)
{
int ret;
if(strlen(str) != 36)
return -1;
ret = sscanf(str, UUID_FMT, &uuid[0], &uuid[1], &uuid[2], &uuid[3],
&uuid[4], &uuid[5], &uuid[6], &uuid[7], &uuid[8], &uuid[9],
&uuid[10], &uuid[11], &uuid[12], &uuid[13], &uuid[... |
functions | void function_hook_table_add ( unsigned long virtual_address, uint32_t argcount, int handler_address, char * args_type )
{
function_hook *tmp_list = NULL;
uint32_t i;
function_hook *nodo = malloc ( sizeof ( function_hook ) );
nodo->virtual_address = virtual_address;
nodo->argcount = argcount;... |
functions | void register_function_hook_handler( target_ulong virtual_address , uint32_t argcount , unsigned long handler_address, int ret_type, ... )
{
va_list ap;
char *args_type;
int i;
//printf ( " register_function_hook_handler: virtual_address = %p \n", virtual_address );
//revase_code ( INTERRUPT_FUNCTI... |
functions | void int_89_handler( CPUState *env ){
function_hook * handler_data = function_hook_table_find( env->eip );
target_ulong tmp_eip;
unsigned long ret_value;
int i;
unsigned long arg;
int len_argcount = ( handler_data->argcount ) * 4;
/*printf ( " EN int_89_handler \n" );
fflush ( stdout... |
functions | char process_trap(int trapnr, CPUState *env)
{
int retv = 0;
if ( trapnr == INT_89 ) {
int_89_handler ( env );
return 1;
} |
functions | void cpu_loop(CPUState *env){
int trapnr;
unsigned long pc;
unsigned char retv=1;
int contador = 0;
/*if retv = 1, break the loop. retv is a value returned from python or 0*/
while (retv) {
//printf ( "antes de cpu_x86_exec\n" );
trapnr = cpu_x86_exec(env);
//printf ("eip... |
functions | void set_segment_address(CPUState *env, int seg, unsigned long address){
env->segs[seg].base = address;
} |
functions | void set_segment_limit(CPUState *env, int seg, unsigned long address){
env->segs[seg].limit = address;
} |
functions | void allocate_memory(unsigned long offset, unsigned long size){
//if you allocate the same offset two times, this not work. please solve this
//printf ( "allocating memory: offset = %p\n", offset );
ram_addr = qemu_ram_alloc(size);
//printf ( " ram_addr = %d ", ram_addr );
cpu_register_physical_memo... |
functions | void real_addr ( target_phys_addr_t addr )
{
int l;
uint8_t *ptr;
target_phys_addr_t page;
unsigned long pd;
PhysPageDesc *p;
unsigned long addr1;
page = addr & TARGET_PAGE_MASK;
p = phys_page_find(page >> TARGET_PAGE_BITS);
pd = p->phys_offset;
addr1 = (pd & TARGET_PAGE_MASK) +... |
functions | int run(CPUState *env)
{
initial_pc = env->segs[R_CS].base + env->eip;
//copy_egg( addr, egg, len );
cpu_loop(env);
return 0;
} |
functions | void write_memory( const char *buffer , target_ulong addr , unsigned int len )
{
cpu_physical_memory_write_rom( addr , buffer , len );
} |
functions | void end_vm ( CPUState *env ){
qemu_mutex_unlock_iothread();
cpu_exit( env );
//cpu_reset ( env );
//cpu_x86_close ( env );
cpu_x86_close ( first_cpu );
first_cpu = NULL;
//qemu_ram_free ( ram_addr ); /*not implemented. (memory leaks)*/
qemu_ram_free_all ( env );
last_ram_offset = 0... |
functions | int main(int argc, char **argv, char **envp)
{
} |
main | int main(int argc, char **argv)
{
return qemu_main(argc, argv, NULL);
} |
includes |
#include <linux/interrupt.h> |
includes | #include <linux/oom.h> |
includes | #include <linux/suspend.h> |
includes | #include <linux/module.h> |
includes | #include <linux/syscalls.h> |
includes | #include <linux/freezer.h> |
includes | #include <linux/delay.h> |
includes | #include <linux/workqueue.h> |
includes | #include <linux/kmod.h> |
includes | #include <linux/wakelock.h> |
defines | #define TIMEOUT (20 * HZ) |
functions | int try_to_freeze_tasks(bool user_only)
{
struct task_struct *g, *p;
unsigned long end_time;
unsigned int todo;
bool wq_busy = false;
struct timeval start, end;
u64 elapsed_csecs64;
unsigned int elapsed_csecs;
bool wakeup = false;
do_gettimeofday(&start);
end_time = jiffies + TIMEOUT;
if (!user_only)
fr... |
functions | int freeze_processes(void)
{
int error;
//
#if defined(CONFIG_MACH_LGE_FX3_VZW)
error = suspend_sys_sync_wait();
if (error)
return error;
#endif
// ... |
functions | int freeze_kernel_threads(void)
{
int error;
#if !defined(CONFIG_MACH_LGE_FX3_VZW)
error = suspend_sys_sync_wait();
if (error)
return error;
#endif
printk("Freezing remaining freezable tasks ... ");
pm_nosig_freezing = true;
error = try_to_freeze_tasks(false);
if (!error)
printk("done.");
printk("\n");
... |
functions | void thaw_processes(void)
{
struct task_struct *g, *p;
if (pm_freezing)
atomic_dec(&system_freezing_cnt);
pm_freezing = false;
pm_nosig_freezing = false;
oom_killer_enable();
printk("Restarting tasks ... ");
thaw_workqueues();
read_lock(&tasklist_lock);
do_each_thread(g, p) {
__thaw_task(p);
} |
functions | void thaw_kernel_threads(void)
{
struct task_struct *g, *p;
pm_nosig_freezing = false;
printk("Restarting kernel threads ... ");
thaw_workqueues();
read_lock(&tasklist_lock);
do_each_thread(g, p) {
if (p->flags & (PF_KTHREAD | PF_WQ_WORKER))
__thaw_task(p);
} |
includes | #include <stddef.h> |
includes | #include <stdbool.h> |
includes | #include <string.h> |
defines | #define MOVE_ELEM(member) \ |
defines |
#define MOVE_STAILQ(member) \ |
defines |
#define MOVE_ADDRESSLIST(member) \ |
defines |
#define MOVE_BUFFER(member) \ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.