Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 77674
Collapse All | Expand All

(-)25/arch/i386/kernel/cpu/mtrr/main.c~mtrr-size-and-base-debug (-9 / +15 lines)
Lines 375-380 int mtrr_add_page(unsigned long base, un Link Here
375
	return error;
375
	return error;
376
}
376
}
377
377
378
static int mtrr_check(unsigned long base, unsigned long size)
379
{
380
	if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
381
		printk(KERN_WARNING
382
			"mtrr: size and base must be multiples of 4 kiB\n");
383
		printk(KERN_DEBUG
384
			"mtrr: size: 0x%lx  base: 0x%lx\n", size, base);
385
		dump_stack();
386
		return -1;
387
	}
388
	return 0;
389
}
390
378
/**
391
/**
379
 *	mtrr_add - Add a memory type region
392
 *	mtrr_add - Add a memory type region
380
 *	@base: Physical base address of region
393
 *	@base: Physical base address of region
Lines 415-425 int Link Here
415
mtrr_add(unsigned long base, unsigned long size, unsigned int type,
428
mtrr_add(unsigned long base, unsigned long size, unsigned int type,
416
	 char increment)
429
	 char increment)
417
{
430
{
418
	if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
431
	if (mtrr_check(base, size))
419
		printk(KERN_WARNING "mtrr: size and base must be multiples of 4 kiB\n");
420
		printk(KERN_DEBUG "mtrr: size: 0x%lx  base: 0x%lx\n", size, base);
421
		return -EINVAL;
432
		return -EINVAL;
422
	}
423
	return mtrr_add_page(base >> PAGE_SHIFT, size >> PAGE_SHIFT, type,
433
	return mtrr_add_page(base >> PAGE_SHIFT, size >> PAGE_SHIFT, type,
424
			     increment);
434
			     increment);
425
}
435
}
Lines 511-521 int mtrr_del_page(int reg, unsigned long Link Here
511
int
521
int
512
mtrr_del(int reg, unsigned long base, unsigned long size)
522
mtrr_del(int reg, unsigned long base, unsigned long size)
513
{
523
{
514
	if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
524
	if (mtrr_check(base, size))
515
		printk(KERN_INFO "mtrr: size and base must be multiples of 4 kiB\n");
516
		printk(KERN_DEBUG "mtrr: size: 0x%lx  base: 0x%lx\n", size, base);
517
		return -EINVAL;
525
		return -EINVAL;
518
	}
519
	return mtrr_del_page(reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT);
526
	return mtrr_del_page(reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT);
520
}
527
}
521
528
522

Return to bug 77674