diff options
author | Tobias Weingartner <weingart@cvs.openbsd.org> | 2005-05-28 05:47:34 +0000 |
---|---|---|
committer | Tobias Weingartner <weingart@cvs.openbsd.org> | 2005-05-28 05:47:34 +0000 |
commit | 1dcd23cf610eed2bb363b7889f224424b8b80cee (patch) | |
tree | 978d84fcf88178bd5aa6212942d6cca1d7a98832 /sys/arch/amd64/stand/libsa | |
parent | 6a28bc2171077443d8e80c12f967491687b7aac3 (diff) |
*slightly drunk*
To all my "friends", and my lovely future wife... Thank you. Anyone
who still wants to sign the shirt, it's on my bakc. Again, thank you.
This commit was ok'd by drahn@, art@, niklas@, in spite of my condition.
Diffstat (limited to 'sys/arch/amd64/stand/libsa')
-rw-r--r-- | sys/arch/amd64/stand/libsa/memprobe.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/sys/arch/amd64/stand/libsa/memprobe.c b/sys/arch/amd64/stand/libsa/memprobe.c index 58084c5f7d9..a8a81d14a18 100644 --- a/sys/arch/amd64/stand/libsa/memprobe.c +++ b/sys/arch/amd64/stand/libsa/memprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memprobe.c,v 1.3 2005/05/03 13:18:05 tom Exp $ */ +/* $OpenBSD: memprobe.c,v 1.4 2005/05/28 05:47:33 weingart Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -344,16 +344,51 @@ memprobe(void) if(im->addr < IOM_BEGIN) cnvmem = max(cnvmem, im->addr + im->size) / 1024; - if(im->addr >= IOM_END) + if(im->addr >= IOM_END + && (im->addr/1024) == (extmem + 1024)) { extmem += im->size / 1024; + } } } + /* Adjust extmem to be no more than 4G (which it usually is not + * anyways). In order for an x86 type machine (amd64/etc) to use + * more than 4GB of memory, it will need to grok and use the bios + * memory map we pass it. Note that above we only count CONTIGUOUS + * memory from the 1MB boundary on for extmem (think I/O holes). + * + * extmem is in KB, and we have 4GB - 1MB (base/io hole) worth of it. + */ + if(extmem > 4*1024*1024 - 1024) + extmem = 4*1024*1024 - 1024; + /* Check if gate A20 is on */ printf("a20=o%s] ", checkA20()? "n" : "ff!"); } #endif +/* + * XXX - A hack until libgcc has the appropriate div/mod functions so + * that we can use -DLIBSA_LONGLONG_PRINTF and simply print out the + * 64-bit vars directly. + */ +static const char * +int64_str(u_int64_t num) +{ + static char buf[17], *p; + u_int32_t i; + + buf[16] = '\0'; + for(p = buf + 15, i = 0; i < 16; p--,i++) { + *p = "0123456789abcdef"[num & 0xF]; + num >>= 4; + if(num == 0) + break; + } + + return p; +} + void dump_biosmem(bios_memmap_t *tm) { @@ -369,8 +404,9 @@ dump_biosmem(bios_memmap_t *tm) * If/when we do, libsa may need to be updated some... */ for(p = tm; p->type != BIOS_MAP_END; p++) { - printf("Region %ld: type %u at 0x%x for %uKB\n", - (long)(p - tm), p->type, (u_int)p->addr, + printf("Region %ld: type %u at 0x%s for %uKB\n", + (long)(p - tm), p->type, + int64_str(p->addr), (u_int)(p->size / 1024)); if(p->type == BIOS_MAP_FREE) |