|
[原创]Newbie的系统学习历程
<DAY 5> [进度] 第二章, 3.5, 3.8完结 [小结] 发现学了 register 和 data type 之后, 还有一个很重要的相关内容跳过了, 就是 addressing, 跑回去做了第二章的学习. addressing 也有size 属性, 还有 addressing method, 很琐碎的东西, 就不多说了. 以前一直搞不清楚为什么有instruction 中有 addressing size 还需要 operand size 的相关考虑, 难道默认 32-bit 的 addressing 会要 默认 16-bit 的 operand size ?? 今天仔细地看了一下这两个表, 结果地理大发现, 看图 这两个默认情况下是一致的, 也就是 32-bit 的默认就是两个都是 32-bit, 反之则是 16-bit. 因为这两个的默认同时由 CS descriptor 的 D-bit 决定. instruction 有了opcode, oprand, 再加上 opcode prefix 就形成一条完整的instruction. prefix 有5组, 也是很琐碎. 我把成分成3类, function , instrution, mechanism, 不是很复杂. 今天空闲时看了一下VOL 1 中剩下的内容, 结果发现 GPPU 要学完了, 剩下 I/O, control transfer和一些系统优化相关. 决定放弃系统优化, 然后把 control transfer 并入 system programming, 也就是 VOL 2. 所以, 今天就提前把相对简单的I/O指令先完成掉, 结果发现I/O的protection不难, 无非是 EFLAGS 的IOPL(I/O privilege level), CS的 CPL(current privilege level)之间的比较. 但由于有涉及 TSS(task-state-segment) . 一并放入 VOL 2. 那还有什么? 没了! 下一阶段就是 FPU, 还有 SSE 相关内容了. 接下来几天做 GPPU阶段复习, 顺便开始 deassembler, 和 assembler的设计. |
|
[原创]PE格式详细讲解(一)
能得到邀请吗? 这个的相关网上太多了. |
|
|
|
[原创]Newbie的系统学习历程
<DAY 4> 休息了一个星期天, 打了大半天的 大航海2. 星期天是个好东西, 大家都应该好好遵重一下她. 特别是IT的, 一不小心就瘁死, 够吓人的. 不过今天不在状态, 注意力不集中, 老想着找款网游打些生活费, 伤脑筋, 如果谁有打钱不太累的游戏介绍一下, 感激涕零. [进度] 3.3.3完结 [小结] 上一天完成了GPPU register 认识, 今天就有它的完结篇, CPU 支持的 data type, 前一天所说的那4种 int, UINT, string, BCD, 以及 hardware limit 对这些 date type 的影响. 比如, 为什么 FLAGS 的 SF<>OF 会导致 Jcc, SETcc, CMOVcc 的cc条件中的 L 和 NGE, 而当 SF=OF 时则相反. 思考一下我感觉是很有益的. 完成了 register相关(也就是operand), 当然就到了opcode. AMD64的指令集有点复杂, 我算了下 260多条, opecode展开的话就更多了. 我根据我的感觉, 把它们分成了 3.5 类, 也就是 3大类, 5小类. 具体又画了张图, 当然, 划分不会绝对, 2个极端之间相互融合注定有条桥 比如, data conversion 中的BSWAP指令, 涉及 endian, 这是硬件相关 所有这些指令小类, I/O, control transfer和 system call 属于复杂指令, 这里的复杂是指除了完成本身的功能之外, 还涉及到 CPU 的各种 mechanism, 主要是hardware protection. 要进一步地深入研究. 今天不在状态, 烦~ "凡劳苦担重担的, 都到我这里来, 我就使你得着安息." |
|
[原创]Newbie的系统学习历程
啊, 发现帖子加了精, 哈~~ 唉, 我的自信心一向不足, 老被人笑, 不过我懂得了一个道理, 就是, 我发觉这个世界最美丽最值得拥有的东西都是一些很平凡不起眼的. 反倒是自信啊, 骄傲啊, 自豪啊, 优越感啊什么的, 反而是不好的东东, 会妨碍进一步认识这个世界,并且对相对不起眼的人造成伤害. 所以, 我的人生宣言是: 一辈子做个最平凡的人! oh, yeah, 高兴起来过每一天. |
|
[原创]Newbie的系统学习历程
<DAY 2> [进度] 3.3.1完结 [小结]完成 GPPU 的 rFLAGS 的相关位使用学习, 1 control bit (DF)+ 4 arithmetic result bits(ZF+SF+OF+CF) + 1 pairity bit(PF)+1 useless bit(AF) 感觉 register 和表达式的描述没太大的关系, 和机器相关多一点. 以后写 decompiler 的时候应该要注意把有关 register 的东西全部抽象掉才好. 再有就是GPPU提供支持的Date Type: BCD, integer, unsigned interger, string. 就这4样. 其他没有硬件支持的必须要全部要 bit manipulation. Date Type 当然也有size 属性, 和 register对应, 感觉重复了, 没必要理会, 在 opcode 学习时再细看. 弄清楚了上图的一个地方, 就是opcode addressing size 如何决定使用 register size, 很简单, immediate addressing的时候, 嘿~ 收获不多, 但似乎都弄清楚了. 写了几句 deassembler 在数据交互时会用到的代码: #include "991_my_bit.h" map<DWORD, string> _b2h_map[4][4] = { (0,"00"), (1,"01"), (2,"02"), (3,"03"), (4,"04"), (5,"05"), (6,"06"), (7,"07"), (8,"08"), (9,"09"), (10,"10"), (11,"11"), (12,"12"), (13,"13"), (14,"14"), (15,"15"), }; inline void _991BinToHex32(DWORD resource, string target) { target=""; const int DWWIDTH=4; for(int i=0; i<dwwidth; ++i){ DWORD tmp=0; tmp=NIBBLEMASK & resource; int j=tmp>>2; int k=tmp&(BIT0 |BIT1); target+=_b2h_map[J][K].replace(tmp); resource>>=4; } const int BLOCK=2*sizeof(BYTE); //2 bytes in the string for each byte in DWORD target.swapA(0, BLOCK*sizeof(DWORD)/sizeof(BYTE), BLOCK); }; |
|
[原创]Newbie的系统学习历程
<DAY 1> VOL 1 的前2章是总结性的章节, 跳过, 无实际意义, 我希望能从零散逐渐堆积起来, 从总结看起相当于重复劳动. 进度: 3.1.3 完结 小结: x86的GPPU(general purpose programming unit) 中有 register 这种module, 它其中的属性有size和数量. 所有instruction使用的register的size由 operating mode, 和 effective operand size决定, 其中effecitve operand size 的决定因素有2, 1是Default operand size, 另外一个是opcode prefix; 部分instruction除了以上两个, 还由addressing size 和 stack size 决定. CPU 能用的GPRs 数量由 operating mode 决定, legacy mode和compability mode有 8 个GPRs, 一个 EIP, 一个EFLAGS Long mode 有16个GPRs, 一个RIP, 一个RFLAGS 要注意的是, register 在不同的 operating mode 间有重叠现象, Long mode 能用的GPRs还有 REX prefix的因素. 关键字: size, number 收工, 希望有朋友看到错误的话帮忙及时指出, 谢谢, 为表示感谢以后我也会这样去帮别人. 我发现人脑记图比记1,2,3,4厉害多了, 所以补张图: |
|
[原创]Newbie的系统学习历程
################################ 学习规划 ################################ 计算机这玩意对个人来说过于庞大, 这是我这1年多时间得出的结论, 只得先规划一下学习生涯. 我要做的是 target software DIY, 嗯, 先给这行起个名先, TSDer--target software DIYer, 哈哈! 那对system developer来说, 只能最大限度地从Hardware的终点和Software的起点开始build起来, 那就是 CPU 的 architecture 开始了. 没有选择的余地, x86架构, 这只有这个, 而且以后发展决定用 AMD 的CPU, 便宜又好用, 避免以后 Intel 来个SSE6,7,8什么的, 又不授权, 那我没银子用得起, 那得白学了, 虽然目前两家还是一样, 不过I记还是少惹为妙, 人家是精英, 我惹不起躲得起. 平凡的 needAjob 计算机学前班正式入学! 教材: AMD64 Architecture Programmer’s Manual series---- Volume 1: Application Programming Volume 2: System Programming Volume 3: General Purpose and System Instructions Volume 4: 128-Bit Media Instructions Volume 5: 64-Bit Media and x87 Floating-Point Instructions 学时: 不知道, 到学成为止 毕业考试: 一个 Assembler, 一个Deassembler, 一个Debugger, 以上3个完成除UI之外的设计和代码 我的预计学历: architecture--OS--OS API 我看过一点这5个PDF文裆, 决定按照自己的实际情况稍微调整一下学程安排. 好吧, 就算开课了, 从Vol 1开始, 让我们欢迎亲爱的 needAjob 小同学 我的学前班宣言: 好好学习, 天天向上! |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值