wok rev 15981

syslinux-tools: add meminfo.exe
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Mar 01 19:10:36 2014 +0000 (2014-03-01)
parents df021be024df
children 45e76a6c05d7
files syslinux-tools/receipt syslinux/stuff/iso2exe/Makefile syslinux/stuff/iso2exe/bootlinux.c syslinux/stuff/iso2exe/meminfo.S
line diff
     1.1 --- a/syslinux-tools/receipt	Sat Mar 01 10:30:44 2014 +0000
     1.2 +++ b/syslinux-tools/receipt	Sat Mar 01 19:10:36 2014 +0000
     1.3 @@ -19,4 +19,5 @@
     1.4  		cp -a $src/utils/$i $fs/usr/bin
     1.5  	done
     1.6  	cp -a $src/iso2exe/isohybrid.exe $fs/usr/share/boot
     1.7 +	cp -a $src/iso2exe/meminfo.exe $fs/usr/share/boot
     1.8  }
     2.1 --- a/syslinux/stuff/iso2exe/Makefile	Sat Mar 01 10:30:44 2014 +0000
     2.2 +++ b/syslinux/stuff/iso2exe/Makefile	Sat Mar 01 19:10:36 2014 +0000
     2.3 @@ -2,7 +2,11 @@
     2.4  BCC=bcc -ansi -O -0 -C-t
     2.5  BCCFLAGS=-D__MSDOS__ -Md
     2.6  
     2.7 -all: isohybrid.exe iso2exe
     2.8 +all: isohybrid.exe iso2exe meminfo.exe
     2.9 +
    2.10 +meminfo.exe: meminfo.S
    2.11 +	cc -o meminfo.o -Wa,-a=meminfo.lst -c meminfo.S
    2.12 +	objcopy -O binary meminfo.o meminfo.exe
    2.13  
    2.14  iso2exe: iso2exe.sh boot.com bootiso.bin init win32.exe
    2.15  	cp iso2exe.sh $@
     3.1 --- a/syslinux/stuff/iso2exe/bootlinux.c	Sat Mar 01 10:30:44 2014 +0000
     3.2 +++ b/syslinux/stuff/iso2exe/bootlinux.c	Sat Mar 01 19:10:36 2014 +0000
     3.3 @@ -103,6 +103,17 @@
     3.4  #endasm
     3.5  }
     3.6  
     3.7 +static unsigned extendedramsizeinkb(void)
     3.8 +{
     3.9 +#asm
    3.10 +		mov	ah, #0x88
    3.11 +		int	0x15
    3.12 +		jnc	gottop
    3.13 +		xor	ax, ax
    3.14 +gottop:
    3.15 +#endasm
    3.16 +}
    3.17 +
    3.18  static void load(struct mem *p, unsigned long size)
    3.19  {
    3.20  	if (vm86())
    3.21 @@ -117,9 +128,9 @@
    3.22  		}
    3.23  		p->align = PAGE_SIZE;
    3.24  		break;
    3.25 -	case 4096: // first initrd : skip 0xF00000 .. 0x1000000 mapping hole
    3.26 -		initrd_addr = (p->base + size > 0xF00000 && 
    3.27 -				p->base < 0x1000000) ? 0x1000000 : p->base;
    3.28 +	case 4096: // first initrd : skip mapping hole before 16M
    3.29 +		initrd_addr = (extendedramsizeinkb() > 24000U) ?
    3.30 +				 0x1000000 : p->base;
    3.31  		p->align = 4;
    3.32  	}
    3.33  	while (size) {
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/syslinux/stuff/iso2exe/meminfo.S	Sat Mar 01 19:10:36 2014 +0000
     4.3 @@ -0,0 +1,209 @@
     4.4 +	.text
     4.5 +	.code16
     4.6 +	.org	0
     4.7 +stacktop	= 0xFFFE
     4.8 +
     4.9 +	.globl	_start
    4.10 +_start:
    4.11 +#if 1
    4.12 +#define EXEADRS(x)	x+0xE0
    4.13 +#define CODESZ 0x200
    4.14 +	decw	%bp			// Magic number: MZ
    4.15 +	popw	%dx
    4.16 +	jmp	start			// Bytes on last page of file
    4.17 +	.word	(CODESZ+511)/512	// Pages in file
    4.18 +	.word	0			// Relocations
    4.19 +	.word	(end_header-_start)/16	// Size of header in paragraphs
    4.20 +	.word	4096			// Minimum extra paragraphs needed
    4.21 +	.word	-1			// Maximum extra paragraphs needed
    4.22 +	.word	(CODESZ+15)/16		// Initial (relative) SS value
    4.23 +	.word	stacktop		// Initial SP value
    4.24 +	.word	0			// Checksum
    4.25 +	.word	EXEADRS(comstart)	// Initial IP value
    4.26 +	.word	0xFFF0			// Initial (relative) CS value
    4.27 +//	.word	0x001C			// File address of relocation table
    4.28 +//	.word	0,0,0			// Overlay number
    4.29 +start:
    4.30 +	pushw	%dx
    4.31 +	cld
    4.32 +	pushw	%cs
    4.33 +	call	comstart2
    4.34 +stop:
    4.35 +	hlt
    4.36 +	jmp	stop
    4.37 +end_header:
    4.38 +#endif
    4.39 +comstart:
    4.40 +	pushw	%cs
    4.41 +	call	comstart2
    4.42 +	int	$0x20
    4.43 +comstart2:
    4.44 +	call	here
    4.45 +here:
    4.46 +	popw	%ax
    4.47 +	subw	$here-_start, %ax
    4.48 +	shrw	$4, %ax
    4.49 +	movw	%cs, %dx
    4.50 +	addw	%ax, %dx
    4.51 +	pushw	%dx
    4.52 +	pushw	$go
    4.53 +	retf
    4.54 +go:
    4.55 +	pushw	%cs
    4.56 +	popw	%ds
    4.57 +	pushw	%cs
    4.58 +	popw	%es
    4.59 +	xorl	%ebx, %ebx
    4.60 +e820lp:
    4.61 +	movl	$0xe820, %eax
    4.62 +	movl	$0x534d4150, %edx
    4.63 +	movl	$20, %ecx
    4.64 +	movw	$buffer, %di
    4.65 +	int	$0x15
    4.66 +	jc	fail
    4.67 +	cmpl	$0x534d4150, %eax
    4.68 +	jne	fail
    4.69 +	cmpl	$20, %ecx
    4.70 +	jc	fail
    4.71 +	pushl	%ebx
    4.72 +	movw	$header_e820, %si
    4.73 +	call	puts64
    4.74 +	movw	$usable, %si
    4.75 +	cmpl	$1, (%di)
    4.76 +	je	show_status
    4.77 +	movw	$acpi_reclaim, %si
    4.78 +	cmpl	$3, (%di)
    4.79 +	je	show_status
    4.80 +	movw	$acpi_nvs, %si
    4.81 +	cmpl	$4, (%di)
    4.82 +	je	show_status
    4.83 +	movw	$reserved, %si
    4.84 +show_status:
    4.85 +	call	putcs
    4.86 +	popl	%ebx
    4.87 +	orl	%ebx, %ebx
    4.88 +	jnz	e820lp
    4.89 +fail:
    4.90 +	movb	$10, %al
    4.91 +	call	putc
    4.92 +	movw	$8*4, %cx
    4.93 +	movw	$buffer, %di
    4.94 +	pushw	%di
    4.95 +	xorw	%ax, %ax
    4.96 +	rep
    4.97 +	  stosw
    4.98 +	movw	$0xE801, %ax
    4.99 +	int	$0x15
   4.100 +	popw	%di
   4.101 +	jc	fail2
   4.102 +	movb	$0x10, 0+2(%di)		// 1M
   4.103 +	movb	$0x10, 32+2(%di)	// 1M
   4.104 +	movb	$0x1, 16+3(%di)		// 16M
   4.105 +	movb	$0x1, 48+3(%di)		// 16M
   4.106 +	incb	%bh
   4.107 +	movw	%bx, 24+2(%di)
   4.108 +	incb	%dh
   4.109 +	movw	%dx, 56+2(%di)
   4.110 +	shrw	$6, %ax		// 1K -> 64K
   4.111 +	jz	e801_configured
   4.112 +	shrw	$6, %cx		// 1K -> 64K
   4.113 +	addw	$0x10, %ax
   4.114 +	addw	$0x10, %cx
   4.115 +	movw	%ax, 8+2(%di)
   4.116 +	movw	%cx, 40+2(%di)
   4.117 +	movw	$extended, %si
   4.118 +	call	pute801
   4.119 +	call	pute801
   4.120 +e801_configured:
   4.121 +	movw	$buffer+32, %di
   4.122 +	movw	$configured, %si
   4.123 +	call	pute801
   4.124 +	call	pute801
   4.125 +fail2:
   4.126 +	movb	$10, %al
   4.127 +	call	putc
   4.128 +	retf
   4.129 +
   4.130 +puts64:
   4.131 +	call	puts
   4.132 +	call	put64
   4.133 +	movw	$middle, %si
   4.134 +	call	putcs
   4.135 +put64:
   4.136 +	movw	$8, %cx
   4.137 +	addw	%cx, %di
   4.138 +	pushw	%di
   4.139 +put64lp:
   4.140 +	decw	%di
   4.141 +	movb	(%di), %al
   4.142 +	shrb	$4, %al
   4.143 +	call	putx
   4.144 +	movb	(%di), %al
   4.145 +	call	putx
   4.146 +	loop	put64lp
   4.147 +	popw	%di
   4.148 +	ret
   4.149 +
   4.150 +pute801:
   4.151 +	pushw	%si
   4.152 +	movw	$header_e801, %si
   4.153 +	call	puts64
   4.154 +	popw	%si
   4.155 +	pushw	%si
   4.156 +	call	putcs
   4.157 +	popw	%si
   4.158 +	ret
   4.159 +putcs:
   4.160 +	movb	$0x20, %al
   4.161 +putslp:
   4.162 +	call	putc
   4.163 +puts:
   4.164 +	lodsb
   4.165 +	orb	%al, %al
   4.166 +	jnz	putslp
   4.167 +	ret
   4.168 +
   4.169 +putx:
   4.170 +	andb	$0xF, %al
   4.171 +	addb	$0x90, %al
   4.172 +	daa
   4.173 +	adcb	$0x40, %al
   4.174 +	daa
   4.175 +putc:
   4.176 +	movw	$7, %bx
   4.177 +	movb	$0xE, %ah
   4.178 +	int	$0x10
   4.179 +	ret
   4.180 +
   4.181 +header_e801:
   4.182 +	.byte	13,10
   4.183 +	.ascii  "BIOS-e801: "
   4.184 +	.byte	0
   4.185 +extended:
   4.186 +	.ascii	"(extended)"
   4.187 +	.byte	0
   4.188 +configured:
   4.189 +	.ascii	"(configured)"
   4.190 +	.byte	0
   4.191 +header_e820:
   4.192 +	.byte	13,10
   4.193 +	.ascii  "BIOS-e820: "
   4.194 +	.byte	0
   4.195 +middle:
   4.196 +	.ascii	"- "
   4.197 +	.byte	0
   4.198 +usable:		// 1
   4.199 +	.ascii	"(usable)"
   4.200 +	.byte	0
   4.201 +reserved:	// 2
   4.202 +	.ascii	"(reserved)"
   4.203 +	.byte	0
   4.204 +acpi_reclaim:	// 3
   4.205 +	.ascii	"(ACPI Reclaim)"
   4.206 +	.byte	0
   4.207 +acpi_nvs:	// 4
   4.208 +	.ascii	"(ACPI NVS)"
   4.209 +	.byte	0
   4.210 +buffer:
   4.211 +	.org	510
   4.212 +	.word	0xAA55