Page MenuHomeFreeBSD

D32872.diff
No OneTemporary

D32872.diff

Index: sys/kern/subr_physmem.c
===================================================================
--- sys/kern/subr_physmem.c
+++ sys/kern/subr_physmem.c
@@ -390,7 +390,7 @@
/*
* Add a hardware memory region.
*/
-void
+int
physmem_hardware_region(uint64_t pa, uint64_t sz)
{
vm_offset_t adj;
@@ -401,12 +401,12 @@
*/
if (pa == 0) {
if (sz <= PAGE_SIZE)
- return;
- pa = PAGE_SIZE;
+ return (0);
+ pa = PAGE_SIZE;
sz -= PAGE_SIZE;
} else if (pa > MAX_PHYS_ADDR) {
/* This range is past usable memory, ignore it */
- return;
+ return (ERANGE);
}
/*
@@ -423,7 +423,7 @@
if ((pa + sz) > (MAX_PHYS_ADDR - 1024 * 1024)) {
sz = MAX_PHYS_ADDR - pa + 1;
if (sz <= 1024 * 1024)
- return;
+ return (0);
sz -= 1024 * 1024;
}
@@ -435,14 +435,18 @@
pa = round_page(pa);
sz = trunc_page(sz - adj);
- if (sz > 0 && hwcnt < nitems(hwregions))
- hwcnt = insert_region(hwregions, hwcnt, pa, sz, 0);
+ if (sz == 0)
+ return (EINVAL);
+ if (hwcnt == nitems(hwregions))
+ return (E2BIG);
+ hwcnt = insert_region(hwregions, hwcnt, pa, sz, 0);
+ return (0);
}
/*
* Add an exclusion region.
*/
-void
+int
physmem_exclude_region(vm_paddr_t pa, vm_size_t sz, uint32_t exflags)
{
vm_offset_t adj;
@@ -455,10 +459,10 @@
pa = trunc_page(pa);
sz = round_page(sz + adj);
- if (excnt >= nitems(exregions))
- panic("failed to exclude region %#jx-%#jx", (uintmax_t)pa,
- (uintmax_t)(pa + sz));
+ if (excnt == nitems(exregions))
+ return (E2BIG);
excnt = insert_region(exregions, excnt, pa, sz, exflags);
+ return (0);
}
size_t
Index: sys/sys/physmem.h
===================================================================
--- sys/sys/physmem.h
+++ sys/sys/physmem.h
@@ -49,8 +49,8 @@
#define EXFLAG_NODUMP 0x01
#define EXFLAG_NOALLOC 0x02
-void physmem_hardware_region(uint64_t pa, uint64_t sz);
-void physmem_exclude_region(vm_paddr_t pa, vm_size_t sz, uint32_t flags);
+int physmem_hardware_region(uint64_t pa, uint64_t sz);
+int physmem_exclude_region(vm_paddr_t pa, vm_size_t sz, uint32_t flags);
size_t physmem_avail(vm_paddr_t *avail, size_t maxavail);
void physmem_init_kernel_globals(size_t *pa_idx, size_t *da_idx);
void physmem_print_tables(void);

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 8:48 PM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14733559
Default Alt Text
D32872.diff (2 KB)

Event Timeline