# HG changeset patch # User Pascal Bellard # Date 1393701036 0 # Node ID 3f0b08dbc9d3d0464e117bd0cc26cdfa3c4fe8c3 # Parent df021be024df2e414ff7c8ae1cabbec96ee2134d syslinux-tools: add meminfo.exe diff -r df021be024df -r 3f0b08dbc9d3 syslinux-tools/receipt --- a/syslinux-tools/receipt Sat Mar 01 10:30:44 2014 +0000 +++ b/syslinux-tools/receipt Sat Mar 01 19:10:36 2014 +0000 @@ -19,4 +19,5 @@ cp -a $src/utils/$i $fs/usr/bin done cp -a $src/iso2exe/isohybrid.exe $fs/usr/share/boot + cp -a $src/iso2exe/meminfo.exe $fs/usr/share/boot } diff -r df021be024df -r 3f0b08dbc9d3 syslinux/stuff/iso2exe/Makefile --- a/syslinux/stuff/iso2exe/Makefile Sat Mar 01 10:30:44 2014 +0000 +++ b/syslinux/stuff/iso2exe/Makefile Sat Mar 01 19:10:36 2014 +0000 @@ -2,7 +2,11 @@ BCC=bcc -ansi -O -0 -C-t BCCFLAGS=-D__MSDOS__ -Md -all: isohybrid.exe iso2exe +all: isohybrid.exe iso2exe meminfo.exe + +meminfo.exe: meminfo.S + cc -o meminfo.o -Wa,-a=meminfo.lst -c meminfo.S + objcopy -O binary meminfo.o meminfo.exe iso2exe: iso2exe.sh boot.com bootiso.bin init win32.exe cp iso2exe.sh $@ diff -r df021be024df -r 3f0b08dbc9d3 syslinux/stuff/iso2exe/bootlinux.c --- a/syslinux/stuff/iso2exe/bootlinux.c Sat Mar 01 10:30:44 2014 +0000 +++ b/syslinux/stuff/iso2exe/bootlinux.c Sat Mar 01 19:10:36 2014 +0000 @@ -103,6 +103,17 @@ #endasm } +static unsigned extendedramsizeinkb(void) +{ +#asm + mov ah, #0x88 + int 0x15 + jnc gottop + xor ax, ax +gottop: +#endasm +} + static void load(struct mem *p, unsigned long size) { if (vm86()) @@ -117,9 +128,9 @@ } p->align = PAGE_SIZE; break; - case 4096: // first initrd : skip 0xF00000 .. 0x1000000 mapping hole - initrd_addr = (p->base + size > 0xF00000 && - p->base < 0x1000000) ? 0x1000000 : p->base; + case 4096: // first initrd : skip mapping hole before 16M + initrd_addr = (extendedramsizeinkb() > 24000U) ? + 0x1000000 : p->base; p->align = 4; } while (size) { diff -r df021be024df -r 3f0b08dbc9d3 syslinux/stuff/iso2exe/meminfo.S --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/syslinux/stuff/iso2exe/meminfo.S Sat Mar 01 19:10:36 2014 +0000 @@ -0,0 +1,209 @@ + .text + .code16 + .org 0 +stacktop = 0xFFFE + + .globl _start +_start: +#if 1 +#define EXEADRS(x) x+0xE0 +#define CODESZ 0x200 + decw %bp // Magic number: MZ + popw %dx + jmp start // Bytes on last page of file + .word (CODESZ+511)/512 // Pages in file + .word 0 // Relocations + .word (end_header-_start)/16 // Size of header in paragraphs + .word 4096 // Minimum extra paragraphs needed + .word -1 // Maximum extra paragraphs needed + .word (CODESZ+15)/16 // Initial (relative) SS value + .word stacktop // Initial SP value + .word 0 // Checksum + .word EXEADRS(comstart) // Initial IP value + .word 0xFFF0 // Initial (relative) CS value +// .word 0x001C // File address of relocation table +// .word 0,0,0 // Overlay number +start: + pushw %dx + cld + pushw %cs + call comstart2 +stop: + hlt + jmp stop +end_header: +#endif +comstart: + pushw %cs + call comstart2 + int $0x20 +comstart2: + call here +here: + popw %ax + subw $here-_start, %ax + shrw $4, %ax + movw %cs, %dx + addw %ax, %dx + pushw %dx + pushw $go + retf +go: + pushw %cs + popw %ds + pushw %cs + popw %es + xorl %ebx, %ebx +e820lp: + movl $0xe820, %eax + movl $0x534d4150, %edx + movl $20, %ecx + movw $buffer, %di + int $0x15 + jc fail + cmpl $0x534d4150, %eax + jne fail + cmpl $20, %ecx + jc fail + pushl %ebx + movw $header_e820, %si + call puts64 + movw $usable, %si + cmpl $1, (%di) + je show_status + movw $acpi_reclaim, %si + cmpl $3, (%di) + je show_status + movw $acpi_nvs, %si + cmpl $4, (%di) + je show_status + movw $reserved, %si +show_status: + call putcs + popl %ebx + orl %ebx, %ebx + jnz e820lp +fail: + movb $10, %al + call putc + movw $8*4, %cx + movw $buffer, %di + pushw %di + xorw %ax, %ax + rep + stosw + movw $0xE801, %ax + int $0x15 + popw %di + jc fail2 + movb $0x10, 0+2(%di) // 1M + movb $0x10, 32+2(%di) // 1M + movb $0x1, 16+3(%di) // 16M + movb $0x1, 48+3(%di) // 16M + incb %bh + movw %bx, 24+2(%di) + incb %dh + movw %dx, 56+2(%di) + shrw $6, %ax // 1K -> 64K + jz e801_configured + shrw $6, %cx // 1K -> 64K + addw $0x10, %ax + addw $0x10, %cx + movw %ax, 8+2(%di) + movw %cx, 40+2(%di) + movw $extended, %si + call pute801 + call pute801 +e801_configured: + movw $buffer+32, %di + movw $configured, %si + call pute801 + call pute801 +fail2: + movb $10, %al + call putc + retf + +puts64: + call puts + call put64 + movw $middle, %si + call putcs +put64: + movw $8, %cx + addw %cx, %di + pushw %di +put64lp: + decw %di + movb (%di), %al + shrb $4, %al + call putx + movb (%di), %al + call putx + loop put64lp + popw %di + ret + +pute801: + pushw %si + movw $header_e801, %si + call puts64 + popw %si + pushw %si + call putcs + popw %si + ret +putcs: + movb $0x20, %al +putslp: + call putc +puts: + lodsb + orb %al, %al + jnz putslp + ret + +putx: + andb $0xF, %al + addb $0x90, %al + daa + adcb $0x40, %al + daa +putc: + movw $7, %bx + movb $0xE, %ah + int $0x10 + ret + +header_e801: + .byte 13,10 + .ascii "BIOS-e801: " + .byte 0 +extended: + .ascii "(extended)" + .byte 0 +configured: + .ascii "(configured)" + .byte 0 +header_e820: + .byte 13,10 + .ascii "BIOS-e820: " + .byte 0 +middle: + .ascii "- " + .byte 0 +usable: // 1 + .ascii "(usable)" + .byte 0 +reserved: // 2 + .ascii "(reserved)" + .byte 0 +acpi_reclaim: // 3 + .ascii "(ACPI Reclaim)" + .byte 0 +acpi_nvs: // 4 + .ascii "(ACPI NVS)" + .byte 0 +buffer: + .org 510 + .word 0xAA55