/* System call handler. */ static void syscall_handler (struct intr_frame *f) { typedef int syscall_function (int, int, int); /* A system call. */ struct syscall { size_t arg_cnt; /* Number of arguments. */ syscall_function *func; /* Implementation. */ }; /* Table of system calls. */ static const struct syscall syscall_table[] = { {0, (syscall_function *) sys_halt}, {1, (syscall_function *) sys_exit}, {1, (syscall_function *) sys_exec}, {1, (syscall_function *) sys_wait}, {2, (syscall_function *) sys_create}, {1, (syscall_function *) sys_remove}, {1, (syscall_function *) sys_open}, {1, (syscall_function *) sys_filesize}, {3, (syscall_function *) sys_read}, {3, (syscall_function *) sys_write}, {2, (syscall_function *) sys_seek}, {1, (syscall_function *) sys_tell}, {1, (syscall_function *) sys_close}, {2, (syscall_function *) sys_mmap}, {1, (syscall_function *) sys_munmap}, {1, (syscall_function *) sys_chdir}, {1, (syscall_function *) sys_mkdir}, {2, (syscall_function *) sys_readdir}, {1, (syscall_function *) sys_isdir}, {1, (syscall_function *) sys_inumber}, }; const struct syscall *sc; unsigned call_nr; int args[3]; /* Get the system call. */ copy_in (&call_nr, f->esp, sizeof call_nr); if (call_nr >= sizeof syscall_table / sizeof *syscall_table) thread_exit (); sc = syscall_table + call_nr; /* Get the system call arguments. */ ASSERT (sc->arg_cnt <= sizeof args / sizeof *args); memset (args, 0, sizeof args); copy_in (args, (uint32_t *) f->esp + 1, sizeof *args * sc->arg_cnt); /* Execute the system call, and set the return value. */ f->eax = sc->func (args[0], args[1], args[2]); }
void copy_in_cb(int pid, seL4_CPtr reply_cap, void *_args, int err) { if (SOS_DEBUG) printf("copy_in_cb\n"); copy_in_args *args = _args; if (err) { eprintf("Error caught in copy_in_cb\n"); args->cb(pid, reply_cap, args->cb_args, err); free(args); return; } //only copy up the end of a user page int to_copy = args->nbyte - args->count; if ((args->usr_ptr & ~PAGE_MASK) + to_copy > PAGE_SIZE) { to_copy = PAGE_SIZE - (args->usr_ptr & ~PAGE_MASK); } //get the actual mapping of the user page seL4_Word src = user_to_kernel_ptr(args->usr_ptr, pid); //copy in the data memcpy((void *) (args->k_ptr + args->count), (void *) src, to_copy); //increment the pointers etc. args->count += to_copy; args->usr_ptr += to_copy; copy_in(pid, reply_cap, args, 0); if (SOS_DEBUG) printf("copy_in_cb ended\n"); }
void PatchPogoHandle::read( XfsErr *err, void *dst, size_t len, uint64_t offset) { FilterVFSHandle::read(err, dst, len, offset); copy_in(dst, offset, len, patch_bytes, patch_offset, POGO_PATCH_SIZE); }
void copy_sim_data2(st_signal * signal, EC_PDO_ENTRY_MAPPING * pdo_entry_mapping, uint8_t * pd, int index) { assert(signal && signal->signalspec); assert(signal->perioddata); assert(signal->signalspec->type != ST_INVALID); int bit_length = signal->signalspec->bit_length; int bytes = (int) ( ( bit_length - 1) / 8 ) + 1; assert( bytes <= 4); if (bytes == 3) bytes = 4; copy_in(bytes, signal->perioddata, signal->index, pd, pdo_entry_mapping->offset + bytes * index, pdo_entry_mapping->bit_position ); }
void c_main(int ac, char **av, char **env) { char *file_to_map = av[1]; void *mapped; void *fptr; struct stat sb; Elf64_Ehdr *junk1 = NULL, *junk2 = NULL; /* print_string(1, "static_dyn_load_run\n"); */ if (0 > linux_stat(file_to_map, &sb)) { error_msg("stat() failed "); linux_exit(1); } mapped = linux_mmap(NULL, sb.st_size, 0x07, 0x22, -1, 0); /* print_address("File mapped in at", mapped); */ if (mapped == (void *)-1) { error_msg("mmap() failed "); linux_exit(1); } copy_in(file_to_map, mapped); fptr = load_elf(mapped, 1, &junk1, &junk2); /* print_address("Entry point at", fptr); */ linux_munmap(mapped, sb.st_size); /* print_address("Y setting stack to ", av - 1); */ SET_STACK(av - 1); JMP_ADDR(fptr); }
void _c_int00() { register uint32_t temp; /* USER CODE BEGIN (5) */ /* USER CODE END */ /* Enable VFP Unit */ _coreEnableVfp_(); /* Initialize Core Registers */ _coreInitRegisters_(); /* USER CODE BEGIN (6) */ /* USER CODE END */ /* read the system exception status register */ temp = systemREG1->SYSESR; /* USER CODE BEGIN (7) */ /* USER CODE END */ /* check for power-on reset condition */ if (temp & 0x8000) { /* clear all reset status flags */ systemREG1->SYSESR = 0xFFFF; /* USER CODE BEGIN (8) */ /* USER CODE END */ /* continue with normal start-up sequence */ } else if (temp & 0x4000) { /* Reset caused due to oscillator failure. Add user code here to handle oscillator failure */ /* USER CODE BEGIN (9) */ /* USER CODE END */ } else if (temp & 0x2000) { /* Reset caused due to windowed watchdog violation. Add user code here to handle watchdog violation */ /* USER CODE BEGIN (10) */ /* USER CODE END */ } else if (temp & 0x20) { /* Reset caused due to CPU reset. CPU reset can be caused by CPU self-test completion, or by toggling the "CPU RESET" bit of the CPU Reset Control Register. Add user code to handle CPU reset: check for selftest completion without any error and continue start-up. */ /* USER CODE BEGIN (11) */ /* USER CODE END */ } else if (temp & 0x10) { /* Reset caused due to software reset. Add user code to handle software reset. */ /* USER CODE BEGIN (12) */ /* USER CODE END */ } else { /* Reset caused by nRST being driven low externally. Add user code to handle external reset. */ /* USER CODE BEGIN (13) */ /* USER CODE END */ } /* Initialize Stack Pointers */ _coreInitStackPointer_(); /* Enable IRQ offset via Vic controller */ _coreEnableIrqVicOffset_(); /* Initialize System */ systemInit(); /* Initialize memory */ // _memoryInit_(); /* Enable CPU Event Export */ /* This allows the CPU to signal any single-bit or double-bit errors detected * by its ECC logic for accesses to program flash or data RAM. */ // _coreEnableEventBusExport_(); /* Enable ECC checking for TCRAM accesses. * This function enables the CPU's ECC logic for accesses to B0TCM and B1TCM. */ // _coreEnableRamEcc_(); /* Initialize VIM table */ { uint32_t i; for (i = 0; i < 90U; i++) { vimRAM->ISR[i] = s_vim_init[i]; } } /* set IRQ/FIQ priorities */ vimREG->FIRQPR0 = SYS_FIQ | (SYS_FIQ << 1U) | (SYS_IRQ << 2U) | (SYS_IRQ << 3U) | (SYS_IRQ << 4U) | (SYS_IRQ << 5U) | (SYS_IRQ << 6U) | (SYS_IRQ << 7U) | (SYS_IRQ << 8U) | (SYS_IRQ << 9U) | (SYS_IRQ << 10U) | (SYS_IRQ << 11U) | (SYS_IRQ << 12U) | (SYS_IRQ << 13U) | (SYS_IRQ << 14U) | (SYS_IRQ << 15U) | (SYS_IRQ << 16U) | (SYS_IRQ << 17U) | (SYS_IRQ << 18U) | (SYS_IRQ << 19U) | (SYS_IRQ << 20U) | (SYS_IRQ << 21U) | (SYS_IRQ << 22U) | (SYS_IRQ << 23U) | (SYS_IRQ << 24U) | (SYS_IRQ << 25U) | (SYS_IRQ << 26U) | (SYS_IRQ << 27U) | (SYS_IRQ << 28U) | (SYS_IRQ << 29U) | (SYS_IRQ << 30U) | (SYS_IRQ << 31U); vimREG->FIRQPR1 = SYS_IRQ | (SYS_IRQ << 1U) | (SYS_IRQ << 2U) | (SYS_IRQ << 3U) | (SYS_IRQ << 4U) | (SYS_IRQ << 5U) | (SYS_IRQ << 6U) | (SYS_IRQ << 7U) | (SYS_IRQ << 8U) | (SYS_IRQ << 9U) | (SYS_IRQ << 10U) | (SYS_IRQ << 11U) | (SYS_IRQ << 12U) | (SYS_IRQ << 13U) | (SYS_IRQ << 14U) | (SYS_IRQ << 15U) | (SYS_IRQ << 16U) | (SYS_IRQ << 17U) | (SYS_IRQ << 18U) | (SYS_IRQ << 19U) | (SYS_IRQ << 20U) | (SYS_IRQ << 21U) | (SYS_IRQ << 22U) | (SYS_IRQ << 23U) | (SYS_IRQ << 24U) | (SYS_IRQ << 25U) | (SYS_IRQ << 26U) | (SYS_IRQ << 27U) | (SYS_IRQ << 28U) | (SYS_IRQ << 29U) | (SYS_IRQ << 30U) | (SYS_IRQ << 31U); vimREG->FIRQPR2 = SYS_IRQ | (SYS_IRQ << 1U) | (SYS_IRQ << 2U) | (SYS_IRQ << 3U) | (SYS_IRQ << 4U) | (SYS_IRQ << 5U) | (SYS_IRQ << 6U) | (SYS_IRQ << 7U) | (SYS_IRQ << 8U) | (SYS_IRQ << 9U) | (SYS_IRQ << 10U) | (SYS_IRQ << 11U) | (SYS_IRQ << 12U) | (SYS_IRQ << 13U) | (SYS_IRQ << 14U) | (SYS_IRQ << 15U) | (SYS_IRQ << 16U) | (SYS_IRQ << 17U) | (SYS_IRQ << 18U) | (SYS_IRQ << 19U) | (SYS_IRQ << 20U) | (SYS_IRQ << 21U) | (SYS_IRQ << 22U) | (SYS_IRQ << 23U) | (SYS_IRQ << 24U) | (SYS_IRQ << 25U); /* enable interrupts */ vimREG->REQMASKSET0 = 1U | (1U << 1U) | (0U << 2U) | (0U << 3U) | (0U << 4U) | (0U << 5U) | (0U << 6U) | (0U << 7U) | (0U << 8U) | (0U << 9U) | (0U << 10U) | (0U << 11U) | (0U << 12U) | (0U << 13U) | (0U << 14U) | (0U << 15U) | (0U << 16U) | (0U << 17U) | (0U << 18U) | (0U << 19U) | (0U << 20U) | (0U << 21U) | (0U << 22U) | (0U << 23U) | (0U << 24U) | (0U << 25U) | (0U << 26U) | (0U << 27U) | (0U << 28U) | (0U << 29U) | (0U << 30U) | (0U << 31U); vimREG->REQMASKSET1 = 0U | (0U << 1U) | (0U << 2U) | (0U << 3U) | (0U << 4U) | (0U << 5U) | (0U << 6U) | (0U << 7U) | (0U << 8U) | (0U << 9U) | (0U << 10U) | (0U << 11U) | (0U << 12U) | (0U << 13U) | (0U << 14U) | (0U << 15U) | (0U << 16U) | (0U << 17U) | (0U << 18U) | (0U << 19U) | (0U << 20U) | (0U << 21U) | (0U << 22U) | (0U << 23U) | (0U << 24U) | (0U << 25U) | (0U << 26U) | (0U << 27U) | (0U << 28U) | (0U << 29U) | (0U << 30U) | (0U << 31U); vimREG->REQMASKSET2 = 0U | (0U << 1U) | (0U << 2U) | (0U << 3U) | (0U << 4U) | (0U << 5U) | (0U << 6U) | (0U << 7U) | (0U << 8U) | (0U << 9U) | (0U << 10U) | (0U << 11U) | (0U << 12U) | (0U << 13U) | (0U << 14U) | (0U << 15U) | (0U << 16U) | (0U << 17U) | (0U << 18U) | (0U << 19U) | (0U << 20U) | (0U << 21U) | (0U << 22U) | (0U << 23U) | (0U << 24U) | (0U << 25U); /* initalise copy table */ if ((uint32_t *)&__binit__ != (uint32_t *)0xFFFFFFFFU) { extern void copy_in(void *binit); copy_in((void *)&__binit__); } /* initalise the C global variables */ if (&__TI_Handler_Table_Base < &__TI_Handler_Table_Limit) { uint8_t **tablePtr = (uint8_t **)&__TI_CINIT_Base; uint8_t **tableLimit = (uint8_t **)&__TI_CINIT_Limit; while (tablePtr < tableLimit) { uint8_t *loadAdr = *tablePtr++; uint8_t *runAdr = *tablePtr++; uint8_t idx = *loadAdr++; handler_fptr handler = (handler_fptr)(&__TI_Handler_Table_Base)[idx]; (*handler)((const uint8_t *)loadAdr, runAdr); } } /* initalise contructors */ if (__TI_PINIT_Base < __TI_PINIT_Limit) { void (**p0)() = (void *)__TI_PINIT_Base; while ((uint32_t)p0 < __TI_PINIT_Limit) { void (*p)() = *p0++; p(); } } /* USER CODE BEGIN (14) */ /* USER CODE END */ /* configure muxed pins */ muxInit(); /* call the application */ main(); exit(); }
vector_fixed(T * data) { copy_in(data); }
arlCore::vnl_covariance_matrix& arlCore::vnl_covariance_matrix::operator=( const arlCore::vnl_covariance_matrix& rv ) { copy_in(rv); return *this; }
arlCore::vnl_covariance_matrix::vnl_covariance_matrix( const vnl_covariance_matrix& rv ) { copy_in(rv); }