Exemplo n.º 1
0
void        Test(void)
{
    handle_t        handle  = INVALID_HANDLE;
    Pci_initial();

    handle = Proc_create("kill 1",60,5,Proc_kill_test,NULL,
        STACK_MAKE(stack_1,APP_STACK_SIZE),
        STACK_SIZE(stack_1,APP_STACK_SIZE));

    Proc_create("kill 2",60,5,Proc_kill_test1,(void *)handle,
        STACK_MAKE(stack_2,APP_STACK_SIZE),
        STACK_SIZE(stack_2,APP_STACK_SIZE));

    mutex = Mutex_create();
    if( INVALID_HANDLE == mutex)
        _printk("mutex create failed!\n");
    else
    {
        _printk("mutex create OK!\n");
        handle = Proc_create("mtx1",60,5,Test_mutex1,NULL,
            STACK_MAKE(stack_3,APP_STACK_SIZE),
            STACK_SIZE(stack_3,APP_STACK_SIZE));
        Koum_release(handle);
        handle = Proc_create("mtx2",60,5,Test_mutex2,NULL,
            STACK_MAKE(stack_4,APP_STACK_SIZE),
            STACK_SIZE(stack_4,APP_STACK_SIZE));
        Koum_release(handle);
        handle = Proc_create("mtx3",60,5,Test_mutex3,NULL,
            STACK_MAKE(stack_5,APP_STACK_SIZE),
            STACK_SIZE(stack_5,APP_STACK_SIZE));
        Koum_release(handle);
    }
}
Exemplo n.º 2
0
void cmd_elf(char *arg)
{
    int fd, ret;
    struct file *fp;
    int isElf;
    elf_header_t header;

    fd = call_syscall(5, (uintptr_t) arg, 0, 0);
    if (fd <= 0) {
        _printk("open failed: %d\n", fd);
        return;
    }

    fp = current->owner->file_table[fd];
    isElf = elf_probe(fp);
    _printk("file(%d) is %sELF\n", fd, isElf ? "" : "not ");
    if (!isElf) {
        call_syscall(6, fd, 0, 0);
        return;
    }

    fp->fops->read(fp, &header, sizeof(elf_header_t));

    _printk("ELF Type: %s\n", elf_type_as_string(header.e_type));
    _printk("Entry Point: 0x%x\n", header.e_entry);

    ret = elf_load(fp);
    _printk("ELF RET: %s\n", errno_to_string(ret));
}
Exemplo n.º 3
0
void cmd_stat(char *arg)
{
    struct stat st;
    int ret;

    ret = call_syscall(18, (uintptr_t) arg, (uintptr_t) &st, 0);
    if (ret < 0) {
        _printk("Error while stat: %d\n", ret);
        return;
    }
    _printk("File: %s\n", arg);
    _printk("Size: %d bytes\n", st.st_size);
}
Exemplo n.º 4
0
void cmd_ps()
{
    _printk("NAME [PID] extra\n");
    for (int i = 0; i < THREAD_QUEUE_SIZE; i++) {
        struct thread *p = thread_queue[i];

        if (!p)
            continue;

        _printk("%s [%d] %s\n", p->owner->comm, p->owner->pid,
                current == p ? "[current]" : "");
    }
}
Exemplo n.º 5
0
Arquivo: kernel.c Projeto: ju34/asmos
void main(void)
{

    _clear();
    _printk("Kernel is runnig ... ");
//	int i = 0;

//	for(i=0; i < IDTSIZE; i++)
//		_init_idt_desc(&kidt[i], (unsigned int) _asm_default_int, 0x08, 0x8E00);
		
//	_init_idt_desc(&kidt[33], (unsigned int) _asm_keyboard_int, 0x08, 0x8E00);

//	kidtr.limite = 0xFF*8;
//	kidtr.base = 0x800;

//        memcpy((char *) kidtr.base, (char *) kidt, kidtr.limite);

//	asm("lidtl (kidtr)");

//	init_pic();
	
//	sti;

//	_clear();
//        _printk("OK");
//	_gotoxy(5,5);
//	_printk("TEST\t");
//	_setattr(0x04);
//	_printk("Encore un test");


	while(1);
}
Exemplo n.º 6
0
void        Test_mutex3(void * param)
{
    while(1)
    {
        if( Mutex_get(mutex) == RESULT_SUCCEED )
        {
            ASSERT( i == 0);
            ++i;
            _printk("\t\tmutexd3 %d\n",i);
            --i;
            Mutex_put(mutex);
        }
        else
            break;
    }
    _printk("\tmutex3 test end!\n");
}
Exemplo n.º 7
0
void        Tty_initial(void)
{
    tty_t               *   tty     = NULL;
    
    _printk("tty initial...    ");
    /*
     *  初始化主TTY设备。
     */
    tty = tty_pool;

    tty->tty_echo_hook              = Tty_echo_hook_default;
	tty->tty_termios.temo_type		= TERMIOS_TYPE_TTY;
    tty->tty_termios.temo_iflags    = TERMIOS_IFLAG_NEED_COOK ;
    tty->tty_termios.temo_oflags    = TERMIOS_OFLAG_ECHO ;

    TQ_INIT(tty->tty_read_queue);
    TQ_INIT(tty->tty_write_queue);
    TQ_INIT(tty->tty_second_queue);
    _printk("OK!\n");
}
Exemplo n.º 8
0
void cmd_ls(char *arg)
{
    struct file *file = vfs_open(arg);

    if (!file->isdir) {
        _printk("%s", errno_to_string(ENOTDIR));
        return;
    }

    return;
}
Exemplo n.º 9
0
void cmd_lsdev()
{
    _printk("NAME TYPE\n");
    for (int i = 0; i < get_num_of_devices(); i++) {
        struct device *d = device_get(i);

        if (!d) {
            i --;
            continue;
        }

        _printk("%s %s\n", d->name,
                d->type == DEV_TYPE_TTY ? "[tty]"
                : d->type == DEV_TYPE_PSEUDO ? "[pseudo]"
                : d->type == DEV_TYPE_ISA ? "[isa]"
                : d->type == DEV_TYPE_PCI ? "[pci]"
                : d->type == DEV_TYPE_BLK ? "[blk]"
                : d->type == DEV_TYPE_TTY_INPUT ? "[intty]"
                : "[unktype]");
    }
}
Exemplo n.º 10
0
void cmd_cat(char *arg)
{
    int fd;
    char *buf;
    struct stat st;
    int ret;

    ret = call_syscall(18, (uintptr_t) arg, (uintptr_t) &st, 0);
    if (ret < 0) {
        _printk("Error while stat: %d\n", ret);
        return;
    }
    buf = kmalloc(st.st_size);
    fd = call_syscall(5, (uintptr_t) arg, 0, 0);
    if (fd <= 0) {
        _printk("open failed\n");
        return;
    }
    ret = call_syscall(3, fd, (uintptr_t) buf, st.st_size);
    call_syscall(4, 1, (uintptr_t) buf, st.st_size);
}
Exemplo n.º 11
0
//2014.2.21  硬盘测试
void        Ata_test(void)
{
    device_t      * dev = NULL;
    int             id  = 0;
    
    _printk("ATA test\n");
    if( Dev_registe("harddisk0",Ata_entry,&id) != RESULT_SUCCEED )
    {
        _printk("ata registe failed!\n");
        return ;
    }
    else
        _printk("ata capacity: %d\n",(dword_t)dev->dev_capcity);
    if( NULL == ( dev = Dev_open("harddisk0",DEV_IO_RDWR) ) )
    {
        _printk("ata open failed!\n");
        return ;
    }

    if( Dev_read(dev,0,buf,512) < 1 )
    {
        _printk("ata read error!\n");
        return ;
    }
    _printk("sinature: %04X\n",*(word_t *)(buf + 510));
}
Exemplo n.º 12
0
halt()
{
	_printk("\n...Halt!\n");
	printk("\n...Halt!\n");
	_do_halt();
}
Exemplo n.º 13
0
void show_prompt()
{
    _printk("LevOS$ ");
}
Exemplo n.º 14
0
static void __cmd_testmt_2() { while (__i_ ++ < 1000) { _printk("%d\n", __i_);
        if (!(__i_ % 100)) schedule_noirq(); }
        call_syscall(1, 0, 0, 0);}
Exemplo n.º 15
0
static void __cmd_testmt_1() { while (__i_ -= 100 > 0) _printk("%d\n", __i_);
        call_syscall(1, 0, 0, 0);}
Exemplo n.º 16
0
_panic(char *msg)
{
	_printk("Panic: %s\n", msg);
	printk("Panic: %s\n", msg);
	abort();
}
Exemplo n.º 17
0
_warn(char *msg)
{
	_printk("*** Warning: %s UNIMPLEMENTED!\n", msg);
}
Exemplo n.º 18
0
Arquivo: kernel.c Projeto: ju34/asmos
void isr_keyboard_int(){
    _printk("Keyboard interrupt");
}