Beginnings of support for loadable protocol domains. In particular,

don't hard-code netisr values in icu.s, but rather, use an array of
function pointers and set them all up in machdep.c for statically-linked
protocol families.  (This will eventually be done differently.)
This commit is contained in:
wollman 1994-09-14 23:56:08 +00:00
parent 7c99dec97a
commit 0d94d302f2
3 changed files with 76 additions and 19 deletions

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.60 1994/09/02 04:12:04 davidg Exp $
* $Id: machdep.c,v 1.61 1994/09/04 19:59:14 pst Exp $
*/
#include "npx.h"
@ -80,6 +80,8 @@
#include <sys/exec.h>
#include <sys/vnode.h>
#include <net/netisr.h>
extern vm_offset_t avail_start, avail_end;
#include <machine/cpu.h>
@ -164,6 +166,7 @@ cpu_startup()
register caddr_t v;
int maxbufs, base, residual;
extern long Usrptsize;
extern void (*netisrs[32])(void);
vm_offset_t minaddr, maxaddr;
vm_size_t size = 0;
int firstaddr;
@ -189,6 +192,25 @@ cpu_startup()
if (badpages)
printf("bad memory = %d (%d pages)\n", ptoa(badpages), badpages);
/*
* Quickly wire in netisrs.
*/
#define DONET(isr, n) do { extern void isr(void); netisrs[n] = isr; } while(0)
#ifdef INET
DONET(arpintr, NETISR_ARP);
DONET(ipintr, NETISR_IP);
#endif
#ifdef NS
DONET(nsintr, NETISR_NS);
#endif
#ifdef ISO
DONET(clnlintr, NETISR_ISO);
#endif
#ifdef CCITT
DONET(ccittintr, NETISR_CCITT);
#endif
#undef DONET
/*
* Allocate space for system data structures.
* The first available kernel virtual address is in "v".

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.60 1994/09/02 04:12:04 davidg Exp $
* $Id: machdep.c,v 1.61 1994/09/04 19:59:14 pst Exp $
*/
#include "npx.h"
@ -80,6 +80,8 @@
#include <sys/exec.h>
#include <sys/vnode.h>
#include <net/netisr.h>
extern vm_offset_t avail_start, avail_end;
#include <machine/cpu.h>
@ -164,6 +166,7 @@ cpu_startup()
register caddr_t v;
int maxbufs, base, residual;
extern long Usrptsize;
extern void (*netisrs[32])(void);
vm_offset_t minaddr, maxaddr;
vm_size_t size = 0;
int firstaddr;
@ -189,6 +192,25 @@ cpu_startup()
if (badpages)
printf("bad memory = %d (%d pages)\n", ptoa(badpages), badpages);
/*
* Quickly wire in netisrs.
*/
#define DONET(isr, n) do { extern void isr(void); netisrs[n] = isr; } while(0)
#ifdef INET
DONET(arpintr, NETISR_ARP);
DONET(ipintr, NETISR_IP);
#endif
#ifdef NS
DONET(nsintr, NETISR_NS);
#endif
#ifdef ISO
DONET(clnlintr, NETISR_ISO);
#endif
#ifdef CCITT
DONET(ccittintr, NETISR_CCITT);
#endif
#undef DONET
/*
* Allocate space for system data structures.
* The first available kernel virtual address is in "v".

View File

@ -36,7 +36,7 @@
*
* @(#)icu.s 7.2 (Berkeley) 5/21/91
*
* $Id: icu.s,v 1.11 1994/08/15 03:15:19 wollman Exp $
* $Id: icu.s,v 1.12 1994/08/18 05:09:24 davidg Exp $
*/
/*
@ -296,29 +296,42 @@ swi_clock:
addl $4,%esp
ret
#define DONET(s, c, event) ; \
.globl c ; \
ALIGN_TEXT
.globl _dummynetisr
_dummynetisr:
MCOUNT
ret
.data
.globl _netisrs
_netisrs:
.long _dummynetisr, _dummynetisr, _dummynetisr, _dummynetisr
.long _dummynetisr, _dummynetisr, _dummynetisr, _dummynetisr
.long _dummynetisr, _dummynetisr, _dummynetisr, _dummynetisr
.long _dummynetisr, _dummynetisr, _dummynetisr, _dummynetisr
.long _dummynetisr, _dummynetisr, _dummynetisr, _dummynetisr
.long _dummynetisr, _dummynetisr, _dummynetisr, _dummynetisr
.long _dummynetisr, _dummynetisr, _dummynetisr, _dummynetisr
.long _dummynetisr, _dummynetisr, _dummynetisr, _dummynetisr
#define DONET(s) ; \
btrl $s,_netisr ; \
jnc 9f ; \
call c ; \
movl $_netisrs+4*s,%eax ; \
call (%eax) ; \
9:
ALIGN_TEXT
swi_net:
MCOUNT
#ifdef INET
DONET(NETISR_ARP, _arpintr,netisr_ip)
DONET(NETISR_IP, _ipintr,netisr_ip)
#endif
#ifdef NS
DONET(NETISR_NS, _nsintr,netisr_ns)
#endif
#ifdef ISO
DONET(NETISR_ISO, _clnlintr,netisr_iso)
#endif
#ifdef CCITT
DONET(NETISR_CCITT, _ccittintr, 29)
#endif
DONET(0) ; DONET(1) ; DONET(2) ; DONET(3) ; DONET(4)
DONET(5) ; DONET(6) ; DONET(7) ; DONET(8) ; DONET(9)
DONET(10) ; DONET(11) ; DONET(12) ; DONET(13) ; DONET(14)
DONET(15) ; DONET(16) ; DONET(17) ; DONET(18) ; DONET(19)
DONET(20) ; DONET(21) ; DONET(22) ; DONET(23) ; DONET(24)
DONET(25) ; DONET(26) ; DONET(27) ; DONET(28) ; DONET(29)
DONET(30) ; DONET(31)
ret
ALIGN_TEXT