View | Details | Raw Unified | Return to bug 267028 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/kern/kern_linker.c (+39 lines)
Lines 1475-1480 sys_kldsym(struct thread *td, struct kldsym_args *uap) Link Here
1475
	return (error);
1475
	return (error);
1476
}
1476
}
1477
1477
1478
#define MODLIST_NEWMOD_HIST_SLOTS 256
1479
static char const* modlist_newmod_lookup_name=         NULL;                      // NULL: No problem found.
1480
static int         modlist_newmod_hist_pos=            MODLIST_NEWMOD_HIST_SLOTS; // First update will wrap to 0 first.
1481
static int         modlist_newmod_tqe_next_changed_at= MODLIST_NEWMOD_HIST_SLOTS; // I.E.: No such found.
1482
static modlist_t   modlist_newmod_tqe_next_newvalue=   NULL;                      // NULL: No such found.
1483
static struct modlist_newmod_hist_type {
1484
	modlist_t     modAddr;
1485
	linker_file_t containerAddr;
1486
	char const*   modnameAddr;
1487
	int           version;
1488
} modlist_newmod_hist[MODLIST_NEWMOD_HIST_SLOTS];
1489
1478
/*
1490
/*
1479
 * Preloaded module support
1491
 * Preloaded module support
1480
 */
1492
 */
Lines 1484-1489 modlist_lookup(const char *name, int ver) Link Here
1484
{
1496
{
1485
	modlist_t mod;
1497
	modlist_t mod;
1486
1498
1499
	if (modlist_newmod_hist_pos<MODLIST_NEWMOD_HIST_SLOTS)
1500
	{
1501
		int modlist_newmod_rescan_start_at = 0;
1502
		if (16 <= modlist_newmod_hist_pos) modlist_newmod_rescan_start_at= modlist_newmod_hist_pos-16;
1503
		for (int scan_pos= modlist_newmod_rescan_start_at; scan_pos<modlist_newmod_hist_pos; ++scan_pos)
1504
			if(modlist_newmod_hist[scan_pos].modAddr->link.tqe_next != modlist_newmod_hist[scan_pos+1].modAddr)
1505
			{
1506
				modlist_newmod_lookup_name=         name;
1507
				modlist_newmod_tqe_next_changed_at= scan_pos;
1508
				modlist_newmod_tqe_next_newvalue=   modlist_newmod_hist[scan_pos].modAddr->link.tqe_next;
1509
				panic("modlist_lookup: a prior tqe_next changed!");
1510
			}
1511
	}
1512
1487
	TAILQ_FOREACH(mod, &found_modules, link) {
1513
	TAILQ_FOREACH(mod, &found_modules, link) {
1488
		if (strcmp(mod->name, name) == 0 &&
1514
		if (strcmp(mod->name, name) == 0 &&
1489
		    (ver == 0 || mod->version == ver))
1515
		    (ver == 0 || mod->version == ver))
Lines 1521-1528 modlist_newmodule(const char *modname, int version, linker_file_t container) Link Here
1521
	modlist_t mod;
1547
	modlist_t mod;
1522
1548
1523
	mod = malloc(sizeof(struct modlist), M_LINKER, M_NOWAIT | M_ZERO);
1549
	mod = malloc(sizeof(struct modlist), M_LINKER, M_NOWAIT | M_ZERO);
1550
1551
	++modlist_newmod_hist_pos;
1552
	if (MODLIST_NEWMOD_HIST_SLOTS<=modlist_newmod_hist_pos) modlist_newmod_hist_pos= 0;
1553
#undef MODLIST_NEWMOD_HIST_SLOTS
1554
	modlist_newmod_hist[modlist_newmod_hist_pos].modAddr=       mod;
1555
	modlist_newmod_hist[modlist_newmod_hist_pos].containerAddr= container;
1556
	modlist_newmod_hist[modlist_newmod_hist_pos].modnameAddr=   modname;
1557
	modlist_newmod_hist[modlist_newmod_hist_pos].version=       version;
1558
1524
	if (mod == NULL)
1559
	if (mod == NULL)
1525
		panic("no memory for module list");
1560
		panic("no memory for module list");
1561
1562
	if (mod < (modlist_t)0xfffff80000000100)
1563
		panic("modlist_newmodule: mod < (modlist_t)PHYS_TO_DMAP(0x100)");
1564
1526
	mod->container = container;
1565
	mod->container = container;
1527
	mod->name = modname;
1566
	mod->name = modname;
1528
	mod->version = version;
1567
	mod->version = version;

Return to bug 267028