Lines Matching +full:cs +full:- +full:setup

23 #include "signal-common.h"
32 env->cr[0] = CR0_PG_MASK | CR0_WP_MASK | CR0_PE_MASK; in target_cpu_init()
33 env->hflags |= HF_PE_MASK | HF_CPL_MASK; in target_cpu_init()
34 if (env->features[FEAT_1_EDX] & CPUID_SSE) { in target_cpu_init()
35 env->cr[4] |= CR4_OSFXSR_MASK; in target_cpu_init()
36 env->hflags |= HF_OSFXSR_MASK; in target_cpu_init()
40 if (!(env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM)) { in target_cpu_init()
44 env->cr[4] |= CR4_PAE_MASK; in target_cpu_init()
45 env->efer |= MSR_EFER_LMA | MSR_EFER_LME; in target_cpu_init()
46 env->hflags |= HF_LMA_MASK; in target_cpu_init()
48 /* flags setup : we activate the IRQs by default as in user mode */ in target_cpu_init()
49 env->eflags |= IF_MASK; in target_cpu_init()
51 /* register setup */ in target_cpu_init()
52 env->regs[R_EAX] = regs->rax; in target_cpu_init()
53 env->regs[R_EBX] = regs->rbx; in target_cpu_init()
54 env->regs[R_ECX] = regs->rcx; in target_cpu_init()
55 env->regs[R_EDX] = regs->rdx; in target_cpu_init()
56 env->regs[R_ESI] = regs->rsi; in target_cpu_init()
57 env->regs[R_EDI] = regs->rdi; in target_cpu_init()
58 env->regs[R_EBP] = regs->rbp; in target_cpu_init()
59 env->regs[R_ESP] = regs->rsp; in target_cpu_init()
60 env->eip = regs->rip; in target_cpu_init()
62 /* interrupt setup */ in target_cpu_init()
63 env->idt.limit = 511; in target_cpu_init()
65 env->idt.base = target_mmap(0, sizeof(uint64_t) * (env->idt.limit + 1), in target_cpu_init()
66 PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); in target_cpu_init()
67 bsd_x86_64_set_idt_base(env->idt.base); in target_cpu_init()
90 /* segment setup */ in target_cpu_init()
91 env->gdt.base = target_mmap(0, sizeof(uint64_t) * TARGET_GDT_ENTRIES, in target_cpu_init()
92 PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); in target_cpu_init()
93 env->gdt.limit = sizeof(uint64_t) * TARGET_GDT_ENTRIES - 1; in target_cpu_init()
94 gdt_table = g2h_untagged(env->gdt.base); in target_cpu_init()
115 CPUState *cs = env_cpu(env); in target_cpu_loop() local
121 cpu_exec_start(cs); in target_cpu_loop()
122 trapnr = cpu_exec(cs); in target_cpu_loop()
123 cpu_exec_end(cs); in target_cpu_loop()
124 process_queued_cpu_work(cs); in target_cpu_loop()
129 env->regs[R_EAX] = do_freebsd_syscall(env, in target_cpu_loop()
130 env->regs[R_EAX], in target_cpu_loop()
131 env->regs[R_EDI], in target_cpu_loop()
132 env->regs[R_ESI], in target_cpu_loop()
133 env->regs[R_EDX], in target_cpu_loop()
134 env->regs[R_ECX], in target_cpu_loop()
135 env->regs[8], in target_cpu_loop()
136 env->regs[9], 0, 0); in target_cpu_loop()
137 env->eip = env->exception_next_eip; in target_cpu_loop()
138 if (((abi_ulong)env->regs[R_EAX]) >= (abi_ulong)(-515)) { in target_cpu_loop()
139 env->regs[R_EAX] = -env->regs[R_EAX]; in target_cpu_loop()
140 env->eflags |= CC_C; in target_cpu_loop()
142 env->eflags &= ~CC_C; in target_cpu_loop()
151 cpu_exec_step_atomic(cs); in target_cpu_loop()
155 pc = env->segs[R_CS].base + env->eip; in target_cpu_loop()
156 fprintf(stderr, "qemu: 0x%08lx: unhandled CPU exception 0x%x - " in target_cpu_loop()
167 env->regs[R_ESP] = newsp; in target_cpu_clone_regs()
169 env->regs[R_EAX] = 0; in target_cpu_clone_regs()