diff options
author | Marco Pfatschbacher <mpf@cvs.openbsd.org> | 2006-09-18 21:15:34 +0000 |
---|---|---|
committer | Marco Pfatschbacher <mpf@cvs.openbsd.org> | 2006-09-18 21:15:34 +0000 |
commit | da60693861d2597a49ad622406e287847e083369 (patch) | |
tree | 347a1ad581a0029886e29bf2c0f57a6f9d63ecf9 /sys/arch | |
parent | 5bacfd41f84d475baea90a4c186a9a54a33899cc (diff) |
boot(8) ``machine memory'' support for > 4G.
Convert parser to strtoll(3) and use 64bit printf.
With help from mickey@
i386 and amd64 tests by me, alpha test by mickey@
OK mickey@, miod@, deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/stand/boot/Makefile | 6 | ||||
-rw-r--r-- | sys/arch/amd64/stand/boot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/cmd_i386.c | 8 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/libsa.h | 6 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/memprobe.c | 38 |
5 files changed, 17 insertions, 45 deletions
diff --git a/sys/arch/amd64/stand/boot/Makefile b/sys/arch/amd64/stand/boot/Makefile index a50c13aafdf..b094ea7e7aa 100644 --- a/sys/arch/amd64/stand/boot/Makefile +++ b/sys/arch/amd64/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2005/07/30 14:37:39 millert Exp $ +# $OpenBSD: Makefile,v 1.5 2006/09/18 21:15:33 mpf Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -30,14 +30,14 @@ SRCS+= boot.c cmd.c vars.c bootarg.c # stand routines SRCS+= alloc.c exit.c getfile.c gets.c globals.c strcmp.c strlen.c \ strncmp.c memcmp.c memcpy.c memset.c printf.c snprintf.c \ - strerror.c strncpy.c strtol.c ctime.c strlcpy.c strlcat.c + strerror.c strncpy.c strtol.c strtoll.c ctime.c strlcpy.c strlcat.c # io routines SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ open.c read.c stat.c write.c cread.c readdir.c cons.c loadfile.c # boot filesystems SRCS+= ufs.c # gcc support -SRCS+= moddi3.c qdivrem.c +SRCS+= divdi3.c moddi3.c qdivrem.c .PATH: ${S}/lib/libz SRCS+= adler32.c crc32.c inflate.c inftrees.c diff --git a/sys/arch/amd64/stand/boot/conf.c b/sys/arch/amd64/stand/boot/conf.c index 8759b7ba036..0102a56f2cf 100644 --- a/sys/arch/amd64/stand/boot/conf.c +++ b/sys/arch/amd64/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.7 2005/05/28 05:47:33 weingart Exp $ */ +/* $OpenBSD: conf.c,v 1.8 2006/09/18 21:15:33 mpf Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -42,7 +42,7 @@ #include <biosdev.h> #include <dev/cons.h> -const char version[] = "2.11"; +const char version[] = "2.12"; int debug = 1; diff --git a/sys/arch/amd64/stand/libsa/cmd_i386.c b/sys/arch/amd64/stand/libsa/cmd_i386.c index 03f495350dd..3dd3cecf46b 100644 --- a/sys/arch/amd64/stand/libsa/cmd_i386.c +++ b/sys/arch/amd64/stand/libsa/cmd_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd_i386.c,v 1.1 2004/02/03 12:09:47 mickey Exp $ */ +/* $OpenBSD: cmd_i386.c,v 1.2 2006/09/18 21:15:33 mpf Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -147,13 +147,13 @@ Xmemory(void) for (i = 1; i < cmd.argc; i++) { char *p; - long addr, size; + long long addr, size; p = cmd.argv[i]; - size = strtol(p + 1, &p, 0); + size = strtoll(p + 1, &p, 0); if (*p && *p == '@') - addr = strtol(p + 1, NULL, 0); + addr = strtoll(p + 1, NULL, 0); else addr = 0; if (addr == 0 && (*p != '@' || size == 0)) { diff --git a/sys/arch/amd64/stand/libsa/libsa.h b/sys/arch/amd64/stand/libsa/libsa.h index 200997e06be..6d2aa967207 100644 --- a/sys/arch/amd64/stand/libsa/libsa.h +++ b/sys/arch/amd64/stand/libsa/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.3 2004/08/21 18:53:38 tom Exp $ */ +/* $OpenBSD: libsa.h,v 1.4 2006/09/18 21:15:33 mpf Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -50,8 +50,8 @@ void cdprobe(void); void apmprobe(void); void apmfixmem(void); void dump_biosmem(bios_memmap_t *); -int mem_add(long, long); -int mem_delete(long, long); +int mem_add(long long, long long); +int mem_delete(long long, long long); void mem_pass(void); void devboot(dev_t, char *); diff --git a/sys/arch/amd64/stand/libsa/memprobe.c b/sys/arch/amd64/stand/libsa/memprobe.c index a8a81d14a18..4a6fdd8197d 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.4 2005/05/28 05:47:33 weingart Exp $ */ +/* $OpenBSD: memprobe.c,v 1.5 2006/09/18 21:15:33 mpf Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -367,28 +367,6 @@ memprobe(void) } #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) { @@ -398,15 +376,9 @@ dump_biosmem(bios_memmap_t *tm) if (!tm) tm = bios_memmap; - /* libsa printf does not handle quad args, so we use long - * instead. Note, since we're unlikely to support more than - * 4G of RAM on a x86 box, this not likely to cause a problem. - * 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%s for %uKB\n", - (long)(p - tm), p->type, - int64_str(p->addr), + printf("Region %ld: type %u at 0x%llx for %uKB\n", + (long)(p - tm), p->type, p->addr, (u_int)(p->size / 1024)); if(p->type == BIOS_MAP_FREE) @@ -418,7 +390,7 @@ dump_biosmem(bios_memmap_t *tm) } int -mem_delete(long sa, long ea) +mem_delete(long long sa, long long ea) { register bios_memmap_t *p; @@ -455,7 +427,7 @@ mem_delete(long sa, long ea) } int -mem_add(long sa, long ea) +mem_add(long long sa, long long ea) { register bios_memmap_t *p; |