static int affinity_write_proc(struct file *file, const char __user * buffer, unsigned long count, void *data) { char *end, buf[16]; unsigned long val; xnarch_cpumask_t new_affinity; int n, cpu; n = count > sizeof(buf) - 1 ? sizeof(buf) - 1 : count; if (copy_from_user(buf, buffer, n)) return -EFAULT; buf[n] = '\0'; val = simple_strtol(buf, &end, 0); if (*end != '\0' && !isspace(*end)) return -EINVAL; xnarch_cpus_clear(new_affinity); for (cpu = 0; cpu < sizeof(val) * 8; cpu++, val >>= 1) if (val & 1) xnarch_cpu_set(cpu, new_affinity); xnarch_cpus_and(nkaffinity, new_affinity, xnarch_supported_cpus); return count; }
static ssize_t affinity_vfile_store(struct xnvfile_input *input) { xnarch_cpumask_t new_affinity; ssize_t ret; long val; int cpu; ret = xnvfile_get_integer(input, &val); if (ret < 0) return ret; xnarch_cpus_clear(new_affinity); for (cpu = 0; cpu < BITS_PER_LONG; cpu++, val >>= 1) if (val & 1) xnarch_cpu_set(cpu, new_affinity); xnarch_cpus_and(nkaffinity, new_affinity, xnarch_supported_cpus); return ret; }
int __init __xeno_sys_init(void) { int ret; xnmod_sysheap_size = module_param_value(sysheap_size_arg) * 1024; ret = xnarch_init(); if (ret) goto fail; #ifndef __XENO_SIM__ ret = xnheap_init_mapped(&__xnsys_global_ppd.sem_heap, CONFIG_XENO_OPT_GLOBAL_SEM_HEAPSZ * 1024, XNARCH_SHARED_HEAP_FLAGS); if (ret) goto cleanup_arch; xnheap_set_label(&__xnsys_global_ppd.sem_heap, "global sem heap"); xnheap_init_vdso(); init_hostrt(); #endif /* !__XENO_SIM__ */ #ifdef __KERNEL__ xnpod_mount(); xnintr_mount(); #ifdef CONFIG_XENO_OPT_PIPE ret = xnpipe_mount(); if (ret) goto cleanup_proc; #endif /* CONFIG_XENO_OPT_PIPE */ #ifdef CONFIG_XENO_OPT_SELECT ret = xnselect_mount(); if (ret) goto cleanup_pipe; #endif /* CONFIG_XENO_OPT_SELECT */ ret = xnshadow_mount(); if (ret) goto cleanup_select; ret = xnheap_mount(); if (ret) goto cleanup_shadow; #endif /* __KERNEL__ */ xntbase_mount(); xnloginfo("real-time nucleus v%s (%s) loaded.\n", XENO_VERSION_STRING, XENO_VERSION_NAME); #ifdef CONFIG_XENO_OPT_DEBUG xnloginfo("debug mode enabled.\n"); #endif initq(&xnmod_glink_queue); xeno_nucleus_status = 0; xnarch_cpus_and(nkaffinity, nkaffinity, xnarch_supported_cpus); return 0; #ifdef __KERNEL__ cleanup_shadow: xnshadow_cleanup(); cleanup_select: #ifdef CONFIG_XENO_OPT_SELECT xnselect_umount(); cleanup_pipe: #endif /* CONFIG_XENO_OPT_SELECT */ #ifdef CONFIG_XENO_OPT_PIPE xnpipe_umount(); cleanup_proc: #endif /* CONFIG_XENO_OPT_PIPE */ xnpod_umount(); cleanup_arch: xnarch_exit(); #endif /* __KERNEL__ */ fail: xnlogerr("system init failed, code %d.\n", ret); xeno_nucleus_status = ret; return ret; }