wok-6.x diff memtest/stuff/unpack.S @ rev 20184

memtest, ipxe: update bootsector
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Feb 01 12:59:51 2018 +0100 (2018-02-01)
parents 1193fa3c9d1e
children 17a7f1c3ddc6
line diff
     1.1 --- a/memtest/stuff/unpack.S	Sat May 06 08:25:09 2017 +0200
     1.2 +++ b/memtest/stuff/unpack.S	Thu Feb 01 12:59:51 2018 +0100
     1.3 @@ -1,4 +1,3 @@
     1.4 -#define TOP		(0x90000+_start-end)
     1.5  #define SYSTEM		0x10000
     1.6  #define SETUP		14
     1.7  #define SYSSIZE		0x1F4
     1.8 @@ -11,11 +10,22 @@
     1.9  #define FLAT16			1
    1.10  //#define FLAT16OUT		0
    1.11  #define SAVEREGS		0 
    1.12 +#define ELKS			1
    1.13  
    1.14  	.text
    1.15  	.code16
    1.16  	.org	0
    1.17  
    1.18 +#if ELKS
    1.19 +	.arch	i8086
    1.20 +#define FLAT16			1
    1.21 +#define LINUX_HEADER		0
    1.22 +#define SAVEREGS		0 
    1.23 +#define TOPSEG		0x2000
    1.24 +#else
    1.25 +#define TOPSEG		0x8000
    1.26 +#endif
    1.27 +
    1.28  	.globl	_start
    1.29  _start:
    1.30  #if LINUX_HEADER
    1.31 @@ -50,20 +60,35 @@
    1.32  	pushw	$0
    1.33  # endif
    1.34  #endif
    1.35 +#if ELKS
    1.36 +	movw	$0x100, %ax
    1.37 +	pushw	%ax
    1.38 +#else
    1.39  #if UPDATE_SYSSIZE
    1.40  	pushw	%ds			// <A>
    1.41  #else
    1.42  	pushw	%cs			// <A>
    1.43  #endif
    1.44 +#endif
    1.45  #if FLAT16
    1.46 -# 1- move 9020..9020+stp -> 8000
    1.47 -	pushw	$0x8000
    1.48 +# 1- move 9020..9020+stp -> TOPSEG
    1.49 +#if ELKS
    1.50 +	movb	$TOPSEG/256, %ah
    1.51 +	movw	%ax, %es
    1.52 +#else
    1.53 +	pushw	$TOPSEG
    1.54  	popw	%es
    1.55 +#endif
    1.56  	movw	$0x200, %si
    1.57  #if SAVEREGS == 0
    1.58  	pushw	%es
    1.59 +#if ELKS
    1.60 +	movw	$cont, %ax
    1.61 +	pushw	%ax
    1.62 +#else
    1.63  	// pushw	$cont
    1.64  	.byte	0x6A, cont
    1.65 +#endif
    1.66  	jmp	jumpinto
    1.67  #else
    1.68  # if HARDCODED_SETUPSIZE
    1.69 @@ -82,28 +107,48 @@
    1.70  	lret
    1.71  #endif
    1.72  cont:
    1.73 -# 2- move 1000..1000+sys -> 8000+stp
    1.74 +# 2- move 1000..1000+sys -> TOPSEG+stp
    1.75 +#if ELKS
    1.76 +	movw	$0x1000, %ax
    1.77 +	movw	%ax, %ds
    1.78 +#else
    1.79  	pushw	$0x1000
    1.80  	popw	%ds
    1.81 +#endif
    1.82  	xorw	%si, %si
    1.83  	subw	%di, %cx
    1.84  	rep
    1.85  	  movsb
    1.86 -# 3- unlz(8000+stp:end, 1000-stp:0)
    1.87 +# 3- unlz(TOPSEG+stp:end, 1000-stp:0)
    1.88  	pushw	%es		// <C>
    1.89  # if HARDCODED_SETUPSIZE
    1.90  setup_seg:
    1.91 +#if ELKS
    1.92 +#  if UPDATE_SYSSIZE
    1.93 +	movw	$0x1000-(SETUP*32)-32, %ax
    1.94 +#  else
    1.95 +	movw	$0x1000-(SETUP*32), %ax
    1.96 +#  endif
    1.97 +	movw	%ax, %es
    1.98 +#else
    1.99  #  if UPDATE_SYSSIZE
   1.100  	pushw	$0x1000-(SETUP*32)-32
   1.101  #  else
   1.102  	pushw	$0x1000-(SETUP*32)
   1.103  #  endif
   1.104  	popw	%es
   1.105 +#endif
   1.106  # else
   1.107  #  if UPDATE_SYSSIZE
   1.108  	incb	%dh
   1.109  #  endif
   1.110 +#if ELKS
   1.111 +	shrw	$1, %dx
   1.112 +	shrw	$1, %dx
   1.113 +	shrw	$1, %dx
   1.114 +#else
   1.115  	shrw	$3, %dx
   1.116 +#endif
   1.117  	movw	%ds, %ax
   1.118  	subw	%dx, %ax
   1.119  	movw	%ax, %es
   1.120 @@ -140,7 +185,13 @@
   1.121  # else
   1.122  	movb	%ss:SETUPSIZE, %ch
   1.123  	movw	%cx, %ax
   1.124 +#if ELKS
   1.125 +	shrw	$1, %ax
   1.126 +	shrw	$1, %ax
   1.127 +	shrw	$1, %ax
   1.128 +#else
   1.129  	shrw	$3, %ax
   1.130 +#endif
   1.131  	subw	%ax, %dx
   1.132  # endif
   1.133  	pushw	%cx			// <B>
   1.134 @@ -225,6 +276,9 @@
   1.135  
   1.136  unpack:
   1.137  #define NO_LZMA_HEADER
   1.138 +#if ELKS
   1.139 +#define ONLY8086	1
   1.140 +#endif
   1.141  #include "unlzma.S"
   1.142  
   1.143  end: