lkml.org 
[lkml]   [1999]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectWhoops. Don't try to submit kernel patches when you've got the flu (Re: New new enhanced memory detection patch (patch for 2.2.1))
Date
Sigh.  Never try patching a kernel that you can't compile when you're
sick. "Try this instead" -- I've not compiled it, but I've eyeballed
it so I think that the names are at least consistant.

____
david parsons \bi/ Achoo!
\/
*** ./arch/i386/boot/setup.S~ Sat Feb 20 13:32:45 1999
--- ./arch/i386/boot/setup.S Sat Feb 20 13:38:08 1999
***************
*** 246,281 ****
! Get memory size (extended mem, kB)
#ifndef STANDARD_MEMORY_BIOS_CALL
! push ebx

! xor ebx,ebx ! preload new memory slot with 0k
! mov [0x1e0], ebx

mov ax,#0xe801
int 0x15
! jc oldstylemem

! ! Memory size is in 1 k chunksizes, to avoid confusing loadlin.
! ! We store the 0xe801 memory size in a completely different place,
! ! because it will most likely be longer than 16 bits.
! ! (use 1e0 because that's what Larry Augustine uses in his
! ! alternative new memory detection scheme, and it's sensible
! ! to write everything into the same place.)

! and ebx, #0xffff ! clear sign extend
! shl ebx, 6 ! and go from 64k to 1k chunks
! mov [0x1e0],ebx ! store extended memory size
!
! and eax, #0xffff ! clear sign extend
! add [0x1e0],eax ! and add lower memory into total size.
!
! ! and fall into the old memory detection code to populate the
! ! compatibility slot.
!
! oldstylemem:
! pop ebx
! #else
! mov dword ptr [0x1e0], #0
#endif
mov ah,#0x88
int 0x15
--- 246,327 ----
! Get memory size (extended mem, kB)
#ifndef STANDARD_MEMORY_BIOS_CALL
! xor edx,edx
! mov [0x1e0], edx ! preset the e801 and e820 return areas
! mov [0x1e4], edx ! so we don't get hilarious results when
! mov [0x1e8], edx ! bioses don't support the memory detect
! ! calls
!
! ! Try three different memory detection schemes. First, try
! ! e820h, which lets us assemble a memory map, then try e801h,
! ! which returns a 32-bit memory size, and finally 88h, which
! ! returns 0-64m
!
! ! method E820H:
! ! the memory map from hell. e820h returns memory classified into
! ! a whole bunch of different types, and allows memory holes and
! ! everything. Currently, I don't care; I just add up all the
! ! memory and hope that no memory holes will materialize to spoil
! ! our fun.
! !
! ! BUGS: If there's a memory hole, this method will cheerfully ignore
! ! it and keep adding up memory. It also doesn't truncate at 1mb,
! ! but adds all memory between 0k and 0xfffK in.
!
! meme820:
! mov edx, #0x534d4150 ! ascii `SMAP'
! xor ebx, ebx ! continuation counter
! lea di, e820rec ! es:di points at the
! ! data record.
! ! edx is a continuation index. We've preset it to zero, and
! ! each call to e820 will increment it by one up to the point
! ! where there's no more memory to map, at which point it will
! ! drop back to zero.
!
! jmpe820:
! mov eax, #0x0000e820 ! e820, upper word zeroed
! mov ecx, #20 ! size of the e820rec
!
! int 0x15 ! make the call
! jc meme801 ! fall to e801 if it fails
!
! cmp eax, #0x534d4150 ! check the return is `SMAP'
! jne meme801 ! fall to e801 if it fails
!
! cmp ebx, #0 ! check to see if ebx is
! je meme801 ! set to EOF
!
! cmp e820rec+0x10, #1 ! is this usable memory?
! jne jmpe820 ! no, grab the next chunk.
!
! mov eax, e820rec+8+4 ! get low dword and high
! mov ecx, e820rec+8+0 ! dword of memory size
! add [0x1e4], ecx ! and add it into our
! adc [0x1e8], eax ! long long accumulator
!
! br jmpe820 ! then go back for more.
!
! ! method E801H:
! ! memory size is in 1k chunksizes, to avoid confusing loadlin.
! ! we store the 0xe801 memory size in a completely different place,
! ! because it will most likely be longer than 16 bits.
! ! (use 1e0 because that's what Larry Augustine uses in his
! ! alternative new memory detection scheme, and it's sensible
! ! to write everything into the same place.)
! meme801:
! xor ecx,ecx ! use `configured memory', and pre-zero
! xor edx,edx ! the registers in case the bios lies

mov ax,#0xe801
int 0x15
! jc mem88

! and edx, #0xffff ! clear sign extend
! shl edx, 6 ! and go from 64k to 1k chunks
! mov [0x1e0],edx ! store extended memory size
! mem88:
#endif
mov ah,#0x88
int 0x15
***************
*** 817,822 ****
--- 863,875 ----
gdt_48:
.word 0x800 ! gdt limit=2048, 256 GDT entries
.word 512+gdt,0x9 ! gdt base = 0X9xxxx
+
+ ! 0xe820 memory map block
+ !
+ e820rec:
+ .word 0,0,0,0 ! base address
+ .word 0,0,0,0 ! length in bytes
+ .word 0,0 ! type of address range
!
! Include video setup & detection code
*** ./arch/i386/kernel/setup.c~ Sat Feb 20 13:38:22 1999
--- ./arch/i386/kernel/setup.c Sun Feb 21 06:52:20 1999
***************
*** 89,95 ****
#define PARAM ((unsigned char *)empty_zero_page)
#define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
#define EXT_MEM_K (*(unsigned short *) (PARAM+2))
! #define ALT_MEM_K (*(unsigned long *) (PARAM+0x1e0))
#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40))
#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))
#define SYS_DESC_TABLE (*(struct sys_desc_table_struct*)(PARAM+0xa0))
--- 89,96 ----
#define PARAM ((unsigned char *)empty_zero_page)
#define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
#define EXT_MEM_K (*(unsigned short *) (PARAM+2))
! #define E801_MEM (*(unsigned long *) (PARAM+0x1e0))
! #define E820_MEM (*(unsigned long*) (PARAM+0x1e4))
#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40))
#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))
#define SYS_DESC_TABLE (*(struct sys_desc_table_struct*)(PARAM+0xa0))
***************
*** 270,279 ****
memory_end = (1<<20) + (EXT_MEM_K<<10);
#ifndef STANDARD_MEMORY_BIOS_CALL
{
! unsigned long memory_alt_end = (1<<20) + (ALT_MEM_K<<10);
! /* printk(KERN_DEBUG "Memory sizing: %08x %08x\n", memory_end, memory_alt_end); */
! if (memory_alt_end > memory_end)
! memory_end = memory_alt_end;
}
#endif
--- 271,287 ----
memory_end = (1<<20) + (EXT_MEM_K<<10);
#ifndef STANDARD_MEMORY_BIOS_CALL
{
! unsigned long e801_end = (1<<20) + (E801_MEM<<10);
!
! printk(KERN_DEBUG "Memory: e820 reports %ld\n", E820_MEM);
! printk(KERN_DEBUG "Memory: e801 reports %ld\n", e801_end);
! printk(KERN_DEBUG "Memory: 88 reports %ld\n", memory_end);
! if ( (e801_end > memory_end) || (E820_MEM > memory_end))
! if (e801_end > E820_MEM)
! memory_end = e801_end;
! else
! memory_end = E820_MEM;
! }
}
#endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.147 / U:0.436 seconds]
©2003-2014 Jasper Spaans. Advertise on this site