Ejemplo n.º 1
0
Archivo: dtor.c Proyecto: ggwpez/sxlb
void exit(int status)
{
    while (i--)
        dtors[i]();

    SYSCALL1(SYSCNUM_TASK_EXIT, status);
}
Ejemplo n.º 2
0
int device_exists(const char *name)
{
    int ret;

    SYSCALL1(SYS_DEVICE_EXISTS, name, ret);

    return ret;
}
Ejemplo n.º 3
0
void printf(char* fmt, ...)
{
va_list list;
va_start(list, fmt);
char buf[1000] = {0};
vsprintf(buf, fmt, list);
va_end(list);
SYSCALL1(2, buf);
}
Ejemplo n.º 4
0
Archivo: exit.c Proyecto: Nakrez/zOS
void exit(int status)
{
    int ret;

    close_streams();

    SYSCALL1(SYS_EXIT, status, ret);

    while (1)
        ;
}
Ejemplo n.º 5
0
Archivo: open.c Proyecto: ggwpez/sxlb
//this "int" is a short, dont return anything longer than 2 bytes°!!!!
int open(const char *name, int flags, ...)
{
    int file_i = 0;
    while (file_ptrs[file_i].fs_node && file_i < MAX_FILES) file_i++;   //find next free file buffer

    if (file_i +1 >= MAX_FILES)     //MAX_FILES reached
        return -1;

    char* dir_path = NULL,* file_name = name,* last_slash;
    size_t dir_path_l = 0;
    DIR* dir;

    if (strchr(name, '/'))
    {
        //get directory path
        last_slash = strrchr(name, '/') +1;
        dir_path_l = last_slash - name;

        dir_path = (char*)malloc(dir_path_l +1);

        strncpy(dir_path, name, dir_path_l);
        dir_path[dir_path_l] = '\0';

        file_name += dir_path_l;
        dir = opendir(dir_path);
        free(dir_path);
    }
    else
    {
        dir = opendir(".");
    }    

    if (!dir)
        return -1;

    //dirent_t* ent;
    LPTR fs_node;

    SYSCALL_RET2(SYSCNUM_VFS_FIND_DIR, fs_node, dir->fs_node, file_name);
    closedir(dir);

    if (!fs_node)       //is the file in the directory?
    {
        return -1;      //no
    }
    else                //yee, lets open it
    {
        SYSCALL1(SYSCNUM_VFS_OPEN, fs_node);
        file_ptrs[file_i].fs_node = fs_node;
        file_ptrs[file_i].off = 0;
        return file_i;
    }
}
Ejemplo n.º 6
0
Archivo: main.c Proyecto: nmav/cspim-ku
int main(void)
{
unsigned char string[256];
struct md5_ctx ctx;
unsigned int size;
int ret;

#ifdef REPEAT
	do {
#else
	print_string("This is the emulated program. Will try to calculate MD5...\n");
#endif


	md5_init(&ctx);

	/* pass the string address above */
#ifdef TEST
#define STR "A long text to hash, and hash, and hash and hash..."
	size = sizeof(STR)-1;
	memcpy(string, STR, size);

	md5_update(&ctx, size, string);
	md5_digest(&ctx, 16, string);

	return 0;
#else
	ret = SYSCALL2(USER_SYSCALL(1), (unsigned int)string, sizeof(string));
	if (ret > 0) {
		size = ret;
		md5_update(&ctx, size, string);
		md5_digest(&ctx, 16, string);

#ifndef REPEAT
		ret = SYSCALL2(USER_SYSCALL(2), (unsigned int)string, 16);
		if (ret == 0)
			return 0;
#endif
	}
#endif	

#ifdef REPEAT
	} while(SYSCALL1(USER_SYSCALL(0),0)==0);
#endif

	return 1;
}
Ejemplo n.º 7
0
Archivo: fork.c Proyecto: MrXedac/riku
int fork ()
{
  uint64_t ret;
  SYSCALL1(ret, (uint64_t)0xA, (uint64_t)0x0);
  return ret;
}
Ejemplo n.º 8
0
Archivo: libc.c Proyecto: juur/FailOS
int brk(void *addr)
{
    return (int)SYSCALL1(SYSCALL_BRK, addr);
}
Ejemplo n.º 9
0
// Increase the allocated process memory
void* sbrk(ptrdiff_t incr)
{
	int result;
	SYSCALL1(SYSCALL_SBRK, result, incr);
	return (caddr_t)result;
}
Ejemplo n.º 10
0
void interrupt_unregister(int interrupt)
{
    int ret;

    SYSCALL1(SYS_INTERRUPT_UNREGISTER, interrupt, ret);
}
Ejemplo n.º 11
0
void exit(int status)
{
	SYSCALL1(SYS_Exit, status);
	while(1) {}
}
Ejemplo n.º 12
0
Archivo: os.c Proyecto: nielh/dragon
s64 Close(s64 fd)
{
	SYSCALL1(SYS_CLOSE, fd);
}
Ejemplo n.º 13
0
Archivo: os.c Proyecto: nielh/dragon
s64 MSleep(s64 ms)
{
	SYSCALL1(SYS_MSLEEP, ms);
}
Ejemplo n.º 14
0
Archivo: os.c Proyecto: nielh/dragon
s64 ProcessCreate(char* cmdline)
{
	SYSCALL1(SYS_PROCESSCREATE, cmdline);
}
Ejemplo n.º 15
0
Archivo: os.c Proyecto: nielh/dragon
s64 LoadSysModule(char* cmdline)
{
	SYSCALL1(SYS_LOADSYSMODULE, cmdline);
}
Ejemplo n.º 16
0
Archivo: os.c Proyecto: nielh/dragon
s64 Exit(s64 code)
{
	SYSCALL1(SYS_EXIT, code);
}