static void handle_syscall(struct hw_trapframe *state) { uintptr_t a0 = state->gpr[GPR_A0]; uintptr_t a1 = state->gpr[GPR_A1]; advance_pc(state); set_current_ctx_hw(&per_cpu_info[core_id()], state); enable_irq(); prep_syscalls(current, (struct syscall*)a0, a1); }
void ft_add(t_vm *data, t_proc *process) { if (is_reg(process, 0) && is_reg(process, 1) && is_reg(process, 2)) { if (verbose_operations(data)) ft_printf("P %4d | add r%d r%d r%d\n", ID, MEMORY(PC + 2), MEMORY(PC + 3), MEMORY(PC + 4)); REG(2) = REG(0) + REG(1); process->carry = (REG(2)) ? 0 : 1; } advance_pc(data, process); }
// some operand forms adbance the PC, void Skip() { uint16_t instruction = m[pc++]; uint16_t dest, src; uint8_t opcode = get_opcode(instruction); pc += advance_pc(get_operand(instruction, 1)); if (opcode == NON_BASIC) { } }
static void handle_illegal_instruction(struct hw_trapframe *state) { assert(!in_kernel(state)); struct per_cpu_info *pcpui = &per_cpu_info[core_id()]; set_current_ctx_hw(pcpui, state); if (emulate_fpu(state) == 0) { advance_pc(&pcpui->cur_ctx->tf.hw_tf); return; } unhandled_trap(state, "Illegal Instruction"); }
static void handle_breakpoint(struct hw_trapframe *state) { advance_pc(state); monitor(state); }