diff options
author | Tobias Weingartner <weingart@cvs.openbsd.org> | 2010-07-02 00:36:53 +0000 |
---|---|---|
committer | Tobias Weingartner <weingart@cvs.openbsd.org> | 2010-07-02 00:36:53 +0000 |
commit | 685d6be3a2d189b4a76502e5e07f6b1196738555 (patch) | |
tree | 3d66f0e4417ffe957c48808b9289ffc812fecd9e /sys/arch/i386/stand/libsa/memprobe.c | |
parent | 8b3d71903ef4c8cce2f0a6afcf7cf5cad2bacd52 (diff) |
Add ability to limit memory presented to kernel with
'machine memory =128M' style commands. Thanks to
phessler for finding a small man page niggle. Bumped
version strings to a nice round fraction, and make them
the same across the board. Easier to identify boot
binary versions that way.
ok thib@, tedu@, phessler@
Diffstat (limited to 'sys/arch/i386/stand/libsa/memprobe.c')
-rw-r--r-- | sys/arch/i386/stand/libsa/memprobe.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sys/arch/i386/stand/libsa/memprobe.c b/sys/arch/i386/stand/libsa/memprobe.c index b6d504fe73e..063f048e440 100644 --- a/sys/arch/i386/stand/libsa/memprobe.c +++ b/sys/arch/i386/stand/libsa/memprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memprobe.c,v 1.46 2009/11/30 16:33:20 canacar Exp $ */ +/* $OpenBSD: memprobe.c,v 1.47 2010/07/02 00:36:52 weingart Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -383,6 +383,28 @@ dump_biosmem(bios_memmap_t *tm) } int +mem_limit(long long ml) +{ + register bios_memmap_t *p; + + for (p = bios_memmap; p->type != BIOS_MAP_END; p++) { + register int64_t sp = p->addr, ep = p->addr + p->size; + + if (p->type != BIOS_MAP_FREE) + continue; + + /* Wholy above limit, nuke it */ + if ((sp >= ml) && (ep >= ml)) { + bcopy (p + 1, p, (char *)bios_memmap + + sizeof(bios_memmap) - (char *)p); + } else if ((sp < ml) && (ep >= ml)) { + p->size -= (ep - ml); + } + } + return 0; +} + +int mem_delete(long long sa, long long ea) { register bios_memmap_t *p; |