static void init_global(void) { u16_t* p = (u16_t*)log_start_address; g_screen_cursor = (u16_t*)(2 * (u32_t)*p + screen_init_cursor); g_ticks = 0; g_reenter = 0; g_kernel_stack_top = g_kernel_stack + kernel_stack_size; g_addr_range_count = (int)*(u32_t*)(addr_range_start_addr - 4); t_memcpy(g_addr_range, (void*)addr_range_start_addr, sizeof(addr_range_desc_t) * g_addr_range_count); g_kernel_image = *(kernel_image_info_t*)0x6000; t_printf("---- tinyos kernel ----\r\n"); }
void init_pcb(pcb_t* p, void* entry, char* name, u32_t pid, u32_t priority) { p->entry = entry; t_memcpy(p->name, name, t_strlen(name)); p->pid = pid; p->ticks = priority; p->priority = priority; p->stack_top = p->stack + user_stack_size; p->regs.cs = ring3_code_selector; p->regs.ss = ring3_data_selector; p->regs.esp = (u32_t)(void*)p->stack_top; p->regs.eflags = 0x202; p->regs.cs = ring3_code_selector; p->regs.eip = (u32_t)entry; p->regs.ds = ring3_data_selector; p->regs.es = ring3_data_selector; p->regs.fs = ring3_data_selector; p->regs.gs = ring3_data_selector; }
int main(void) { printf("\n===== START TEST =====\n"); t_bzero(); t_strcat(); t_isalnum(); t_isascii(); t_isprint(); t_tolower(); t_toupper(); t_puts(); t_strlen(); t_memset(); t_memcpy(); t_strdup(); t_cat(); t_bonus(); printf("\n===== END OF TEST =====\n"); return (0); }
void scroll_screen(void) { g_screen_cursor = (u16_t*)(screen_init_cursor + (screen_height - 1) * screen_width * 2); t_memcpy((void*)screen_init_cursor, (void*)(screen_init_cursor + screen_width * 2), screen_height * screen_width * 2); }