Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jan 1999 21:37:32 -0500
From:      "Stephane E. Potvin" <sepotvin@videotron.ca>
To:        Mike Smith <mike@smith.net.au>, Hackers@FreeBSD.ORG
Subject:   Re: New bootloader and network iface
Message-ID:  <36A14CEC.5B57D680@videotron.ca>
References:  <199812180212.SAA00576@dingo.cdrom.com> <36859F9F.5B8DAFF@videotron.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Boundary_(ID_K78XnBrKi0QGreU1scT0Cw)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7bit

I guess that my previous post got overlooked in the mayhem on the
list just before new years eve or that I was less that clearer
with my questions. So here is a new rephrased version which I hope
will be a little clearer.

I'm currently trying to add remote booting to the bootloader (i386)
for a pet project that I'm currently working on. I first stumbled
on the fact that as soon as I tried to add a new netif_driver entry
I got the following error:

zfree (0x<foo>,2048): wild pointer

I guess from the code around line 153 of the zalloc.c file of the
stand library that the start of the heap must be MEMNODE_SIZE_MASK+1
aligned. Am I completely off-track??? I attached the patch I'm using
to fix this. It patches the file /usr/src/sys/boot/i386/loader/main.c

Ok, here comes the real question. How does the match mechanism work.
I understand very well that it is a vague question but I just doesn't
seems to be able to just grasp how it is supposed to work. A general
explanation of the motives behind this would probably be enough.

Is the lsdev function expected to list the network booting devices
available? Currently, the probing of the network devices happens
only upon the actual opening of the device. I guess I could move
it to the initialization of the network devsw entry if
wanted/expected.

I've got one last question. What is the preferred way to access
the pci configuration space. Must I use the biospcipnphandler to
check if the card is there and if so use the pci bios functions to
retreive the data. Or, on the other hand, can I use the pci config
registers to scan the bus myself. I know that both of these approachs
would be feasible, I just want to know which one would be the most
politically correct. I'm personnaly more enclined to use the second
one because I have no knowledge whatsoever of the pci bios but I
know pretty well how to do manual pci bus probing/configuration.

Thanks in advance!

Stephane E. Potvin
Galea Network Security

--Boundary_(ID_K78XnBrKi0QGreU1scT0Cw)
Content-type: text/plain; name=main.c.diff; charset=us-ascii
Content-disposition: inline; filename=main.c.diff
Content-transfer-encoding: 7bit

*** main.c.orig	Sat Jan 16 21:11:30 1999
--- main.c	Sat Jan 16 21:10:54 1999
***************
*** 32,37 ****
--- 32,38 ----
   */
  
  #include <stand.h>
+ #include <zalloc_defs.h>
  #include <string.h>
  #include <machine/bootinfo.h>
  #include <sys/reboot.h>
***************
*** 71,76 ****
--- 72,78 ----
  main(void)
  {
      int			i;
+     u_int32_t		aligned_end; 
  
      /* Pick up arguments */
      kargs = (void *)__args;
***************
*** 82,89 ****
       * Initialise the heap as early as possible.  Once this is done, malloc() is usable.
       *
       * XXX better to locate end of memory and use that
       */
!     setheap((void *)end, (void *)(end + (384 * 1024)));
      
      /* 
       * XXX Chicken-and-egg problem; we want to have console output early, but some
--- 84,94 ----
       * Initialise the heap as early as possible.  Once this is done, malloc() is usable.
       *
       * XXX better to locate end of memory and use that
+      *
+      * heap start must be MEMNODE_SIZE_MASK aligned for zfree to work
       */
!     aligned_end = ((u_int32_t) end + MEMNODE_SIZE_MASK) & ~MEMNODE_SIZE_MASK;
!     setheap ((void *) aligned_end, (void *) (aligned_end + (384 * 1024)));
      
      /* 
       * XXX Chicken-and-egg problem; we want to have console output early, but some

--Boundary_(ID_K78XnBrKi0QGreU1scT0Cw)--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36A14CEC.5B57D680>