一个内核的helloworld
编程技术  /  houtizong 发布于 3年前   150
bits 32section .text ;multiboot spec align 4 dd 0x1BADB002 ;magic dd 0x00 ;flags dd - (0x1BADB002 + 0x00) ;checksum. m+f+c should be zeroglobal startextern kmain ;this is defined in the c filestart: cli ;block interrupts call kmain hlt ;halt the CPU
void kmain(void){ char *str = "my first kernel"; //video memory begins at address 0xb8000 char *vidptr = (char*)0xb8000; unsigned int i = 0; unsigned int j = 0; //this loops clears the screen //there are 25 lines each of 80 columns; each element takes 2 bytes while(j < 80 * 25 * 2) { //blank character vidptr[j] = ' '; //attribute-byte vidptr[j+1] = 0x07; j = j + 2; } j = 0; //this loop write the string to video memory while(str[j] != '\0') { //the character's ascii vidptr[i] = str[j]; //attribute-byte: give character black bg and-light grey fg vidptr[i+1] = 0x07; ++j; i = i + 2; } return;}
OUTPUT_FORMAT(elf32-i386)ENTRY(start)SECTIONS { . = 0x100000; .text : { *(.text) } .data : { *(.data) } .bss : { *(.bss) } }
请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!
技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成
网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];
文章归档
文章标签
友情链接