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;
}
Exemplo n.º 2
0
Arquivo: ipc.c Projeto: 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
    );
}
Exemplo n.º 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;
}
Exemplo n.º 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;
}
Exemplo n.º 6
0
Arquivo: ipc.c Projeto: 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
    );
}
Exemplo n.º 7
0
Arquivo: sleep.c Projeto: csko/yaosp
unsigned int sleep( unsigned int seconds ) {
    uint64_t time;

    time = seconds * 1000000;

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

    return 0;
}
Exemplo n.º 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;
}
Exemplo n.º 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;
}
Exemplo n.º 10
0
Arquivo: fstat.c Projeto: 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;
}
Exemplo n.º 13
0
mapid_t
mmap (int fd, void *addr)
{
  return syscall2 (SYS_MMAP, fd, addr);
}
Exemplo n.º 14
0
int munmap(void *addr, size_t len)
{
	return (int)syscall2(__NR_munmap, (unsigned long)addr, (unsigned long)len);
}
Exemplo n.º 15
0
void
seek (int fd, unsigned position) 
{
  syscall2 (SYS_SEEK, fd, position);
}
Exemplo n.º 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;
}
Exemplo n.º 17
0
errval_t sys_debug_flush_cache(void)
{
    return syscall2(SYSCALL_DEBUG, DEBUG_FLUSH_CACHE).error;
}
Exemplo n.º 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;
}
Exemplo n.º 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;
}
Exemplo n.º 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;
}
Exemplo n.º 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;
}
Exemplo n.º 22
0
errval_t sys_debug_context_counter_reset(void)
{
    return syscall2(SYSCALL_DEBUG, DEBUG_CONTEXT_COUNTER_RESET).error;
}
Exemplo n.º 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;
}
Exemplo n.º 24
0
Arquivo: crt0.c Projeto: ALoay94/os
int getatt(int req, char *buf)
{
	syscall2(13, req, buf);
}
Exemplo n.º 25
0
int open(char* name, char* buf)
{
    syscall2(SYS_OPEN, name, buf);
}
Exemplo n.º 26
0
bool
readdir (int fd, char name[READDIR_MAX_LEN + 1]) 
{
  return syscall2 (SYS_READDIR, fd, name);
}
Exemplo n.º 27
0
int uthread_join(int th_id, int* th_status)
{
	return syscall2 (SYS_UTHREAD_JOIN, th_id, th_status);
}
Exemplo n.º 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);
}
Exemplo n.º 29
0
bool
create (const char *file, unsigned initial_size)
{
  return syscall2 (SYS_CREATE, file, initial_size);
}
Exemplo n.º 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);
}