diff options
author | 2018-12-12 21:20:57 +0000 | |
---|---|---|
committer | 2018-12-12 21:20:57 +0000 | |
commit | c4bec8003de177dfdb1ddedb089101dfa0d50776 (patch) | |
tree | f63aba9e1f62cce825340acc8253dcabeb15841a | |
parent | Set the com speed to 115200 like we do in our bootloader when using SeaBIOS. (diff) | |
download | wireguard-openbsd-c4bec8003de177dfdb1ddedb089101dfa0d50776.tar.xz wireguard-openbsd-c4bec8003de177dfdb1ddedb089101dfa0d50776.zip |
Simplify mbzero() by using mem_write with a NULL buf which does zero out
all memory at once without having to use a zero buffer.
OK mlarkin@
-rw-r--r-- | usr.sbin/vmd/loadfile_elf.c | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/usr.sbin/vmd/loadfile_elf.c b/usr.sbin/vmd/loadfile_elf.c index 2c432459d0a..72d294f5606 100644 --- a/usr.sbin/vmd/loadfile_elf.c +++ b/usr.sbin/vmd/loadfile_elf.c @@ -1,5 +1,5 @@ /* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */ -/* $OpenBSD: loadfile_elf.c,v 1.32 2018/12/12 21:19:22 claudio Exp $ */ +/* $OpenBSD: loadfile_elf.c,v 1.33 2018/12/12 21:20:57 claudio Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -648,33 +648,8 @@ marc4random_buf(paddr_t addr, int sz) static void mbzero(paddr_t addr, int sz) { - int i, ct; - char buf[PAGE_SIZE]; - - /* - * break up the 'sz' bytes into PAGE_SIZE chunks for use with - * write_mem - */ - ct = 0; - memset(buf, 0, sizeof(buf)); - if (addr % PAGE_SIZE != 0) { - ct = PAGE_SIZE - (addr % PAGE_SIZE); - - if (write_mem(addr, buf, ct)) - return; - - addr += ct; - } - - for (i = 0; i < sz; i+= PAGE_SIZE, addr += PAGE_SIZE) { - if (i + PAGE_SIZE > sz) - ct = sz - i; - else - ct = PAGE_SIZE; - - if (write_mem(addr, buf, ct)) - return; - } + if (write_mem(addr, NULL, sz)) + return; } /* |