plan9fox/sys/src/9/pc/mkfile
cinap_lenrek 5f1b70f437 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.
2020-04-04 16:48:37 +02:00

188 lines
4 KiB
Makefile

CONF=pc
CONFLIST=pc pcf pccpuf
EXTRACOPIES=
#EXTRACOPIES=lookout boundary # copy to these servers on install
objtype=386
</$objtype/mkfile
p=9
# must match mem.h
KTZERO=0xF0100020
APBOOTSTRAP=0xF0007000
REBOOTADDR=0x11000
DEVS=`{rc ../port/mkdevlist $CONF}
PORT=\
alarm.$O\
alloc.$O\
allocb.$O\
auth.$O\
cache.$O\
chan.$O\
dev.$O\
edf.$O\
fault.$O\
page.$O\
parse.$O\
pgrp.$O\
portclock.$O\
print.$O\
proc.$O\
qio.$O\
qlock.$O\
random.$O\
rdb.$O\
rebootcmd.$O\
memmap.$O\
segment.$O\
syscallfmt.$O\
sysfile.$O\
sysproc.$O\
taslock.$O\
tod.$O\
xalloc.$O\
userinit.$O\
OBJ=\
l.$O\
cga.$O\
i8253.$O\
i8259.$O\
main.$O\
memory.$O\
mmu.$O\
trap.$O\
bootargs.$O\
$CONF.root.$O\
$CONF.rootc.$O\
$DEVS\
$PORT\
LIB=\
/$objtype/lib/libmemlayer.a\
/$objtype/lib/libmemdraw.a\
/$objtype/lib/libdraw.a\
/$objtype/lib/libip.a\
/$objtype/lib/libc.a\
/$objtype/lib/libsec.a\
/$objtype/lib/libmp.a\
/$objtype/lib/libfis.a\
/$objtype/lib/libaml.a\
/$objtype/lib/libdtracy.a\
ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
AUDIO=`{echo devaudio.c audio*.c | sed 's/\.c/.'$O'/g'}
VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
SDEV=`{echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}
$p$CONF: $OBJ $CONF.$O $LIB
$LD -o $target -T$KTZERO -l $prereq
size $target
# don't strip the gzipped kernels -- too frustrating when that's all you have!
$p%.gz:D: $p%
gzip -9 <$p$stem >$p$stem.gz
# pcflop and pccd need all the space they can get
9pcflop.gz:D: 9pcflop
strip -o /fd/1 9pcflop | gzip -9 >9pcflop.gz
9pccd.gz:D: 9pccd
strip -o /fd/1 9pccd | gzip -9 >9pccd.gz
install:V: $p$CONF
cp $p$CONF /$objtype/
for(i in $EXTRACOPIES)
import $i / /n/$i && cp $p$CONF $p$CONF.gz /n/$i/$objtype/
<../boot/bootmkfile
<../port/portmkfile
<|../port/mkbootrules $CONF
$ETHER: ../port/etherif.h ../port/netif.h
$AUDIO: ../port/audioif.h
ether8003.$O ether8390.$O: ether8390.h
etheryuk.$O: yukdump.h
$VGA mouse.$O: screen.h /sys/include/memdraw.h
vgavesa.$O: /386/include/ureg.h
devfloppy.$O: floppy.h
mp.$O: apbootstrap.i
apic.$O archmp.$O mp.$O: mp.h
squidboy.$O: mp.h
$SDEV: ../port/sd.h
sd53c8xx.$O: sd53c8xx.i
sdiahci.$O: ahci.h
devaoe.$O sdaoe.$O: ../port/aoe.h
main.$O: rebootcode.i
wavelan.$O: wavelan.c ../pc/wavelan.c ../pc/wavelan.h
etherwavelan.$O: etherwavelan.c ../pc/wavelan.h
devusb.$O usbuhci.$O usbohci.$O usbehci.$O usbehcipc.$O usbxhci.$O: ../port/usb.h
usbehci.$O usbehcipc.$O: usbehci.h
trap.$O main.$O: /sys/include/tos.h
uartaxp.$O: uartaxp.i
ether8169.$O: ../port/ethermii.h
etherdp83820.$O: ../port/ethermii.h
etherigbe.$O: ../port/ethermii.h
ethervgbe.$O: ../port/ethermii.h
ethervt6102.$O: ../port/ethermii.h
ethervt6105m.$O: ../port/ethermii.h
etherm10g.$O: etherm10g2k.i etherm10g4k.i
etheriwl.$O: ../port/wifi.h
etherwpi.$O: ../port/wifi.h
etherrt2860.$O: ../port/wifi.h
l.$O rebootcode.$O apbootstrap.$O: mem.h
initcode.out: init9.$O initcode.$O /$objtype/lib/libc.a
$LD -l -R1 -s -o $target $prereq
rebootcode.out: rebootcode.$O
$LD -l -R4 -s -o $target -T$REBOOTADDR -H3 $prereq
apbootstrap.out: apbootstrap.$O
$LD -l -R4 -s -o $target -T$APBOOTSTRAP -H3 $prereq
sd53c8xx.i: sd53c8xx.n
aux/na $prereq > $target
uartaxp.i: a100p.cp
{echo 'static uchar uartaxpcp[] = {'
xd -1x $prereq |
sed -e 's/^[0-9a-f]+ //' -e '/^$/d' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
echo '};'
} > $target
etherm10g%.i: etherm10g%.fw
{echo 'static char fw'^$stem^'[] = {'
xd -1x $prereq |
sed -e 's/^[0-9a-f]+ //' -e '/^$/d' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
echo '};'
} > $target
acid:V:
8c -a -w -I. i8253.c>acid
%.checkether:VQ:
for (i in ether*.c){
x=`{echo $i | sed 's/\.c//'}
if(! ~ $x ether8390 && ! grep -s '^ '^$x^'([ ]|$)' $stem)
echo $x not included in $stem
}
exit 0
%.checkvga:VQ:
for (i in vga*.c){
x=`{echo $i | sed 's/\.c//'}
if(! ~ $x vga vgax vgasavage && ! grep -s '^ '^$x^'([ ]|$)' $stem)
echo $x not included in $stem
}
exit 0
checkdist:VQ:
for(i in pcdisk pcflop)
for(j in checkvga checkether)
mk $i.$j