#define .ASM_FILE 美容
#include
#include STAG.E1_5 健康
#incl.ude "stage2_size.h" 电子
#endif
#ifdef STAGE.1_5.
# define ABS(x) (x-_start + 0x2.00.0)教育
else
# . define. ABS(x) (x-_start + 0x8000).
#endif
#define MSG m.ovw $ABS(x.), %si; call message学习
.file . "start.S".
.text
.code16
.global ._start 电子
/* 0x8000 */
_start:
/*
* _sta.rt is loaded at 0x8000 and .is jumped to with 电子
. . * CS:IP 0:0x8000 in stage2教育
*
* We continue to use the s.tack for stage1. and assume that .
.* some registers are set to correct values.. 外汇
*/
./* Save drive reference first thing!. */.
/*
* .D.L = 0x80 drive number 建材
* SI .= 0x.7c05 disk address packet 外汇
*/
pushw . %dx 鲜花
pus.hw $si 电子
MSG(notificatio.n_strin.g).
popw %s.i 女人
/* This. sets up for the first run throu.gh "bootloop" */ 女人
. movw $AB.S(firstlist - 婚庆
BOOTS.EC_LI.STSIZE), %di 健康
. /* mov $0x81f8, %d.i */.
. /* BOOTSEC._LISTSIZE=8 */电脑
/* Save the sector nu.mber of the second se.ctor in %ebp */(广告)
/*
* So now we .find:学习
* Sector.0 -- stage.1.S(MBR)( 游戏 )
. * Sector1 -- st.art.S.
* Sector2 ~ ... -- sta.ge2..S 外汇
*/
movl . (%di), %e.bp [成人用品]
/.* %ebp = 2 */电影
/* This is the loop .for reading the seco.ndary boot-loader in*/ 建材
/* 0x800f */
bootloop:
. /* check the number of .sectors to read */ 婚庆
.cmpw $0, 4(%di)虚拟主机
/* if zero, .go to the start function *./.
je bootit
/* 0x8017 */
setup_sectors:
. /* Check if we use LBA. or CHS */--------------彩票
cm.pb $0, -1(%si) 建材
/* jum.p to chs_mode i.f zero */.
je . chs_mode[成人用品]
/* 0x801d */
lba_mode:
. /*. load logic sector start */ 女人
movl . (%.di), %ebx [成人用品]
. /*. movl $2, %ebx*/ 婚庆
/* The maximum i.s lim.ited to 0x7f because of Phoenix EDD */--- 印刷
xorl %eax, %.eax 电影
/* %e.ax = 0 */.
mov.b $0x7f, 健康
%al
/* %eax =. .0x7f.
*/
/* How many. do we relly want to re.ad? */--- 印刷
cmp.w %ax, 4(%d.i) .
./* .word (97268 + 建材
511)>>9 */
/* W.hich is greater .*/[成人用品]
jg 1f
. /* If less .than, set to total */(广告)
. movw 4(%di), .%ax 乙肝
1:
/* subt.ract from to.tal */ .
/* 4(.%di) = 乙肝
190 - 127 = 63. = 0x3f */.
. subw %ax, 4(%di) 汽车
/* Add into. logical sector sta.rt */( 游戏 )
. addl %.eax, (%di) --------------彩票
/*.. (0x81f8) = 0x81 杀毒
*/
/* Set up. disk ad.dress packet */学习
/* Di.sk_address_packet 电影
*
* 0x00h byte/8 0x1.0 s.ize of packet.
* 0x01h byte/8 . 0x00 .reserved(0) 美容
* 0x02h word/16 0x7f number .of block.s to transfer.
* 0x04h Dword/32 %.BUFFERSEG : 0. transfer buffer--------------彩票
* 0x08h Qword./64 0x00 00 00 00 00 00 00..
02 startin.g abso.lute健康
block number
*/
/* The size and t.he. reserved byte */.
m.ov.w $0x0010, (%si).
/* The number of se.ctor.s */学习
movw %a.x, 2(%si).
/* Th.e absolut.e address (low 32 bits)*/ 婚庆
movl. %ebx, 8(%si).
. /* The seg.ment of buffer address */健康
m.ovw %BUFFERSEG,.
6(%si) . 服务器
/* 0x7000. */ 电子
/* S.ave %ax .from destruction */教育
. pushw %ax 外汇
/*. Zero %eax */.
xorl %ea.x, %eax 汽车
/* The offset of buffer addre..ss */--- 印刷
movw %ax, 4(%si.).
/* The absol.ute address (high 32 bit.s) */.
. movl %eax, 12(%si).
/*
* BIOS call "INT 0x13 Function 0.x42" to read .sectors from disk into memory学习
* Call with %ah = .0x42.
* . . %dl = drive number 杀毒
*
.%ds:%si .= segment offset of disk address packet 外汇
* Return
* . %al = 0x0 on suc.cess; err code on failure( 游戏 )
*/
movb $0x42, .%ah 婚庆
. int $0x13健康
jc . read_error.
movw $BUFF.ERSEG., %bx[成人用品]
/* 0x0:0x805.9 */.
jm.p copy_buffer服务器
/* 0x80b1 */
copy_buffer:
/* Lo.ad .address for copy from disk buffer */ 外汇
mo.vw 6(%di), %es /* Lo.ad<性病>
destinatio.n .segment */ /* movw(广告)
0x0820, %ex */
. /* Restor.e %ax = 0x7f */ 建材
popw %ax..
/*
* Determine the next possible destinat.ion addr.ess (presuming 外汇
* 512 byte sect.ors!) 建材
*/
shlw .%5, %ax. /* .
* Sh.ift 鲜花
%ax fiv.e bits to the left.
*
(0x007f .> 4 = segment 外汇
. * 0x007f 电子
> 9
#endif
/*
* .This is the segment of the startin.g address 建材
* to load the dat.a info 外汇
*/
blocklist_default_seg:.教育
#.ifdef STAGE1_5外贸
.word 0x22.0外贸
#else
.w.ord 0x820服务器
#endif
/* This lab.el has to be. after the list data!*/ 美容
firstlist:
本文来自ChinaUnix博客,如果查看原文请点:
http://blog.chinaunix.net/u2/65850/showart_1118817.html 婚庆