Doing some additional cleanup in loadfile_elf.c (the code used for -b bsd)

- switch com port to 115200 instead of 9600 (our own bootloader does the
  same when booted in a VM).
- use the new write_mem(addr, NULL, size) code to zero memory. This makes
  that code a lot simpler.

OK
-- 
:wq Claudio


Index: loadfile_elf.c
===================================================================
RCS file: /cvs/src/usr.sbin/vmd/loadfile_elf.c,v
retrieving revision 1.31
diff -u -p -r1.31 loadfile_elf.c
--- loadfile_elf.c      6 Dec 2018 09:20:06 -0000       1.31
+++ loadfile_elf.c      12 Dec 2018 11:17:55 -0000
@@ -430,7 +430,7 @@ push_bootargs(bios_memmap_t *memmap, siz
 
        /* Serial console device, COM1 @ 0x3f8 */
        consdev.consdev = makedev(8, 0);        /* com1 @ 0x3f8 */
-       consdev.conspeed = 9600;
+       consdev.conspeed = 115200;
        consdev.consaddr = 0x3f8;
        consdev.consfreq = 0;
 
@@ -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;
 }
 
 /*

Reply via email to