コード例 #1
0
ファイル: kernel.c プロジェクト: andylin211/andyos
static void init_tss(void)
{
    t_memset(&g_tss, 0, sizeof(tss_t));

    g_tss.io_base = sizeof(tss_t) - 1;
    g_tss.end_of_io = 0xff;
    g_tss.ss0 = ring0_data_selector;

    __asm
    {
        mov   ax, tss_selector
        ltr   ax
    }
}
コード例 #2
0
uint8_t* msi_msg_to_string ( msi_msg_t* _msg )
{
    assert(_msg);

    uint8_t* _retu = calloc(sizeof(uint8_t), MSI_MAXMSG_SIZE );
    assert(_retu);

    t_memset(_retu, '\0', MSI_MAXMSG_SIZE);

    if ( _msg->_version ){
        append_header_to_string(_retu, (const uint8_t*)_VERSION_FIELD,      _msg->_version->_header_value);
    }

    if ( _msg->_request ){
        append_header_to_string(_retu, (const uint8_t*)_REQUEST_FIELD,      _msg->_request->_header_value);
    }

    if ( _msg->_response ){
        append_header_to_string(_retu, (const uint8_t*)_RESPONSE_FIELD,     _msg->_response->_header_value);
    }

    if ( _msg->_friend_id ){
        append_header_to_string(_retu, (const uint8_t*)_FRIENDID_FIELD,     _msg->_friend_id->_header_value);
    }

    if ( _msg->_call_type ){
        append_header_to_string(_retu, (const uint8_t*)_CALLTYPE_FIELD,     _msg->_call_type->_header_value);
    }

    if ( _msg->_user_agent ){
        append_header_to_string(_retu, (const uint8_t*)_USERAGENT_FIELD,    _msg->_user_agent->_header_value);
    }

    if ( _msg->_info ){
        append_header_to_string(_retu, (const uint8_t*)_INFO_FIELD,         _msg->_info->_header_value);
    }

    if ( _msg->_call_id ){
        append_header_to_string(_retu, (const uint8_t*)_CALL_ID_FIELD,      _msg->_call_id->_header_value);
    }

     if ( _msg->_reason ){
        append_header_to_string(_retu, (const uint8_t*)_REASON_FIELD,       _msg->_reason->_header_value);
    }

    return _retu;
}
コード例 #3
0
ファイル: main.c プロジェクト: ccompera/libft-asm
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);
}
コード例 #4
0
ファイル: kernel.c プロジェクト: andylin211/andyos
static void init_gdt(void)
{
    int i = 0;
    gdt_ptr_t gdt_ptr = { 0 };

    /* zero */
    for (i = 0; i < gdt_size; i++)
        t_memset(&g_gdt[i], 0, sizeof(descriptor_t));
    
    /* set */
    set_descriptor(&g_gdt[ring0_code_index], 0, 0xfffff, ring0_code_attr);
    set_descriptor(&g_gdt[ring0_data_index], 0, 0xfffff, ring0_data_attr);
    set_descriptor(&g_gdt[ring3_code_index], 0, 0xfffff, ring3_code_attr);
    set_descriptor(&g_gdt[ring3_data_index], 0, 0xfffff, ring3_data_attr);    
    set_descriptor(&g_gdt[tss_index], (u32_t)(void*)&g_tss, sizeof(tss_t) - 1, tss_attr);

    /* set ptr */
    gdt_ptr.address = (u32_t)(void*)&g_gdt;
    gdt_ptr.limit = sizeof(descriptor_t) * gdt_size - 1;

    __asm lgdt[gdt_ptr]
}
コード例 #5
0
ファイル: screen.c プロジェクト: andylin211/andyos
void clear_screen(void)
{
    g_screen_cursor = (u16_t*)screen_init_cursor;

    t_memset((void*)g_screen_cursor, 0, 80 * 50 * 2);
}