Esempio n. 1
0
void _exit (int status)
{
	_kill(status, -1);
	while (1) {}
}
Esempio n. 2
0
void rtc_print_time_as_proc()
{
    rtc_print_time();
    _kill();
}
Esempio n. 3
0
void _exit (int status)
{
	_kill(status, -1);
	while (1) {}		/* Make sure we hang here */
}
Esempio n. 4
0
/**
 * Interrupt 80h. Handles the system calls.
 *
 *  @param regs Pointer to struct containing micro's registers.
 */
void int80(registers* regs) {

    switch (regs->eax) {

        case _SYS_READ:
            regs->eax = _read((unsigned int)regs->ebx, (char*)translate(regs->ecx), (size_t)regs->edx);
            break;
        case _SYS_WRITE:
            regs->eax = _write((unsigned int)regs->ebx, (const char*)translate(regs->ecx), (size_t)regs->edx);
            break;
        case _SYS_TIME:
            regs->eax = _time((time_t*)translate(regs->ebx));
            break;
        case _SYS_IOCTL:
            regs->eax = _ioctl(regs->ebx, regs->ecx, (void*)translate(regs->edx));
            break;
        case _SYS_TICKS:
            regs->eax = _getTicksSinceStart();
            break;
        case _SYS_YIELD:
            // This just makes sure we call the scheduler again, for now
            break;
        case _SYS_EXIT:
            _exit();
            break;
        case _SYS_GETPID:
            regs->eax = _getpid();
            break;
        case _SYS_GETPPID:
            regs->eax = _getppid();
            break;
        case _SYS_RUN:
            regs->eax = _run((EntryPoint) translate(regs->ebx), (char*) translate(regs->ecx), regs->edx);
            break;
        case _SYS_WAIT:
            regs->eax = _wait();
            break;
        case _SYS_KILL:
            _kill((pid_t) regs->ebx);
            break;
        case _SYS_PINFO:
            regs->eax = _pinfo((struct ProcessInfo*)translate(regs->ebx), (size_t)regs->ecx);
            break;
        case _SYS_SLEEP:
            _sleep(regs->ebx);
            break;
        case _SYS_NICE:
            regs->eax = _nice(regs->ebx);
            break;
        case _SYS_RENICE:
            regs->eax = _renice(regs->ebx, regs->ecx);
            break;
        case _SYS_CLOSE:
            regs->eax = _close(regs->ebx);
            break;
        case _SYS_OPEN:
            regs->eax = _open((char*)translate(regs->ebx), regs->ecx, regs->edx);
            break;
        case _SYS_CREAT:
            regs->eax = _creat((char*)translate(regs->ebx), regs->ecx);
            break;
        case _SYS_MKDIR:
            regs->eax = _mkdir((const char*)translate(regs->ebx), regs->ecx);
            break;
        case _SYS_RMDIR:
            regs->eax = _rmdir((const char*)translate(regs->ebx));
            break;
        case _SYS_UNLINK:
            regs->eax = _unlink((const char*)translate(regs->ebx));
            break;
        case _SYS_RENAME:
            regs->eax = _rename((const char*)translate(regs->ebx), (const char*)translate(regs->ecx));
            break;
        case _SYS_CHDIR:
            regs->eax = _chdir((const char*)translate(regs->ebx));
            break;
        case _SYS_GETCWD:
            regs->eax = _getcwd((char*)translate(regs->ebx), (size_t)regs->ecx);
            break;
        case _SYS_READDIR:
            regs->eax = _readdir(regs->ebx, (struct fs_DirectoryEntry*)translate(regs->ecx), regs->edx);
            break;
        case _SYS_SETPPERSONA:
            _setProcessPersona(regs->ebx, regs->ecx, regs->edx);
            break;
        case _SYS_GETPPERSONA:
            _getProcessPersona(regs->ebx, (int*)translate(regs->ecx), (int*) translate(regs->edx));
            break;
        case _SYS_SYMLINK:
            regs->eax = _symlink((const char *)translate(regs->ebx), (const char *)translate(regs->ecx));
            break;
        case _SYS_MKFIFO:
            regs->eax = _mkfifo((const char*)translate(regs->ebx));
            break;
        case _SYS_CHMOD:
            regs->eax = _chmod(regs->ebx, (const char*)translate(regs->ecx));
            break;
        case _SYS_STAT:
            regs->eax = _stat((const char*)translate(regs->ebx), (struct stat*)translate(regs->ecx));
            break;
        case _SYS_CHOWN:
            regs->eax = _chown((const char*)translate(regs->ebx));
            break;
        case _SYS_LOG:
            _loglevel(regs->ebx);
            break;
        case _SYS_STACKSIZE:
            regs->eax = _stacksize();
    }
}