wok-6.x rev 19203

linld/tobzimage: add realmode_switch support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 11 15:57:21 2016 +0200 (2016-06-11)
parents d5596dfb8eb2
children df186455938f
files linld/receipt linld/stuff/jump.u linld/stuff/tobzimage linld/stuff/tobzimage.S linux/stuff/linux-slitaz.config linux/stuff/linux-slitaz.config64
line diff
     1.1 --- a/linld/receipt	Sat Jun 11 13:56:06 2016 +0300
     1.2 +++ b/linld/receipt	Sat Jun 11 15:57:21 2016 +0200
     1.3 @@ -19,6 +19,7 @@
     1.4  	mv DIST $src 2> /dev/null
     1.5  	cd $src
     1.6  	patch -p0 < $stuff/load.u
     1.7 +	patch -p0 < $stuff/jump.u
     1.8  	sed -i 's/^@pause/rem &/' LINLD097/*.BAT
     1.9  	unix2dos > MAKE.BAT <<EOT
    1.10  d:
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linld/stuff/jump.u	Sat Jun 11 15:57:21 2016 +0200
     2.3 @@ -0,0 +1,47 @@
     2.4 +--- LINLD097/JUMP.ASM
     2.5 ++++ LINLD097/JUMP.ASM
     2.6 +@@ -24,33 +24,22 @@
     2.7 +                         jmpseg  :word,  \
     2.8 +                         jmpofs  :word   = PARAM_SIZE
     2.9 + 
    2.10 +-                push    bp      ;TODO: kinda useless, isn't it?
    2.11 +-		mov	bp,sp
    2.12 +-
    2.13 +-              ;;mov     ax,[jmpseg]     ;Move data to CS segment var
    2.14 +-              ;;mov     [seg2],ax       ;  we cannot use any other seg!
    2.15 +-              ;;mov     ax,[jmpofs]     ;
    2.16 +-              ;;mov     [ofs2],ax       ;
    2.17 +-                mov     cx,[jmpofs]     ;Do NOT load in r32:
    2.18 +-                mov     dx,[jmpseg]     ;  wrong order!
    2.19 +-
    2.20 +-                mov     ax,[sreg]
    2.21 +-                mov     sp,[stk]        ;Do not use [bp+n] after this...
    2.22 +-                mov     ds,ax
    2.23 +-                mov     es,ax
    2.24 +-                mov     ss,ax
    2.25 +-                mov     fs,ax
    2.26 +-                mov     gs,ax
    2.27 ++		pop	bx		;caller return address
    2.28 ++		pop	bx		; sreg
    2.29 ++		pop	ax		; stk
    2.30 ++		pop	dx		; jmpseg
    2.31 ++		pop	cx		; jmpofs
    2.32 ++                mov     ds,bx
    2.33 ++                mov     es,bx
    2.34 ++                mov     fs,bx
    2.35 ++                mov     gs,bx
    2.36 ++                mov     ss,bx
    2.37 ++                xchg	sp,ax
    2.38 + 		assume	nothing
    2.39 + 		assume	cs:DGROUP
    2.40 + 
    2.41 +-              ;;jmp     [dword ofs2]
    2.42 +-
    2.43 +                 push    dx cx
    2.44 +                 retf
    2.45 +-; Data
    2.46 +-;;ofs2            dw      ?
    2.47 +-;;seg2            dw      ?
    2.48 +         endp    _set_sregs_jump_seg_ofs
    2.49 + 
    2.50 +         ends    _TEXT
     3.1 --- a/linld/stuff/tobzimage	Sat Jun 11 13:56:06 2016 +0300
     3.2 +++ b/linld/stuff/tobzimage	Sat Jun 11 15:57:21 2016 +0200
     3.3 @@ -60,7 +60,7 @@
     3.4  		s="$2"
     3.5  		[ -s "$2" ] && s="$(cat "$2")"
     3.6  		echo -e "\n$2" | tr '\n' '\r' | cat - /dev/zero | \
     3.7 -		dd conv=notrunc of=$1 bs=1 seek=640 count=383
     3.8 +		dd conv=notrunc of=$1 bs=1 seek=768 count=255
     3.9  	fi
    3.10  	setupsz=$(get 497 $1 1)
    3.11  	[ $setupsz -eq 0 ] && setupsz=4
     4.1 --- a/linld/stuff/tobzimage.S	Sat Jun 11 13:56:06 2016 +0300
     4.2 +++ b/linld/stuff/tobzimage.S	Sat Jun 11 15:57:21 2016 +0200
     4.3 @@ -1,6 +1,10 @@
     4.4 +#define REALMODE_SWITCH
     4.5 +#define SHUTDOWNDOS
     4.6 +
     4.7  	.code16
     4.8  	.org	0
     4.9  
    4.10 +#define CODE32_START	0x100000
    4.11  	jmp	start
    4.12  	.ascii	"HdrS"
    4.13  	.word	0x200		# version
    4.14 @@ -10,51 +14,99 @@
    4.15  	.byte	0		# type of loader
    4.16  	.byte	1		# loadflags
    4.17  	.word	0x8000		# setup_move_size
    4.18 -	.long	0x100000	# code32_start
    4.19 +	.long	CODE32_START	# code32_start
    4.20   	.long	0		# ramdisk_image
    4.21  	.long	0		# ramdisk_size
    4.22  	.long 	0		# bootsect_kludge
    4.23  	.word	0		# heap_end_ptr	2.01+, patched by bootloader
    4.24 +
    4.25  start:
    4.26 +	cli
    4.27 +	cld
    4.28  	pushf
    4.29 -	cld
    4.30  	pushw	%cs
    4.31  	pushw	$0
    4.32  	pushaw
    4.33 -	pushw	%ds
    4.34 -	popw	%es
    4.35 -	.byte	0x66, 0xB8	# movl $?, %eax
    4.36 +	xorw	%di, %di
    4.37 +	.byte	0x66, 0xC7, 0x05	# movl $?, (%di)
    4.38  	rep
    4.39  	  movsw
    4.40  	popaw
    4.41  	iret
    4.42 -	xorw	%di, %di
    4.43 -	pushw	%es
    4.44 +	pushw	%ds
    4.45  	pushw	%di
    4.46 -	stosl
    4.47 -	movw	$0x200, %di
    4.48 -	movw	%sp, %bp
    4.49 +#ifdef REALMODE_SWITCH
    4.50 +	movw	$0x0208, %si
    4.51 +	lodsw
    4.52 +	orw	(%si), %ax
    4.53 +	jz	norealmode_switch
    4.54 +	lcallw	*-2(%si)
    4.55 +norealmode_switch:
    4.56 +#endif
    4.57 +
    4.58 +#ifdef SHUTDOWNDOS
    4.59 +	xorw	%si, %si
    4.60 +	movw	%sp, loadsp19+0x201
    4.61 +        movw	%si, %ds		# %ds = 0
    4.62 +	pushl	4(%si)
    4.63 +	cmpw	$0xF000, 6(%si)
    4.64 +	jnb	notdos
    4.65 +        movw	$step19, 4(%si)
    4.66 +        movw	%cs, 6(%si)
    4.67 +        pushfw
    4.68 +        popw	%ax
    4.69 +        incb	%ah			# set TF
    4.70 +        pushw	%ax
    4.71 +        popfw
    4.72 +        ljmp	*4*0x19(%si)
    4.73 +stepagain19:
    4.74 +        iret
    4.75 +step19:
    4.76 +        pushw	%si
    4.77 +        pushw	%ds
    4.78 +        movw	%sp, %si
    4.79 +        ldsw	%ss:4(%si), %si
    4.80 +        cmpw	$0x19CD, (%si)
    4.81 +        popw    %ds
    4.82 +        popw    %si
    4.83 +	jne	stepagain19
    4.84 +	xorw	%si, %si
    4.85 +	mov	%si, %ds
    4.86 +	popl	4*0x19(%si)
    4.87 +notdos:
    4.88 +loadsp19:
    4.89 +	movw	$0, %bp
    4.90 +	leaw	-4(%bp), %sp
    4.91 +	popl	4(%si)
    4.92 +	pushw	%ss
    4.93 +	popw	%ds
    4.94 +#endif
    4.95 +
    4.96 +//	xorw	%si, %si
    4.97  	movw	$9, %cx
    4.98  z1:
    4.99 -	pushw	$0
   4.100 +	pushw	%si		# 0000 0000 0000 0000 0000 0000 0000 0000 0000
   4.101  	loop	z1
   4.102  	movw	$0x9301, %ax
   4.103 -	cwd			# %dx = -1
   4.104 -	pushw	%ax
   4.105 -	pushw	%cx
   4.106 -	pushw	%dx
   4.107 -	pushw	%cx
   4.108 +	cwd
   4.109 +	pushw	%ax		# 9301
   4.110 +	pushw	%cx		# 0000
   4.111 +	pushw	%dx		# FFFF
   4.112 +	pushw	%cx		# 0000
   4.113  	movb	0x216, %al
   4.114 -	pushw	%ax
   4.115 -	pushw	%cx
   4.116 -	pushw	%dx
   4.117 +	pushw	%ax		# 93xx
   4.118 +	pushw	%cx		# 0000
   4.119 +	pushw	%dx		# FFFF
   4.120  	movb	$8, %cl
   4.121  z2:
   4.122 -	pushw	$0
   4.123 +	pushw	%si		# 0000 0000 0000 0000 0000 0000 0000 0000
   4.124  	loop	z2
   4.125 +	movw	$0x200, %di
   4.126  	movw	-12(%di), %dx
   4.127 +	pushw	%ss
   4.128 +	popw	%es
   4.129 +	movw	%sp, %si
   4.130  mvlp:
   4.131 -	movw	%sp, %si
   4.132  	movw	$0x8000, %cx
   4.133  	movb	$0x87, %ah
   4.134  	int	$0x15
   4.135 @@ -62,14 +114,20 @@
   4.136  	incw	28(%si)
   4.137  	subw	$0x1000, %dx
   4.138  	ja	mvlp
   4.139 -	movw	%bp, %sp
   4.140 +	addw	$48, %sp
   4.141 +	decb	-15(%di)
   4.142 +sysmoved:
   4.143  	movw	$0x400, %si
   4.144  	xorw	%cx, %cx
   4.145 -	decb	-15(%di)
   4.146  	movb	-15(%di), %ch
   4.147  	lret
   4.148 +endcode:
   4.149 +	
   4.150 +	.org	256
   4.151  kernel_version:
   4.152  	.asciz	"zImage"
   4.153  	.org	512
   4.154  oldsetup:
   4.155  
   4.156 +
   4.157 +
     5.1 --- a/linux/stuff/linux-slitaz.config	Sat Jun 11 13:56:06 2016 +0300
     5.2 +++ b/linux/stuff/linux-slitaz.config	Sat Jun 11 15:57:21 2016 +0200
     5.3 @@ -1149,7 +1149,7 @@
     5.4  # CONFIG_MTD is not set
     5.5  CONFIG_PARPORT=m
     5.6  CONFIG_PARPORT_PC=m
     5.7 -# CONFIG_PARPORT_SERIAL is not set
     5.8 +CONFIG_PARPORT_SERIAL=m
     5.9  # CONFIG_PARPORT_PC_FIFO is not set
    5.10  # CONFIG_PARPORT_PC_SUPERIO is not set
    5.11  # CONFIG_PARPORT_PC_PCMCIA is not set
     6.1 --- a/linux/stuff/linux-slitaz.config64	Sat Jun 11 13:56:06 2016 +0300
     6.2 +++ b/linux/stuff/linux-slitaz.config64	Sat Jun 11 15:57:21 2016 +0200
     6.3 @@ -1118,7 +1118,7 @@
     6.4  # CONFIG_MTD is not set
     6.5  CONFIG_PARPORT=m
     6.6  CONFIG_PARPORT_PC=m
     6.7 -# CONFIG_PARPORT_SERIAL is not set
     6.8 +CONFIG_PARPORT_SERIAL=m
     6.9  # CONFIG_PARPORT_PC_FIFO is not set
    6.10  # CONFIG_PARPORT_PC_SUPERIO is not set
    6.11  # CONFIG_PARPORT_PC_PCMCIA is not set