wok diff linux/stuff/linux-header-2.6.34.u @ rev 5640
Up: linux (2.6.34) Add new drivers, clean-up receipt and stuff, fix linux-video build
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri May 28 21:08:44 2010 +0200 (2010-05-28) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/linux/stuff/linux-header-2.6.34.u Fri May 28 21:08:44 2010 +0200 1.3 @@ -0,0 +1,469 @@ 1.4 +--- linux-2.6.30.6/arch/x86/boot/header.S 1.5 ++++ linux-2.6.30.6/arch/x86/boot/header.S 1.6 +@@ -6,7 +6,7 @@ 1.7 + * Based on bootsect.S and setup.S 1.8 + * modified by more people than can be counted 1.9 + * 1.10 +- * Rewritten as a common file by H. Peter Anvin (Apr 2007) 1.11 ++ * Rewritten Pascal Bellard (Nov 2009) 1.12 + * 1.13 + * BIG FAT NOTE: We're in real mode using 64k segments. Therefore segment 1.14 + * addresses must be multiplied by 16 to obtain their respective linear 1.15 +@@ -27,6 +27,8 @@ 1.16 + 1.17 + BOOTSEG = 0x07C0 /* original address of boot-sector */ 1.18 + SYSSEG = 0x1000 /* historical load address >> 4 */ 1.19 ++INITSEG = 0x9000 /* boot address >> 4 */ 1.20 ++SETUPSEG = 0x9020 /* setup address >> 4 */ 1.21 + 1.22 + #ifndef SVGA_MODE 1.23 + #define SVGA_MODE ASK_VGA 1.24 +@@ -40,53 +42,412 @@ 1.25 + #define ROOT_RDONLY 1 1.26 + #endif 1.27 + 1.28 ++/* some extra features */ 1.29 ++#define EDIT_CMDLINE on hotkey 1.30 ++#define SHOW_REGS show int13 status & parameters 1.31 ++ 1.32 + .code16 1.33 + .section ".bstext", "ax" 1.34 + 1.35 + .global bootsect_start 1.36 + bootsect_start: 1.37 ++ cld # assume nothing 1.38 ++stacktop = 0x9E00 # in 0x8000 .. 0xA000 1.39 ++zeroed = 48+10 # gdt + zeroed registers 1.40 ++ movw $stacktop-12-zeroed, %di # stacktop is an arbitrary value >= 1.41 ++ # length of bootsect + length of 1.42 ++ # setup + room for stack; 1.43 ++ # 12 is disk parm size. 1.44 ++ pushw $INITSEG 1.45 ++ popw %es # %es = INITSEG 1.46 ++ 1.47 ++ pushw %es 1.48 ++ popw %ss # %ss and %es already contain INITSEG 1.49 ++ movw %di, %sp # put stack at INITSEG:stacktop-... 1.50 ++ 1.51 ++# Many BIOS's default disk parameter tables will not recognize 1.52 ++# multi-sector reads beyond the maximum sector number specified 1.53 ++# in the default diskette parameter tables - this may mean 7 1.54 ++# sectors in some cases. 1.55 ++# 1.56 ++# Since single sector reads are slow and out of the question, 1.57 ++# we must take care of this by creating new parameter tables 1.58 ++# (for the first disk) in RAM. We can set the maximum sector 1.59 ++# count to 36 - the most we will encounter on an ED 2.88. 1.60 ++# 1.61 ++# High doesn't hurt. Low does. Let's use the max: 63 1.62 ++# 1.63 ++# Segments are as follows: %es = %ss = INITSEG, 1.64 ++ 1.65 ++ xorw %ax, %ax # %ax = 0 1.66 ++ movw $zeroed/2, %cx # clear gdt + offset, %ds, limits 1.67 ++ rep # don't worry about cld 1.68 ++ stosw # already done above 1.69 ++ popw %bx # offset = 0 1.70 ++ popw %ds # %ds = 0 1.71 ++ popw %gs # %gs = 0 1.72 ++ 1.73 ++ movb setup_sects+0x7C00, %al # read bootsector + setup (%ds = 0) 1.74 ++ incw %ax 1.75 ++ 1.76 ++ pushw %es 1.77 ++ pushw %di # %ds:%bx+0x78 is parameter table address 1.78 ++ ldsw 0x78(%bx), %si # %ds:%si is source 1.79 ++ movb $6, %cl # copy 12 bytes 1.80 ++ rep # don't worry about cld 1.81 ++ movsw # already done above 1.82 ++ popl %gs:0x78(%bx) # update parameter table address 1.83 ++ pushw %es 1.84 ++ popw %ds # now %ds = %es = %ss = INITSEG 1.85 ++ movb $63, 0x4-12(%di) # patch sector count, %di = stacktop 1.86 ++ cli 1.87 ++ 1.88 ++ xchg %ax, %di # sector count 1.89 ++ popw %ax # limits = 0 1.90 ++ incw %cx # cylinder 0, sector 1 1.91 ++ call read_first_sectors # read setup 1.92 ++ 1.93 ++offset_version = 0xE 1.94 ++ movw $0x200,%si 1.95 ++ addw offset_version(%si),%si # starting protocol 2.00, Kernel 1.3.73 1.96 ++ call putstr # show which kernel we are loading 1.97 ++ 1.98 ++# The cmdline can be entered and modifed at boot time. 1.99 ++# Only characters before the cursor are passed to the kernel. 1.100 ++ popw %bx # clear %bx 1.101 ++ orw cmd_line_ptr, %bx 1.102 ++ jz nocmdline 1.103 ++ pushw %bx 1.104 ++ incw %di 1.105 ++ call read_sectors 1.106 ++ popw %si 1.107 ++ call putstr 1.108 ++#ifdef EDIT_CMDLINE 1.109 ++cmdlp: 1.110 ++ movb $0x20, %al # clear end of line 1.111 ++ int $0x10 # with Space 1.112 ++ movb $8, %al # and BackSpace 1.113 ++ int $0x10 1.114 ++ decw %si 1.115 ++cmdget: 1.116 ++ call wait4key 1.117 ++ cmpb $8, %al # BackSpace ? 1.118 ++ je cmdbs 1.119 ++ movb %al, (%si) # store char 1.120 ++ lodsw # %si += 2 1.121 ++cmdbs: 1.122 ++#if 1 1.123 ++ cmpw %si,cmd_line_ptr 1.124 ++ je cmdget 1.125 ++#endif 1.126 ++ call putc # set %ah and %bx 1.127 ++ cmpb $10, %al # Enter ? 1.128 ++ jne cmdlp 1.129 ++ movb %bh,-2(%si) # set end of string and remove CR 1.130 ++endcmdline: 1.131 ++#endif 1.132 ++nocmdline: 1.133 + 1.134 +- # Normalize the start address 1.135 +- ljmp $BOOTSEG, $start2 1.136 +- 1.137 +-start2: 1.138 +- movw %cs, %ax 1.139 +- movw %ax, %ds 1.140 +- movw %ax, %es 1.141 +- movw %ax, %ss 1.142 +- xorw %sp, %sp 1.143 +- sti 1.144 +- cld 1.145 +- 1.146 +- movw $bugger_off_msg, %si 1.147 ++# This routine loads the system at address SYSSEG, making sure 1.148 ++# no 64kB boundaries are crossed. We try to load it as fast as 1.149 ++# possible, loading whole tracks whenever we can. 1.150 ++ 1.151 ++ramdisk_image = 0x0218 1.152 ++ramdisk_size = 0x021C 1.153 ++ movw %sp, %si # for bootsect_gdt 1.154 ++ decw 16(%si) # bootsect_src = 64Kb 1.155 ++ decw 24(%si) # bootsect_dst = 64Kb 1.156 ++ movw $syssize, %di 1.157 ++type_of_loader = 0x210 1.158 ++loadflags = 0x211 1.159 ++heap_end_ptr = 0x224 1.160 ++ksyssize = 500 1.161 ++ orw $0x80FF, type_of_loader-ksyssize(%di) # loader type = 0xFF 1.162 ++ movw $stacktop-0x200, heap_end_ptr-ksyssize(%di) 1.163 ++ movb $0x10, %al # destination = 0x100000 1.164 ++ movb $5, %cl 1.165 ++initrdlp: 1.166 ++ decw %ax 1.167 ++ movb $0x93,%ah 1.168 ++ movw %ax, 28(%si) # bootsect_dst_base+2 1.169 ++ movb $(SYSSEG/4096), %al # source = SYSSEG 1.170 ++ movw %ax, 20(%si) # bootsect_src_base+2 1.171 ++ cbw 1.172 ++ cwde 1.173 ++ shlw %cl, %ax 1.174 ++ decw %ax 1.175 ++ addl (%di),%eax 1.176 ++ shrl %cl, %eax 1.177 ++syslp: 1.178 ++ pushw $SYSSEG 1.179 ++ popw %es 1.180 ++ movw $128,%di # 64Kb 1.181 ++ subw %di, %ax # max 32M > int 15 limit 1.182 ++ pushf 1.183 ++ jnc not_last 1.184 ++ addw %ax, %di 1.185 ++not_last: 1.186 ++ xorw %bx, %bx # clear %bx 1.187 ++ pushw %ax 1.188 ++#if defined(SHOW_REGS) 1.189 ++ pushw %si 1.190 ++ call read_sectors 1.191 ++ popw %si 1.192 ++#else 1.193 ++ call read_sectors 1.194 ++#endif 1.195 ++ movw $0x8000, %cx # full 64K 1.196 ++ movb $0x87, %ah 1.197 ++ incb 28(%si) # bootsect_dst_base+2 1.198 ++ int $0x15 # max 16M 1.199 ++ popw %ax 1.200 ++ popf 1.201 ++ ja syslp 1.202 ++ movw ramdisk_image+2,%ax 1.203 ++ movw $ramdisk_size,%di 1.204 ++ movb $9, %cl 1.205 ++ cmpb %al,28(%si) 1.206 ++ jb initrdlp 1.207 ++ 1.208 ++# This procedure turns off the floppy drive motor, so 1.209 ++# that we enter the kernel in a known state, and 1.210 ++# don't have to worry about it later. 1.211 ++ 1.212 ++#if 1 1.213 ++kill_motor: 1.214 ++ xchgw %ax, %bx # reset FDC 1.215 ++ int $0x13 1.216 ++#else 1.217 ++kill_motor: 1.218 ++ movw $0x3f2, %dx 1.219 ++ xchgw %ax, %bx 1.220 ++ outb %al, %dx 1.221 ++#endif 1.222 + 1.223 +-msg_loop: 1.224 +- lodsb 1.225 +- andb %al, %al 1.226 +- jz bs_die 1.227 +- movb $0xe, %ah 1.228 +- movw $7, %bx 1.229 ++# After that (everything loaded), we jump to the setup-routine 1.230 ++# loaded directly after the bootblock: 1.231 ++# Segments are as follows: %ds = %ss = INITSEG 1.232 ++ 1.233 ++ ljmp $SETUPSEG, $0 1.234 ++ 1.235 ++# read_sectors reads %di sectors into %es:0 buffer. 1.236 ++# %es:0 is updated to the next memory location. 1.237 ++# First, sectors are read sector by sector until 1.238 ++# sector per track count is known. Then they are 1.239 ++# read track by track. 1.240 ++# Assume no error on first track. 1.241 ++ 1.242 ++#define FLOPPY_CYLINDERS 80 /* 80 cylinders minimum */ 1.243 ++#define FLOPPY_HEADS 2 /* 2 heads minimum */ 1.244 ++#define FLOPPY_SECTORS 18 /* 18 sectors minimum */ 1.245 ++ 1.246 ++#ifdef SHOW_REGS 1.247 ++print_loop: 1.248 ++ movb $0x6 + 'A' - 1, %al 1.249 ++ subb %cl, %al 1.250 ++ movw $regs, %si # caller %si is saved 1.251 ++ call putcs # putc(%al) + putstr(%si) 1.252 ++# it will print out all of the registers. 1.253 ++ popw %bp # load word into %si 1.254 ++ jmp print_all # print %bp (status) 1.255 ++#endif 1.256 ++check_limits: 1.257 ++#ifndef SHOW_REGS 1.258 ++ popw %dx 1.259 ++#endif 1.260 ++ cmpb $FLOPPY_SECTORS+1, %cl # 18 sectors minimum 1.261 ++ jb check_head 1.262 ++ cmpb %al, %cl # max sector known ? 1.263 ++ ja next_head # no -> store it 1.264 ++check_head: 1.265 ++ cmpb $FLOPPY_HEADS, %dh # 2 heads minimum 1.266 ++ jb check_cylinder 1.267 ++ cmpb %ah, %dh # max head known ? 1.268 ++ ja next_cylinder # no -> store it 1.269 ++check_cylinder: 1.270 ++ pushaw 1.271 ++#ifdef SHOW_REGS 1.272 ++ cmpw $0x600,%bp # disk changed ? 1.273 ++ je reset_floppy 1.274 ++ pushw %es # print %es (named EX) 1.275 ++ pushw %dx # print %dx 1.276 ++ pushw %cx # print %cx 1.277 ++ pushw %bx # print %bx 1.278 ++ xchgw %ax, %si 1.279 ++ movb $2,%ah 1.280 ++ pushw %ax # print %ax 1.281 ++ movb $6,%cl 1.282 ++print_all: 1.283 ++ movb $4, %ch # 4 hex digits 1.284 ++print_digit: 1.285 ++ rolw $4, %bp # rotate to use low 4 bits 1.286 ++ movb $0x0f, %al 1.287 ++ andw %bp, %ax # %al = mask for nybble 1.288 ++ addb $0x90, %al # convert %al to ascii hex 1.289 ++ daa # in only four instructions! 1.290 ++ adcb $0x40, %al 1.291 ++ daa 1.292 ++ call putc # set %ah and %bx 1.293 ++ decb %ch 1.294 ++ jnz print_digit 1.295 ++ movb $0x20, %al # SPACE 1.296 + int $0x10 1.297 +- jmp msg_loop 1.298 +- 1.299 +-bs_die: 1.300 +- # Allow the user to press a key, then reboot 1.301 +- xorw %ax, %ax 1.302 ++ loop print_loop 1.303 ++ call wait 1.304 ++ cbw # %ah = 0 1.305 ++reset_floppy: 1.306 ++#else 1.307 ++ cbw # %ah = 0 1.308 ++#endif 1.309 ++ int $0x13 # reset controler 1.310 ++ popaw 1.311 ++read_sectorslp: 1.312 ++ pushw %dx # some bios break dx... 1.313 ++ pushw %ax # limits 1.314 ++ subb %cl, %al # sectors remaining in track 1.315 ++ ja tolastsect 1.316 ++ movb $1, %al # 1 sector mini 1.317 ++tolastsect: 1.318 ++ cbw 1.319 ++ cmpw %di, %ax 1.320 ++ jb more1trk 1.321 ++ movw %di, %ax # sectors to read 1.322 ++more1trk: 1.323 ++ pushw %ax # save context 1.324 ++ movb $2, %ah # cmd: read chs 1.325 ++ int $0x13 1.326 ++#ifdef SHOW_REGS 1.327 ++ xchgw %ax, %bp # status 1.328 ++#endif 1.329 ++# ifdef SHOW_REGS 1.330 ++ popw %si # save %ax 1.331 ++ popw %ax # limits 1.332 ++ popw %dx 1.333 ++# else 1.334 ++ popw %dx # save %ax 1.335 ++ popw %ax # limits 1.336 ++# endif 1.337 ++ jc check_limits 1.338 ++ xchgw %ax, %bp 1.339 ++# ifdef SHOW_REGS 1.340 ++update_regs: 1.341 ++ incw %cx # next sector 1.342 ++ movw %cx, %fs 1.343 ++ addb $2,%bh # next location 1.344 ++ decw %di # update sector counter 1.345 ++ jz putcdot 1.346 ++ decw %si 1.347 ++ jnz update_regs 1.348 ++# else 1.349 ++ addw %dx,%cx # next sector 1.350 ++ addb %dl,%bh 1.351 ++ addb %dl,%bh # next location 1.352 ++ subw %dx,%di # update sector counter 1.353 ++ popw %dx 1.354 ++ jz putcdot 1.355 ++# endif 1.356 ++read_sectors: 1.357 ++ movw %fs, %cx 1.358 ++ xchgw %ax, %bp 1.359 ++ cmpb %al,%cl # reach sector limit ? 1.360 ++ jne bdendlp 1.361 ++next_head: 1.362 ++ movb %cl,%al 1.363 ++ incb %dh # next head 1.364 ++ movb $1,%cl # first sector 1.365 ++ cmpb %ah, %dh # reach head limit ? 1.366 ++ jne bdendlp 1.367 ++next_cylinder: 1.368 ++ movb %dh,%ah 1.369 ++# NOTE : support 256 cylinders max 1.370 ++ incb %ch # next cylinder 1.371 ++read_first_sectors: 1.372 ++ movb $0,%dh # first head 1.373 ++cylinder_count = 496 1.374 ++ cmpb $FLOPPY_CYLINDERS,%ch # reach cylinder limit ? 1.375 ++ jb bdendlp 1.376 ++ cmpb cylinder_count, %ch 1.377 ++ jb bdendlp 1.378 ++next_floppy: 1.379 ++ movb $0,%ch # first cylinder 1.380 ++ pushaw 1.381 ++ movw $swap_floppy,%si 1.382 ++ incb 12(%si) 1.383 ++ pushw %bx 1.384 ++ call putstr 1.385 ++ popw %bx 1.386 ++waitfloppy: 1.387 ++ call wait 1.388 ++ jne waitfloppydone 1.389 ++ pushw %dx # some bios break dx... 1.390 ++ cbw 1.391 ++ int $0x13 # reset FDC 1.392 ++ movw $0x201,%ax 1.393 ++# cwd 1.394 ++# movw $1,%cx 1.395 ++ int $0x13 # read first sector 1.396 ++ popw %dx 1.397 ++ rclb $1,%ah # floppy changed 06=>0D no error 00 1.398 ++ cmpb -2(%si), %ah # 0D then 00 1.399 ++ jne waitfloppy # no => try again 1.400 ++ incw %si 1.401 ++ orb %ah,%ah # was 00 ? 1.402 ++ jne waitfloppy 1.403 ++waitfloppydone: 1.404 ++ popaw 1.405 ++bdendlp: 1.406 ++ jmp read_sectorslp 1.407 ++ 1.408 ++putcdot: 1.409 ++ pushw %ss 1.410 ++ popw %es # restore es 1.411 ++ movb $0x2e+3, %al # loading... message 2e = . 1.412 ++putclf: 1.413 ++ subb $3, %al 1.414 ++putc: 1.415 ++ movb $0xe, %ah 1.416 ++ movw $7, %bx # one dot each 64k 1.417 ++ int $0x10 1.418 ++ cmp $0xd, %al # CR ? 1.419 ++ je putclf 1.420 ++ ret 1.421 ++ 1.422 ++putstr: 1.423 ++ movb $0xd, %al # CR 1.424 ++putcs: 1.425 ++ call putc 1.426 ++ lodsb 1.427 ++ orb %al,%al # end of string is \0 1.428 ++ jnz putcs 1.429 ++ ret 1.430 ++ 1.431 ++clock = 0x46C 1.432 ++wait: 1.433 ++wait4key: 1.434 ++ movw $clock, %di 1.435 ++#define DELAY 5 1.436 ++ movb $(DELAY*182)/10,%cl 1.437 ++ addb %gs:(%di),%cl 1.438 ++waitkbd: 1.439 ++ movw $0x10D, %ax # test keyboard, timeout => CR 1.440 ++ cmpb %gs:(%di),%cl 1.441 ++ je waitdone 1.442 + int $0x16 1.443 +- int $0x19 1.444 ++ jz waitkbd 1.445 ++ cbw 1.446 ++ int $0x16 # eat char 1.447 ++ movw %di, %gs # disable timeout 1.448 ++ incw %di # clear Z 1.449 ++waitdone: 1.450 ++ ret 1.451 + 1.452 +- # int 0x19 should never return. In case it does anyway, 1.453 +- # invoke the BIOS reset code... 1.454 +- ljmp $0xf000,$0xfff0 1.455 +- 1.456 +- .section ".bsdata", "a" 1.457 +-bugger_off_msg: 1.458 +- .ascii "Direct booting from floppy is no longer supported.\r\n" 1.459 +- .ascii "Please use a boot loader program instead.\r\n" 1.460 +- .ascii "\n" 1.461 +- .ascii "Remove disk and press any key to reboot . . .\r\n" 1.462 +- .byte 0 1.463 ++#ifdef SHOW_REGS 1.464 ++regs: .asciz "X:" 1.465 ++#endif 1.466 + 1.467 ++swap_floppy: .ascii "Insert disk 1" 1.468 ++ .ascii "." 1.469 ++ .byte 7,13,0 1.470 + 1.471 + # Kernel attributes; used by setup. This is part 1 of the 1.472 + # header, from the old boot sector.