From b987c9360a4eb2851d37a896daa6f2150a91cbe8 Mon Sep 17 00:00:00 2001 From: hpa Date: Mon, 20 Dec 2004 16:01:54 +0000 Subject: [PATCH] Fix regparm in libcom32; make extlinux actually work; add 3840K support to MEMDISK. --- com32/include/com32.h | 5 +++-- com32/modules/Makefile | 2 +- extlinux.asm | 49 +++++++++++++++++++++++++++---------------------- memdisk/memdisk.doc | 1 + memdisk/setup.c | 15 ++++++++------- 5 files changed, 40 insertions(+), 32 deletions(-) diff --git a/com32/include/com32.h b/com32/include/com32.h index 4548519..91799f6 100644 --- a/com32/include/com32.h +++ b/com32/include/com32.h @@ -13,6 +13,7 @@ #define _COM32_H #include +#include /* For __cdecl */ /* * This structure defines the register frame used by the @@ -69,10 +70,10 @@ typedef struct { extern struct com32_sys_args { uint32_t cs_sysargs; char *cs_cmdline; - void (*cs_intcall)(uint8_t, const com32sys_t *, com32sys_t *); + void __cdecl (*cs_intcall)(uint8_t, const com32sys_t *, com32sys_t *); void *cs_bounce; uint32_t cs_bounce_size; - void (*cs_farcall)(uint32_t, const com32sys_t *, com32sys_t *); + void __cdecl (*cs_farcall)(uint32_t, const com32sys_t *, com32sys_t *); } __com32; /* diff --git a/com32/modules/Makefile b/com32/modules/Makefile index 4b6f335..0037523 100644 --- a/com32/modules/Makefile +++ b/com32/modules/Makefile @@ -45,7 +45,7 @@ AUXDIR = $(LIBDIR)/syslinux INCDIR = /usr/include COM32DIR = $(AUXDIR)/com32 -MODULES = chain.c32 menu.c32 menu.lnx +MODULES = chain.c32 # menu.c32 menu.lnx all: $(MODULES) diff --git a/extlinux.asm b/extlinux.asm index 571e3b3..a295e8b 100644 --- a/extlinux.asm +++ b/extlinux.asm @@ -92,7 +92,7 @@ file_left resd 1 ; Number of sectors left (0 = free) file_sector resd 1 ; Next linear sector to read file_in_sec resd 1 ; Sector where inode lives file_in_off resw 1 - resw 1 +file_mode resw 1 endstruc %ifndef DEPEND @@ -970,6 +970,8 @@ open_inode: call getcachesector add si,dx + mov ax,[gs:si+i_mode] + mov [bx+file_mode],ax mov eax,[gs:si+i_size] push eax add eax,SECTOR_SIZE-1 @@ -1011,6 +1013,9 @@ close: ; Assumes CS == DS == ES; *** IS THIS CORRECT ***? ; searchdir: + push bx + push cx + push di mov eax,[CurrentDir] .leadingslash: cmp byte [di],'/' ; Absolute filename? @@ -1035,11 +1040,9 @@ searchdir: je .endblock push di - push si - mov cx,[bx+d_name_len] + movzx cx,byte [bx+d_name_len] lea si,[bx+d_name] repe cmpsb - pop si je .maybe .nope: pop di @@ -1052,9 +1055,9 @@ searchdir: jnc .readdir ; There is more .failure: xor eax,eax - ret + jmp .done .maybe: - mov eax,[si+d_inode] + mov eax,[bx+d_inode] cmp byte [di],0 je .finish ; It's a real file; done @@ -1075,6 +1078,10 @@ searchdir: pop si ; Adjust stack (di) pop si ; Adjust stack (flags) call open_inode +.done: + pop di + pop cx + pop bx ret ; @@ -1297,10 +1304,10 @@ linsector: getfssec: push ebp push eax - push ebx push edx .getfragment: - mov eax,[si] ; Current start index + mov eax,[si+file_sector] ; Current start index + push ebx ; Buffer pointer mov ebx,eax call linsector push eax ; Fragment start sector @@ -1328,27 +1335,25 @@ getfssec: je .getseccnt .do_read: pop eax ; Linear start sector + pop ebx ; Buffer pointer call getlinsecsr - lea eax,[eax+ebp-1] ; This is the last sector actually read + push bp shl bp,9 add bx,bp ; Adjust buffer pointer - call linsector - jc .eof - mov edx,eax - and cx,cx - jnz .getfragment + pop bp + sub cx,bp + add [si+file_sector],ebp ; Next sector index + sub [si],ebp ; Sectors consumed + jz .done + jcxz .done + jmp .getfragment .done: + cmp dword [si],1 ; Did we run out of file? + ; CF set if [SI] < 1, i.e. == 0 pop edx - pop ebx pop eax pop ebp ret -.eof: - xor edx,edx - stc - jmp .done - - ; ----------------------------------------------------------------------------- ; Common modules @@ -1409,7 +1414,7 @@ aborted_msg db ' aborted.' ; Fall through to crlf_msg! crlf_msg db CR, LF null_msg db 0 crff_msg db CR, FF, 0 -ConfigName db 'extlinux.cfg',0 ; Unmangled form +ConfigName db 'extlinux.conf',0 ; Unmangled form ; ; Command line options we'd like to take a look at diff --git a/memdisk/memdisk.doc b/memdisk/memdisk.doc index c4a3944..b67355e 100644 --- a/memdisk/memdisk.doc +++ b/memdisk/memdisk.doc @@ -39,6 +39,7 @@ b) If the disk image is one of the following sizes, it's assumed to be a 1,720,320 bytes - 1680K floppy (common extended format) 1,763,328 bytes - 1722K floppy (common extended format) 2,949,120 bytes - 2880K floppy + 3,932,160 bytes - 3840K floppy (extended format) For any other size, the image is assumed to be a hard disk image, and should typically have an MBR and a partition table. It may diff --git a/memdisk/setup.c b/memdisk/setup.c index 54d715d..5275487 100644 --- a/memdisk/setup.c +++ b/memdisk/setup.c @@ -340,13 +340,14 @@ struct geometry { static const struct geometry geometries[] = { - { 720, 40, 2, 9, 0, 0x01, 0 }, /* 360 K */ - { 1440, 80, 2, 9, 0, 0x03, 0 }, /* 720 K*/ - { 2400, 80, 2, 15, 0, 0x02, 0 }, /* 1200 K */ - { 2880, 80, 2, 18, 0, 0x04, 0 }, /* 1440 K */ - { 1680, 80, 2, 21, 0, 0x04, 0 }, /* 1680 K */ - { 1722, 82, 2, 21, 0, 0x04, 0 }, /* 1722 K */ - { 5760, 80, 2, 36, 0, 0x06, 0 }, /* 2880 K */ + { 360*2, 40, 2, 9, 0, 0x01, 0 }, /* 360 K */ + { 720*2, 80, 2, 9, 0, 0x03, 0 }, /* 720 K*/ + { 1200*2, 80, 2, 15, 0, 0x02, 0 }, /* 1200 K */ + { 1440*2, 80, 2, 18, 0, 0x04, 0 }, /* 1440 K */ + { 1680*2, 80, 2, 21, 0, 0x04, 0 }, /* 1680 K */ + { 1722*2, 82, 2, 21, 0, 0x04, 0 }, /* 1722 K */ + { 2880*2, 80, 2, 36, 0, 0x06, 0 }, /* 2880 K */ + { 3840*2, 80, 2, 48, 0, 0x06, 0 }, /* 3840 K */ }; #define known_geometries (sizeof(geometries)/sizeof(struct geometry)) -- 2.7.4