Re: 2.1.22 and memory check on boot

david parsons (o.r.c@p.e.l.l.c.h.i.i.l.u.s)
5 Feb 1997 08:43:53 -0800


In article <linux.kernel.199701240226.VAA00193@barnabas.port.net>,
Barnabas Wolf <barnabas@barnabas.port.net> wrote:
>2.1.22 refuses to boot for me with a message like:
>
>Less than 4M memory
>--- System halted
>
>right after the lilo loading.... line goes away, even when I pass
>mem=64M as a boot parameter.

The first patch for memory detection is slightly wrong (it was written
against 1.2.13 and floated around unmodified until I converted a
development machine to 2.0.27, only to discover the same error.) This
patch should work correctly with the 2.1.x kernels (I hope):

*** linux/arch/i386/boot/setup.S.orig Sat Mar 30 10:58:57 1996
--- linux/arch/i386/boot/setup.S Thu Dec 12 18:45:42 1996
***************
*** 232,240 ****
--- 232,271 ----
loader_ok:
! Get memory size (extended mem, kB)

+ #ifdef STANDARD_MEMORY_BIOS_CALL
mov ah,#0x88
int 0x15
mov [2],ax
+ #else
+ push ax
+ push cx
+ push dx
+ mov ax,#0xe801
+ int 0x15
+ jc oldstylemem
+
+ ! memory size is (ax+(64*bx)) * 1024; we store bx+(ax/64)
+
+ mov [2],bx ! store extended memory size
+ xor dx,dx
+ mov cx,#64 ! convert lower memory size from K into
+ div cx ! 64k chunks.
+
+ add [2],ax ! add lower memory into total size.
+ jmp gotmem
+
+ oldstylemem:
+ mov ah,#0x88
+ int 0x15
+ mov cx,#64 ! got memory size in kbytes, so we need to
+ xor dx,dx ! adjust to 64k chunks for the system.
+ div cx
+ mov [2],ax
+ gotmem:
+ pop dx
+ pop cx
+ pop ax
+ #endif

! Set the keyboard repeat rate to the max

*** linux/arch/i386/boot/compressed/misc.c.orig Thu Dec 12 18:47:32 1996
--- linux/arch/i386/boot/compressed/misc.c Thu Dec 12 18:48:13 1996
***************
*** 338,344 ****

void setup_normal_output_buffer()
{
! if (EXT_MEM_K < 1024) error("Less than 2MB of memory.\n");
output_data = (char *)0x100000; /* Points to 1M */
}

--- 338,348 ----

void setup_normal_output_buffer()
{
! #ifdef STANDARD_MEMORY_BIOS_CALL
! if (EXT_MEM_K < 1024) error("<2M of mem\n");
! #else
! if (EXT_MEM_K*64 < 1024) error("<2M of mem\n");
! #endif
output_data = (char *)0x100000; /* Points to 1M */
}

***************
*** 350,356 ****
--- 354,364 ----
void setup_output_buffer_if_we_run_high(struct moveparams *mv)
{
high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE);
+ #ifdef STANDARD_MEMORY_BIOS_CALL
if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory.\n");
+ #else
+ if (EXT_MEM_K*64 < (3*1024)) error("Less than 4MB of memory.\n");
+ #endif
mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
high_loaded = 1;
free_mem_end_ptr = (long)high_buffer_start;
*** linux/arch/i386/kernel/setup.c.orig Fri Sep 20 03:17:18 1996
--- linux/arch/i386/kernel/setup.c Thu Dec 12 18:45:42 1996
***************
*** 126,132 ****
--- 126,136 ----
apm_bios_info = APM_BIOS_INFO;
#endif
aux_device_present = AUX_DEVICE_INFO;
+ #ifdef STANDARD_MEMORY_BIOS_CALL
memory_end = (1<<20) + (EXT_MEM_K<<10);
+ #else
+ memory_end = (1<<20) + (EXT_MEM_K*64L*1024L); /* 64kb chunks */
+ #endif
memory_end &= PAGE_MASK;
#ifdef CONFIG_BLK_DEV_RAM
rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK;
*** linux/CREDITS~ Wed Feb 5 08:36:07 1997
--- linux/CREDITS Wed Feb 5 08:37:13 1997
***************
*** 1054,1059 ****
--- 1054,1063 ----
E: greg@caldera.com
D: IPX development and support

+ N: David Parsons
+ E: orc@pell.chi.il.us
+ D: improved memory detection code.
+
N: Avery Pennarun
E: apenwarr@foxnet.net
D: ARCnet driver

____
david parsons \bi/ orc@pell.chi.il.us
\/