Exemple #1
0
void main(void)		/* This really IS void, no error here. */
{			/* The startup routine assumes (well, ...) this */
/*
 * Interrupts are still disabled. Do necessary setups, then
 * enable them
 */
	time_init();
	tty_init();
	trap_init();
	sched_init();
	buffer_init();
	hd_init();
	sti();
	move_to_user_mode();
	if (!fork()) {		/* we count on this going ok */
		init();
	}
/*
 *   NOTE!!   For any other task 'pause()' would mean we have to get a
 * signal to awaken, but task0 is the sole exception (see 'schedule()')
 * as task 0 gets activated at every idle moment (when no other tasks
 * can run). For task0 'pause()' just means we go check if some other
 * task can run, and if not we return here.
 */
	for(;;) pause();
}
Exemple #2
0
int main(void)
{
    /* Interrupts are still disabled. Do necessary setups, then enable them. */
    time_init();
    tty_init();
    trap_init();
    sched_init();
    buffer_init();
    hd_init();
    sti();
    move_to_user_mode();
    if (!fork()) {		/* we count on this going ok */
	init();
    }

    /*
     * NOTE!!
     * For any other task 'pause()' would mean we have to get a signal to awaken,
     * but task 0 gets activated at every idle moment (when no other tasks can run).
     * For task0 'pause()' just means we go check if some other task can run, and
     * if not we return here.
     */
    // for(;;) pause();

    return 0;
}
Exemple #3
0
int main(void)
{
	/* NOTE! 这些初始化函数的位置别随便改动! */
	trap_init();	/* 在设置其他中断之前 */
	console_init();	/* 需打印的在这之后 */
	keyboard_init();
	hd_init();		/* 需读磁盘的放其后 */
/*	graph_init(); */
	mem_init();
	sched_init();
	buff_init();	/* 在内存初始化之后 */
	inode_init();
	file_table_init();
	debug_init();
	sti();
	super_init(0);	/* 开中断之后 */
	files_init();

/*	unsigned short color = rgb_to_565color(255,255,255);
	draw_rect(0, 0, 800, 600, color, 1); */

	move_to_user_mode();

	/*
	 * 进程0马上execve(),替换掉用户态空间,这样进程0就
	 * 可以写时复制了。注意此时原来的用户态堆栈也被丢弃
	 * 了,换成了新堆栈。更多参见内存管理。
	 */
	if(!execve("/init"))
		printf("main: execve init-process failed.\n");
Exemple #4
0
void main(void)		/* This really IS void, no error here. */
{			/* The startup routine assumes (well, ...) this */
/*
 * Interrupts are still disabled. Do necessary setups, then
 * enable them
 */
 	ROOT_DEV = ORIG_ROOT_DEV;
 	drive_info = DRIVE_INFO;
	memory_end = (1<<20) + (EXT_MEM_K<<10);
	memory_end &= 0xfffff000;
	if (memory_end > 16*1024*1024)
		memory_end = 16*1024*1024;
	if (memory_end > 12*1024*1024) 
		buffer_memory_end = 4*1024*1024;
	else if (memory_end > 6*1024*1024)
		buffer_memory_end = 2*1024*1024;
	else
		buffer_memory_end = 1*1024*1024;
	main_memory_start = buffer_memory_end;
#ifdef RAMDISK
	main_memory_start += rd_init(main_memory_start, RAMDISK*1024);
#endif
	mem_init(main_memory_start,memory_end);
	trap_init();
	blk_dev_init();
	chr_dev_init();
	tty_init();
	time_init();
	sched_init();
	buffer_init(buffer_memory_end);
	hd_init();
	floppy_init();
	sti();
	move_to_user_mode();

	setup((void *) &drive_info);
	(void) open("/dev/tty0",O_RDWR,0);
	(void) dup(0);
	(void) dup(0);
	(void) open("/var/process.log",O_CREAT|O_TRUNC|O_WRONLY,0666);
#ifdef dis_func
	(void) open("/var/dis_func.log",O_CREAT|O_TRUNC|O_WRONLY,0666);
#endif

	if (!fork()) {		/* we count on this going ok */
		init();
	}
/*
 *   NOTE!!   For any other task 'pause()' would mean we have to get a
 * signal to awaken, but task0 is the sole exception (see 'schedule()')
 * as task 0 gets activated at every idle moment (when no other tasks
 * can run). For task0 'pause()' just means we go check if some other
 * task can run, and if not we return here.
 */
	for(;;) pause();
}
Exemple #5
0
void block_init(void)
{
	int i;
	/* init block buffer allocator */
	block_slab = alloc_slab(sizeof(struct block));
	if (!block_slab)
		panic("No memory for block slab");
	/* init block buffer hash table */
	for (i = 0; i < BLOCK_HASH_SIZE; i++)
		hlist_head_init(&block_htable[i]);
	hd_init();
	block_test();
}
Exemple #6
0
/*-----Muse_main-----*/
void Muse_main(void)
{
	PROC	*pPTab = pList;
	JOB	*pJTab = jList;
	u8	*pStack = jobStack + ALL_PLC;
	int	lCir;

	for(lCir = 0; lCir < NR_ANT + NR_DF + NR_TEST; lCir++, pPTab++, pJTab++) {
		pPTab->proc_part.es = pPTab->proc_part.fs = pPTab->proc_part.ds = pPTab->proc_part.ss = 0x15;
		pPTab->proc_part.gs = SELECTOR_V;
		pPTab->proc_part.cs = 0xD;
		pPTab->proc_part.eip = (u32)pJTab->work;
		pPTab->proc_part.ret_esp = (u32)pStack;
		pPTab->proc_part.eflags = 0x1202;

		pPTab->proc_selector = SELECTOR_LDT_F + 8 * lCir;

		pPTab->proc_ticks = pPTab->proc_priority = DEFAULT_TICKS;
		pPTab->proc_state = 0;
		pPTab->proc_id = lCir;
		pPTab->proc_errno = 0;
		pPTab->proc_flags = 0;

		pPTab->proc_ntty = 0;

		pPTab->proc_recvfrom = pPTab->proc_sendto = NO_TASK;
		pPTab->proc_send_next = pPTab->proc_recv_next = NULL;
		pPTab->proc_msg = NULL;

		prot_gdesc_init(&pPTab->proc_ldt[0], 0, 0, 0);
		prot_gdesc_init(&pPTab->proc_ldt[1], 0, 0xFFFFF, DA_LIMIT_4K | DA_32 | DPL1 | DA_CR);
		prot_gdesc_init(&pPTab->proc_ldt[2], 0, 0xFFFFF, DA_LIMIT_4K | DA_32 | DPL1 | DA_DRW);

		pStack -= pJTab->stack;
	}

	proc_on_head = proc_on_view = pList;
	reenter = 0;

	memory_init();
	hd_init();
	buffer_init();
	keyboard_init();
	clock_init();
	proc_restart();

	for(; ;) { }
}
Exemple #7
0
void main(void)		/* This really IS void, no error here. */
{			/* The startup routine assumes (well, ...) this */
/*
 * Interrupts are still disabled. Do necessary setups, then
 * enable them
 */
 	ROOT_DEV = ORIG_ROOT_DEV;
 	drive_info = DRIVE_INFO;
	memory_end = (1<<20) + (EXT_MEM_K<<10);
	memory_end &= 0xfffff000;
	if (memory_end > 16*1024*1024)
		memory_end = 16*1024*1024;
	if (memory_end > 12*1024*1024) 
		buffer_memory_end = 4*1024*1024;
	else if (memory_end > 6*1024*1024)
		buffer_memory_end = 2*1024*1024;
	else
		buffer_memory_end = 1*1024*1024;
	main_memory_start = buffer_memory_end;
#ifdef RAMDISK
	main_memory_start += rd_init(main_memory_start, RAMDISK*1024);
#endif
	mem_init(main_memory_start,memory_end);
	trap_init();	/* set the IDT in 0x00080000~0x000807ff(4KB)*/
	blk_dev_init();
	chr_dev_init();	/* this function do nothing */
	tty_init();		/* rs_init() and con_init() */
	time_init();
	sched_init();
	buffer_init(buffer_memory_end);
	hd_init();
	floppy_init();
	sti();
	move_to_user_mode();
	if (!fork()) {		/* we count on this going ok */
		init();
	}
/*
 *   NOTE!!   For any other task 'pause()' would mean we have to get a
 * signal to awaken, but task0 is the sole exception (see 'schedule()')
 * as task 0 gets activated at every idle moment (when no other tasks
 * can run). For task0 'pause()' just means we go check if some other
 * task can run, and if not we return here.
 */
	for(;;) pause();
}
Exemple #8
0
static int init(void)
{
    int area_size = ALIGN_UP(sizeof(hd_data_t), 2*4096);
    hdshm_area_t *area;

    if (hd_init(0) != 0)
    {
        fprintf(stderr, "ERROR: Unable to open hdshm device.\n");
        return 0;
    }

    area = hd_get_area(HDID_HDA);

    if(!area){
        printf("creating new hd-shm-area\n");
        hdshm_reset();
        area = hd_create_area(HDID_HDA, NULL, area_size, HDSHM_MEM_HD);
        //memset((void *)area, 0, area_size);
    }

    if (!area)
    {
        fprintf(stderr, "ERROR: Unable to create hda.\n");
        return 0;
    }

    hda = (hd_data_t volatile *)area->mapped;
    hda->osd_flush_count = 0;
    int i;
    for(i = 0; i<HDOSD_MAX_CACHED_FONTS; i++)
          hda->osd_cached_fonts[i] = 0;
    for(i = 0; i<HDOSD_MAX_IMAGES; i++)
          hda->osd_cached_images[i] = 0;

//    memset((void *)hda, 0, area_size);

    return create_channels();
}