diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-04 16:48:37 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-04 16:48:37 +0200 |
commit | 5f1b70f437ed4f598f9439e201f1f7644f5ce7b5 (patch) | |
tree | 7eede785ac28d6d2ed770274e7957e5deeb6d5c9 /sys/src/9/pc/devi82365.c | |
parent | 8debb0736ea5578a195ab663bf9565d6e52ad83b (diff) |
pc, pc64: new memory map code
This replaces the memory map code for both pc and pc64
kernels with a unified implementation using the new
portable memory map code.
The main motivation is to be robust against broken
e820 memory maps by the bios and delay the Conf.mem[]
allocation after archinit(), so mp and acpi tables
can be reserved and excluded from user memory.
There are a few changes:
new memreserve() function has been added for archinit()
to reserve bios and acpi tables.
upareserve() has been replaced by upaalloc(), which now
has an address argument.
umbrwmalloc() and umbmalloc() have been replaced by
umballoc().
both upaalloc() and umballoc() return physical addresses
or -1 on error. the physical address -1 is now used as
a sentinel value instead of 0 when dealing with physical
addresses.
archmp and archacpi now always use vmap() to access
the bios tables and reserve the ranges. more overflow
checks have been added.
ramscan() has been rewritten using vmap().
to handle the population of kernel memory, pc and pc64
now have pmap() and punmap() functions to do permanent
mappings.
Diffstat (limited to 'sys/src/9/pc/devi82365.c')
-rw-r--r-- | sys/src/9/pc/devi82365.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/src/9/pc/devi82365.c b/sys/src/9/pc/devi82365.c index 6defcaeb9..20cace973 100644 --- a/sys/src/9/pc/devi82365.c +++ b/sys/src/9/pc/devi82365.c @@ -268,7 +268,6 @@ pcmmap(int slotno, ulong offset, int len, int attr) if((we & bit)) if(m->attr == attr) if(offset >= m->ca && e <= m->cea){ - m->ref++; unlock(&pp->mlock); return m; @@ -285,12 +284,13 @@ pcmmap(int slotno, ulong offset, int len, int attr) /* if isa space isn't big enough, free it and get more */ if(m->len < len){ - if(m->isa){ + if(m->len){ umbfree(m->isa, m->len); m->len = 0; } - m->isa = PADDR(umbmalloc(0, len, Mgran)); - if(m->isa == 0){ + m->isa = umballoc(-1, len, Mgran); + if(m->isa == -1){ + m->isa = 0; print("pcmmap: out of isa space\n"); unlock(&pp->mlock); return 0; |