t_error ia32_thread_init(void) { THREAD_ENTER(thread); o_as* as; t_vaddr int_stack; /* * 1) */ if (as_get(kasid, &as) != ERROR_NONE) THREAD_LEAVE(thread, ERROR_UNKNOWN); /* * 2) */ if (map_reserve(kasid, MAP_OPT_PRIVILEGED, 3 * PAGESZ, PERM_READ | PERM_WRITE, (t_vaddr*)&thread->machdep.tss) != ERROR_NONE) THREAD_LEAVE(thread, ERROR_UNKNOWN); memset(thread->machdep.tss, 0x0, sizeof(t_ia32_tss)); /* * 3) */ if (map_reserve(kasid, MAP_OPT_PRIVILEGED, 2 * PAGESZ, PERM_READ | PERM_WRITE, &int_stack) != ERROR_NONE) THREAD_LEAVE(thread, ERROR_UNKNOWN); /* * 4) */ if (tss_load(thread->machdep.tss, SEGSEL(PMODE_GDT_CORE_DS, PRIV_RING0), int_stack + 2 * PAGESZ - 16, 0x68) != ERROR_NONE) THREAD_LEAVE(thread, ERROR_UNKNOWN); gl_stack_int = int_stack + 2 * PAGESZ - 16; /* * 5) */ if (tss_init(thread->machdep.tss) != ERROR_NONE) THREAD_LEAVE(thread, ERROR_UNKNOWN); THREAD_LEAVE(thread, ERROR_NONE); }
t_status interface_map_reserve(o_syscall* message) { t_status error; t_vaddr result1; error = map_reserve(message->u.request.u.map_reserve.arg1, message->u.request.u.map_reserve.arg2, message->u.request.u.map_reserve.arg3, message->u.request.u.map_reserve.arg4, &result1); message->u.reply.error = error; message->u.reply.u.map_reserve.result1 = result1; return (STATUS_OK); }
msg_metadata *reserve_message_metadata(void *message_envelope) { return (msg_metadata *) map_reserve(&metadata_map, message_envelope); }