Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 May 1995 17:21:45 -0700 (PDT)
From:      Julian Elischer <julian@ref.tfs.com>
To:        bde@zeta.org.au (Bruce Evans)
Cc:        freebsd-hackers@FreeBSD.org, henrich@crh.cl.msu.edu
Subject:   Re: LINT additions
Message-ID:  <199505280021.RAA06523@ref.tfs.com>
In-Reply-To: <199505272301.JAA18466@godzilla.zeta.org.au> from "Bruce Evans" at May 28, 95 09:01:19 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> ># MAXMEM Specified the maximum amount of ram in the system in kilobytes.  Only
> >#        use this if your BIOS is broken (I.e. Compaq's).  You can specify as
>                                            e.g.,
> 
> Actually, FreeBSD's determination of the memory size is broken.  It doesn't
> even use the BIOS except to print a warning if there is a conflict.  The
> memory size in the CMOS RAM has priority.  There are conflicting standards
> for the size in the CMOS RAM.
> 
> >#        large an amount as you expect will eventually be in the system, as
> >#        FreeBSD is smart enough to recompute the max memory size by scanning
> >#        for the presence of this much memory.
> 
> It's not smart enough.  Probing beyond the end of physical memory can cause
> an NMI trap for a parity error.  The first NMI trap is fatal.
> 
> Bruce
> 
in the OSF/1-386 code, I do the memeory probe WAAAYYYY early..
(while the bios can still run actually), while we are still running
on the boot-codes segment descriptors etc..
and certainly before we are in paging mode..
This tests if the BIOS says we have > 63MB ram
MASK lops off the top bits of the address (because we are still running
away from our 'linked' address.

It's not great, but it got my machines up and going

julian

/*
 * check to see if there is more ram beyond the end of extmem
 * because extmem can only show 64k in bios
 */
checkmoreram:
    pusha
    mov $EXT(extmem), %ebx /* passed in from the MACH bootblocks */
    and $MASK, %ebx
    mov (%ebx),%eax     /* XXX I must check about sign extension etc */
    cmpl    $0xfc00, %eax
    jge 1f
#ifdef LOCORE_DEBUG
    mov $0x40,%ebx
    call    output
#endif /* LOCORE_DEBUG */

    popa
    ret             /* extmem not even full */
1:
    movl    $0x40ffffc, %edx    /* point to the great unknown */
    movl    $(0xfc00), %ecx     /* count of kB extmem*/
#ifdef LOCORE_DEBUG
    mov $0x61,%ebx
    call    output
#endif /* LOCORE_DEBUG */
2:

    movl    $0x5a5a5a5a,(%edx)  /* put in a value */
    movl    0,%eax          /* XXX Need to try flush cache */
    movl    (%edx),%eax     /* get value back */
    cmpl    $0x5a5a5a5a,%eax
    jne 3f
    addl    $0x400,%ecx     /* add 1 MB to the ram we trust */
    addl    $0x100000,%edx      /* move pointer by 1MB too */
#ifdef LOCORE_DEBUG
    addl $0x1, %ebx
    call    output
#endif /* LOCORE_DEBUG */
    jmp 2b          /* go back and test the next MB */

3:
    mov $EXT(extmem), %ebx
    and $MASK, %ebx
    mov %ecx,(%ebx)     /* put back the new extmem value */
    popa
    ret





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505280021.RAA06523>