passwd_myos* myos_user_getID(int id){
	int ret=syscall2(69,id,(uint32_t)&myos_pass);
	if (ret!=0)
		return &myos_pass;
	else
		return NULL;
}
Пример #2
0
Файл: ipc.c Проект: csko/yaosp
int register_named_ipc_port( const char* name, ipc_port_id port_id ) {
    return syscall2(
        SYS_register_named_ipc_port,
        ( int )name,
        port_id
    );
}
Пример #3
0
errval_t sys_debug_hardware_timer_read(uintptr_t* v)
{
    struct sysret sr
        = syscall2(SYSCALL_DEBUG, DEBUG_HARDWARE_TIMER_READ);
    *v = sr.value;
    return sr.error;
}
passwd_myos* myos_user_getN(const char* name){
	int ret=syscall2(68,(uint32_t)name,(uint32_t)&myos_pass);
	if (ret!=0)
		return &myos_pass;
	else
		return NULL;
}
Пример #5
0
static int PCILx_Init(LIBBASETYPEPTR LIBBASE)
{
    APTR KernelBase;
    STRPTR arch;
    int ret;

    D(bug("LinuxPCI: Initializing\n"));

    KernelBase = OpenResource("kernel.resource");
    if (!KernelBase)
    	return FALSE;

    /* Make sure we are running on Linux. Otherwise we will just
       crash at first syscall. */
    arch = (STRPTR)KrnGetSystemAttr(KATTR_Architecture);
    if (strncmp(arch, "linux", 5))
    {
    	D(bug("LinuxPCI: Running on %s, not on Linux\n", arch));
    	return FALSE;
    }

    ret = syscall1(__NR_iopl, 3);
    D(bug("LinuxPCI: iopl(3)=%d\n", ret));

    LIBBASE->psd.fd = syscall2(__NR_open, (IPTR)"/dev/mem", 2);
    D(bug("LinuxPCI: /dev/mem fd=%d\n", LIBBASE->psd.fd));

    if (ret==0)
	return TRUE;

    D(bug("LinuxPCI: has to be root in order to use this hidd\n"));

    return FALSE;
}
Пример #6
0
Файл: ipc.c Проект: csko/yaosp
int get_named_ipc_port( const char* name, ipc_port_id* port_id ) {
    return syscall2(
        SYS_get_named_ipc_port,
        ( int )name,
        ( int )port_id
    );
}
Пример #7
0
Файл: sleep.c Проект: csko/yaosp
unsigned int sleep( unsigned int seconds ) {
    uint64_t time;

    time = seconds * 1000000;

    syscall2( SYS_sleep_thread, ( int )&time, ( int )NULL );

    return 0;
}
Пример #8
0
errval_t sys_debug_hardware_global_timer_read(uint64_t *ret)
{
    struct sysret sr;

    uint32_t l, h;

    do {
        h = syscall2(SYSCALL_DEBUG, DEBUG_HARDWARE_GLOBAL_TIMER_HIGH).value;
        l = syscall2(SYSCALL_DEBUG, DEBUG_HARDWARE_GLOBAL_TIMER_LOW).value;
        // read high again, in case it changed
        sr = syscall2(SYSCALL_DEBUG, DEBUG_HARDWARE_GLOBAL_TIMER_HIGH);
    } while(h != sr.value && err_is_ok(sr.error));

    if(err_is_ok(sr.error) && ret) {
        *ret = (((uint64_t) h) << 32) | ((uint32_t) l);
    }

    return sr.error;
}
Пример #9
0
static uint32_t sys_getcwd(uint32_t arg[])
{
	char *buf = (char *)arg[0];
	size_t len = (size_t) arg[1];
	/* See the comment of 'host_map_user' in arch/um/kernel/host_syscall.c for details. */
	if (host_map_user(current, (uintptr_t) buf, len, 1) < 0)
		return -1;

	int ret = sysfile_getcwd(buf, len);
	syscall2(__NR_munmap, (uintptr_t) buf, len);
	return ret;
}
Пример #10
0
Файл: fstat.c Проект: csko/yaosp
int fstat( int fd, struct stat* stat ) {
    int error;

    error = syscall2( SYS_fstat, fd, ( int )stat );

    if ( error < 0 ) {
        errno = -error;
        return -1;
    }

    return 0;
}
int dup2( int old_fd, int new_fd ) {
    int error;

    error = syscall2( SYS_dup2, old_fd, new_fd );

    if ( error < 0 ) {
        errno = -error;
        return -1;
    }

    return error;
}
int access( const char* pathname, int mode ) {
    int error;

    error = syscall2(
        SYS_access,
        ( int )pathname,
        mode
    );

    if ( error < 0 ) {
        errno = -error;
        return -1;
    }

    return 0;
}
Пример #13
0
mapid_t
mmap (int fd, void *addr)
{
  return syscall2 (SYS_MMAP, fd, addr);
}
Пример #14
0
int munmap(void *addr, size_t len)
{
	return (int)syscall2(__NR_munmap, (unsigned long)addr, (unsigned long)len);
}
Пример #15
0
void
seek (int fd, unsigned position) 
{
  syscall2 (SYS_SEEK, fd, position);
}
Пример #16
0
errval_t sys_debug_get_apic_ticks_per_sec(uint32_t *ret)
{
    struct sysret sr = syscall2(SYSCALL_DEBUG, DEBUG_GET_APIC_TICKS_PER_SEC);
    *ret = sr.value;
    return sr.error;
}
Пример #17
0
errval_t sys_debug_flush_cache(void)
{
    return syscall2(SYSCALL_DEBUG, DEBUG_FLUSH_CACHE).error;
}
Пример #18
0
errval_t sys_debug_get_apic_id(uint8_t *ret)
{
    struct sysret sr = syscall2(SYSCALL_DEBUG, DEBUG_GET_APIC_ID);
    *ret = sr.value;
    return sr.error;
}
Пример #19
0
errval_t sys_debug_get_apic_timer(uint32_t *ret)
{
    struct sysret sr = syscall2(SYSCALL_DEBUG, DEBUG_GET_APIC_TIMER);
    *ret = sr.value;
    return sr.error;
}
Пример #20
0
errval_t sys_debug_timeslice_counter_read(uint64_t *ret)
{
    struct sysret sr = syscall2(SYSCALL_DEBUG, DEBUG_TIMESLICE_COUNTER_READ);
    *ret = sr.value;
    return sr.error;
}
Пример #21
0
errval_t sys_debug_get_tsc_per_ms(uint64_t *ret)
{
    struct sysret sr = syscall2(SYSCALL_DEBUG, DEBUG_GET_TSC_PER_MS);
    *ret = sr.value;
    return sr.error;
}
Пример #22
0
errval_t sys_debug_context_counter_reset(void)
{
    return syscall2(SYSCALL_DEBUG, DEBUG_CONTEXT_COUNTER_RESET).error;
}
Пример #23
0
errval_t sys_debug_context_counter_read(uint64_t *ret)
{
    struct sysret sr = syscall2(SYSCALL_DEBUG, DEBUG_CONTEXT_COUNTER_READ);
    *ret = sr.value;
    return sr.error;
}
Пример #24
0
Файл: crt0.c Проект: ALoay94/os
int getatt(int req, char *buf)
{
	syscall2(13, req, buf);
}
Пример #25
0
int open(char* name, char* buf)
{
    syscall2(SYS_OPEN, name, buf);
}
Пример #26
0
bool
readdir (int fd, char name[READDIR_MAX_LEN + 1]) 
{
  return syscall2 (SYS_READDIR, fd, name);
}
Пример #27
0
int uthread_join(int th_id, int* th_status)
{
	return syscall2 (SYS_UTHREAD_JOIN, th_id, th_status);
}
Пример #28
0
/*
 * Added by Adrian Colesa - multithreading
 */
int uthread_create(THREAD_FUNC th_fc, int* fc_arg)
{
	return syscall2 (SYS_UTHREAD_CREATE, th_fc, fc_arg);
}
Пример #29
0
bool
create (const char *file, unsigned initial_size)
{
  return syscall2 (SYS_CREATE, file, initial_size);
}
Пример #30
0
/**
 * Remap the specified address to a new page with new permission.
 * @param pgdir   page directory
 * @param la      linear address
 */
void
tlb_update (pde_t *pgdir, uintptr_t la)
{
    la = ROUNDDOWN (la, PGSIZE);
    pte_t* pte = get_pte (pgdir, la, 0);
    if (pte == 0 || (*pte & PTE_P) == 0)
        panic ("invalid tlb flushing\n");
    uint32_t pa = PDE_ADDR(*pte);

    /* A tricky method to make the page table right under most circumstances.
     *     Please consult the internal documentation for details.
     */
    int r = 1, w = 1, x = 1;
    if (Get_PTE_A(pte) == 0)
        r = x = w = 0;
    else if (Get_PTE_W(pte) == 0 || Get_PTE_D(pte) == 0)
        w = 0;

    /* Make sure that the page is invalid before mapping
     *     It is better to use 'mprotect' here actually.
     */
    tlb_invalidate (pgdir, la);

    struct proc_struct *proc = find_proc_by_pgdir (pgdir);
    if (current != NULL && proc != NULL) {
        /* Map the page to the container process found using the stub code */
        if (host_mmap (proc,
                       (void*)la, PGSIZE, (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) | (x ? PROT_EXEC : 0),
                       MAP_SHARED | MAP_FIXED, ginfo->mem_fd, pa) == MAP_FAILED)
            panic ("map in child failed.\n");
    } else {
        /* Map the page to the host process */
        struct mmap_arg_struct args = {
            .addr = la,
            .len = PGSIZE,
            .prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) | (x ? PROT_EXEC : 0),
            .flags = MAP_SHARED | MAP_FIXED,
            .fd = ginfo->mem_fd,
            .offset = pa,
        };
        syscall1 (__NR_mmap, (long)&args);
    }
}

/**
 * unmap the page specified by @la in the container process corresponding to @pgdir
 * @param pgdir page directory
 * @param la the logical address of the page to be flushed
 */
void
tlb_invalidate (pde_t *pgdir, uintptr_t la) {
    struct proc_struct *proc = find_proc_by_pgdir (pgdir);
    if (current != NULL && proc != NULL) {
        if (host_munmap (proc, (void*)la, PGSIZE) < 0)
            panic ("unmap in child failed\n");
    } else {
        syscall2 (__NR_munmap, la, PGSIZE);
    }
}

/**
 * invalidate [USERBASE, USERTOP).
 * used by tests or do_execve if a 'clean' space is needed (though not neccesary).
 */
void
tlb_invalidate_user (void)
{
    syscall2 (__NR_munmap, USERBASE, USERTOP - USERBASE);
}