hangc0276 / os Goto Github PK
View Code? Open in Web Editor NEW30天自制操作系统笔记
30天自制操作系统笔记
函数 _load_gdtr
的汇编代码如下:
_load_gdtr: ; void load_gdtr(int limit, int addr) ;
mov ax, [esp+4] ; limit
mov [esp+6], ax
lgdt [esp+6]
ret
这个函数用来将指定的段上限(limit)和地址赋值给名为GDTR的48位寄存器。这是一个很特别的48位寄存器,并不能用我们常用的MOV指令来赋值。给它赋值的时候,唯一的方法是指定一个内存地址,从指定的地址读取6个字节(也就是48位),然后赋值给GDTR寄存器。完成这一任务的指令是LGDT。
在最初执行这个函数的时候,DWORD[esp+4]里存放的是段上限,DWORD[esp+8]里存放的是地址,假设limit = 0x0000ffff, addr = 0x00270000。调用该函数时,栈的情况如下图所示:
执行语句 mov ax, [esp+4]
, 即将0xffff装入寄存器AX中,当执行语句 mov [esp+6], ax
后,栈的情况如下图所示:
由于GDTR是48位寄存器,所以执行 LGDT [esp+6]
后,便将 0x00270000ffff装入GDTR寄存器。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.