shoelace源代码分析,bochs调试过程,setup.s
来源:互联网 发布:java初始化是什么意思 编辑:程序博客网 时间:2024/06/03 15:14
<bochs:2> c
(0) Breakpoint 1, 0x90200 in ?? ()
Next at t=78342962
(0) [0x00090200] 9020:0000 (unk. ctxt): mov ax, 0x9000 ; b80090
<bochs:3> u /20 0x90000
00090000: ( ): mov ax, 0x7c0 ; b8c007
00090003: ( ): mov ds, ax ; 8ed8
00090005: ( ): mov ax, 0x9000 ; b80090
00090008: ( ): mov es, ax ; 8ec0
0009000a: ( ): mov cx, 0x100 ; b90001
0009000d: ( ): sub si, si ; 29f6
0009000f: ( ): sub di, di ; 29ff
在b 0x90000不会被截获!因为没有出现
Loading system ...
因为加载到了0x90000,然后从0x90200开始运行!
loadimage()函数里面有对filesize 的初始化,地址为 0x6aede
static int
loadimage F2(char *, name, INODEFN, fn)
{
d_inode ibuf; /* inode buffer */
inode_nr inum; /* inode number */
int err; /* error code */
unsigned int filemode; /* mode of this file */
/* Locate the file given the name */
if ((inum = findinode(name, &err)) == 0) {
printf("%s not found\n", name);
return 0;
}
getinode(&ibuf, inum);
filesize = ibuf.i_size;
filemode = ibuf.i_mode & I_TYPE;
if (filemode != I_REGULAR) {
printf("%s is not a file\n", name);
return 0;
}
/* Scan the zones encompassed by this inode */
dozones(&ibuf.i_zone[0], fn);
return 1;
}
loadbuilt() 函数有对LoadPoint 的初始化
int
loadbuilt F1(char *, name)
{
if (name == (char *) 0 || *name == 0)
return 0;
/* Set up error return here */
if (setjmp(errjmp))
return 0;
/* Now attempt to the load the image */
LoadPoint = KERNELBASEADDRESS;
LoadStart = 1;
return loadimage(name, (INODEFN) readkernel);
}
下面重点看readkernel()函数
红色的部分只会运行一次
static inode_nr
readkernel F1(buffer *, bp)
{
unsigned int build_base; /* base of parameters left by build */
unsigned int bpsize; /* size of unprocessed part of bp */
unsigned int bpinx; /* index to unprocessed part of bp */
if (! LoadStart)
bpinx = 0;
else {
LoadStart = 0;
build_base = SECTOR_SIZE-8;
if (memcmp(&((char *) bp)[SECTOR_SIZE-sizeof(signature)],
(char *) &signature[0],
sizeof(signature)) == 0)
build_base -= sizeof(signature);
if ( (long) (* (unsigned int *) (&((char *) bp)[build_base]) + 1)
* SECTOR_SIZE != filesize) {
printf("%s conflicting size information\n", filename);
longjmp(errjmp, 1);
}
fsck_ds = * (unsigned int *) (&((char *) bp)[build_base+2]);
fsck_pc = * (unsigned int *) (&((char *) bp)[build_base+4]);
fsck_cs = * (unsigned int *) (&((char *) bp)[build_base+6]);
bpinx = SECTOR_SIZE;
}
bpsize = sizeof(*bp) - bpinx;
if (filesize > bpsize) {
copyto((char *) bp + bpinx, LoadPoint, bpsize);
filesize -= bpsize;
LoadPoint += bpsize;
return 0;
}
copyto((char *) bp + bpinx, LoadPoint, (unsigned int) filesize);
filesize = 1;
return ROOT_INODE;
}
<bochs:1> b 0x60e2c
<bochs:2> c
(0) Breakpoint 1, 0x60e2c in ?? ()
Next at t=78050424
(0) [0x00060e2c] 6000:0e2c (unk. ctxt): push bx ; 53
<bochs:3> u /20
00060e2c: ( ): push bx ; 53
00060e2d: ( ): call 0x4388 ; e85835
00060e30: ( ): add sp, 0x4 ; 83c404
...
<bochs:4> info r
eax 0xb7 183
ecx 0xf3c15 998421
edx 0x280 640
ebx 0xdc1a 56346
0x6dc1a对应于&ibuf
<bochs:15> n
Next at t=78051763
(0) [0x00060e30] 6000:0e30 (unk. ctxt): add sp, 0x4 ; 83c404
<bochs:16> x /10 0x6dc1a
[bochs]:
0x0006dc1a <bogus+ 0>: 0x00008180 0x0001ea00 0x52c4955e 0x15320100
0x0006dc2a <bogus+ 16>: 0x15341533 0x15361535 0x15381537 0x00001539
0x0001ea00 既是125440既是Image的大小,上面的是对应的磁盘i节点。
- shoelace源代码分析,bochs调试过程,setup.s
- shoelace源代码分析,bochs调试过程,setup.s 中do_move
- shoelace源代码分析,bochs调试过程
- shoelace源代码分析,bochs调试过程 -- loadbuilt()函数
- shoelace源代码分析,bochs调试 readkernel()函数
- shoelace源代码分析,bochs调试-67870
- shoelace源代码分析,bochs调试winiboot
- shoelace源代码分析,bochs调试winiboot2,int0x13的算法
- shoelace源代码分析之winiboot
- shoelace源代码分析之bootlace
- shoelace源代码分析之disktab
- shoelace源代码分析之shoe.c
- shoelace源代码分析之shoebfs -scanzone()函数分析
- 用bochs调试bootsect/setup/head
- setup.s源码分析
- 利用GDB和Bochs调试内核源代码
- bochs 调试Orange'S系统的方法
- 利用Bochs调试linux的启动过程
- 全面解析RS232 RS422 RS485的本质区别
- 缓冲区
- 混日子
- ejabberd服务器安装配置
- 《数据仓库工具箱:维度建模的完全指南》笔记总结
- shoelace源代码分析,bochs调试过程,setup.s
- 嵌入式 书籍
- WPF和XAML基础
- 黑马程序员-Java初级-毕向东Java视频-第二天-编程基础1
- jbpm4 candidate理解
- Ext4.1中文API文档已经全部翻译完成!
- 记一次AIX下做系统镜像的记录
- c++ 对象模型 (备忘)
- string类的用法总结 标准C++中的