minix/commands
Ben Gras 50e2064049 No more intel/minix segments.
This commit removes all traces of Minix segments (the text/data/stack
memory map abstraction in the kernel) and significance of Intel segments
(hardware segments like CS, DS that add offsets to all addressing before
page table translation). This ultimately simplifies the memory layout
and addressing and makes the same layout possible on non-Intel
architectures.

There are only two types of addresses in the world now: virtual
and physical; even the kernel and processes have the same virtual
address space. Kernel and user processes can be distinguished at a
glance as processes won't use 0xF0000000 and above.

No static pre-allocated memory sizes exist any more.

Changes to booting:
        . The pre_init.c leaves the kernel and modules exactly as
          they were left by the bootloader in physical memory
        . The kernel starts running using physical addressing,
          loaded at a fixed location given in its linker script by the
          bootloader.  All code and data in this phase are linked to
          this fixed low location.
        . It makes a bootstrap pagetable to map itself to a
          fixed high location (also in linker script) and jumps to
          the high address. All code and data then use this high addressing.
        . All code/data symbols linked at the low addresses is prefixed by
          an objcopy step with __k_unpaged_*, so that that code cannot
          reference highly-linked symbols (which aren't valid yet) or vice
          versa (symbols that aren't valid any more).
        . The two addressing modes are separated in the linker script by
          collecting the unpaged_*.o objects and linking them with low
          addresses, and linking the rest high. Some objects are linked
          twice, once low and once high.
        . The bootstrap phase passes a lot of information (e.g. free memory
          list, physical location of the modules, etc.) using the kinfo
          struct.
        . After this bootstrap the low-linked part is freed.
        . The kernel maps in VM into the bootstrap page table so that VM can
          begin executing. Its first job is to make page tables for all other
          boot processes. So VM runs before RS, and RS gets a fully dynamic,
          VM-managed address space. VM gets its privilege info from RS as usual
          but that happens after RS starts running.
        . Both the kernel loading VM and VM organizing boot processes happen
	  using the libexec logic. This removes the last reason for VM to
	  still know much about exec() and vm/exec.c is gone.

Further Implementation:
        . All segments are based at 0 and have a 4 GB limit.
        . The kernel is mapped in at the top of the virtual address
          space so as not to constrain the user processes.
        . Processes do not use segments from the LDT at all; there are
          no segments in the LDT any more, so no LLDT is needed.
        . The Minix segments T/D/S are gone and so none of the
          user-space or in-kernel copy functions use them. The copy
          functions use a process endpoint of NONE to realize it's
          a physical address, virtual otherwise.
        . The umap call only makes sense to translate a virtual address
          to a physical address now.
        . Segments-related calls like newmap and alloc_segments are gone.
        . All segments-related translation in VM is gone (vir2map etc).
        . Initialization in VM is simpler as no moving around is necessary.
        . VM and all other boot processes can be linked wherever they wish
          and will be mapped in at the right location by the kernel and VM
          respectively.

Other changes:
        . The multiboot code is less special: it does not use mb_print
          for its diagnostics any more but uses printf() as normal, saving
          the output into the diagnostics buffer, only printing to the
          screen using the direct print functions if a panic() occurs.
        . The multiboot code uses the flexible 'free memory map list'
          style to receive the list of free memory if available.
        . The kernel determines the memory layout of the processes to
          a degree: it tells VM where the kernel starts and ends and
          where the kernel wants the top of the process to be. VM then
          uses this entire range, i.e. the stack is right at the top,
          and mmap()ped bits of memory are placed below that downwards,
          and the break grows upwards.

Other Consequences:
        . Every process gets its own page table as address spaces
          can't be separated any more by segments.
        . As all segments are 0-based, there is no distinction between
          virtual and linear addresses, nor between userspace and
          kernel addresses.
        . Less work is done when context switching, leading to a net
          performance increase. (8% faster on my machine for 'make servers'.)
	. The layout and configuration of the GDT makes sysenter and syscall
	  possible.
2012-07-15 22:30:15 +02:00
..
acknm retire _CONST, _VOLATILE, _SIZET, _ARGS, _VOID 2012-03-25 21:58:20 +02:00
acksize retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
add_route Build NetBSD libc library in world in ELF mode. 2011-06-24 11:46:30 +02:00
arp Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
ash Clean up generated files for ash,ramdisk,libutil,libc 2012-06-18 10:54:56 +00:00
at retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
atnormalize Switch part/autopart to new mbr bootblock 2012-02-09 18:54:46 +01:00
autopart Switch part/autopart to new mbr bootblock 2012-02-09 18:54:46 +01:00
backup retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
badblocks Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
banner retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
basename retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
btrace btrace: gcc fix 2011-12-07 11:52:40 +01:00
cal retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
cawf retire _ANSI and <minix/ansi.h> 2012-03-25 21:58:27 +02:00
cd Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
cdprobe Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
checkhier Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
chmod retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
chown retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
ci retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
cksum retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
cleantmp cleantmp.c - protect against double definition of NDEBUG 2011-02-16 19:04:29 +00:00
clear Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
cmp retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
co retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
comm retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
compress retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
cp Replace rm and rmdir with NetBSD version 2012-01-16 10:46:14 +00:00
cpp better cpp 2012-02-17 23:53:44 +01:00
crc Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
cron Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
crontab Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
cut Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
dd retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
decomp16 retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
DESCRIBE Add fbd -- Faulty Block Device driver 2011-12-11 22:45:46 +01:00
dev2name Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
devmand devmand call the cleanup method before doing an exit. 2012-07-05 11:07:25 +02:00
devsize increase system-wide filename limit to 255 2011-08-17 16:00:01 +00:00
df Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
dhcpd Build NetBSD libc library in world in ELF mode. 2011-06-24 11:46:30 +02:00
dhrystone retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
diff Build NetBSD libc library in world in ELF mode. 2011-06-24 11:46:30 +02:00
dirname Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
diskctl diskctl(8) tool 2010-08-12 14:11:28 +00:00
dosread retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
dumpcore Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
eject commands: fixes for clang errors. 2010-07-06 12:10:23 +00:00
elvis retire _ANSI and <minix/ansi.h> 2012-03-25 21:58:27 +02:00
env Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
expand retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
factor retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
fbdctl Add fbd -- Faulty Block Device driver 2011-12-11 22:45:46 +01:00
fdisk retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
fetch fetch command 2010-07-01 00:06:41 +00:00
find Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
finger Build NetBSD libc library in world in ELF mode. 2011-06-24 11:46:30 +02:00
fingerd retire _CONST, _VOLATILE, _SIZET, _ARGS, _VOID 2012-03-25 21:58:20 +02:00
fix retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
fold retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
format commands: fix clang errors 2011-06-09 08:27:49 +02:00
fortune retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
fsck.mfs Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
ftp101 endianness compile fixes 2012-06-06 13:15:18 +02:00
gcore gcore: uninitialized variable fix and cleanup 2011-11-23 15:56:13 +01:00
gcov-pull Enable GCOV always 2011-12-07 15:20:26 +00:00
getty Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
grep More cleaning up 2012-02-15 19:04:58 +00:00
head retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
hexdump get rid of __LONG_LONG_SUPPORTED 2012-03-25 21:58:26 +02:00
host retire _CONST, _VOLATILE, _SIZET, _ARGS, _VOID 2012-03-25 21:58:20 +02:00
hostaddr retire _CONST, _VOLATILE, _SIZET, _ARGS, _VOID 2012-03-25 21:58:20 +02:00
id Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
ifconfig Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
ifdef retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
intr Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
ipcrm Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
ipcs Build NetBSD libc library in world in ELF mode. 2011-06-24 11:46:30 +02:00
irdpd Build NetBSD libc library in world in ELF mode. 2011-06-24 11:46:30 +02:00
isoread retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
join retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
kill retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
last retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
less import libterminfo, terminfo.db and stat command 2011-07-18 16:17:14 +02:00
loadfont Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
loadkeys Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
loadramdisk Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
logger Build NetBSD libc library in world in ELF mode. 2011-06-24 11:46:30 +02:00
look Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
lp Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
lpd Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
ls Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
lspci make all other commands use ProcFS 2010-09-14 21:31:56 +00:00
mail retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
MAKEDEV Add fbd -- Faulty Block Device driver 2011-12-11 22:45:46 +01:00
mdb Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
mesg retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
mined retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
mkfifo mkfifo.c: fix ack warning 2010-12-10 15:21:59 +00:00
mknod retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
mkproto retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
mount Fixes for mount -a. 2012-07-05 14:45:30 +02:00
mt Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
netconf adjust netconf for new su behaviour 2012-03-28 17:30:56 +02:00
nice Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
nohup Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
nonamed endianness compile fixes 2012-06-06 13:15:18 +02:00
od retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
part Switch part/autopart to new mbr bootblock 2012-02-09 18:54:46 +01:00
partition Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
paste retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
patch rename mmap() and munmap() 2011-07-16 13:01:19 +02:00
pax move pax and chmod for useradd 2012-01-11 00:26:09 +01:00
ping Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
pkgin_cd Update release script for pkgsrc 2010-09-10 17:00:30 +00:00
playwave retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
postinstall Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
poweroff Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
pr retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
pr_routes Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
prep retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
printf Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
printroot retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
profile retire bios_wini 2012-04-12 03:02:21 +02:00
progressbar retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
ps retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
pwd retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
pwdauth Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
ramdisk Move minix/paths.h to paths.h 2010-11-06 20:40:15 +00:00
rarpd Build NetBSD libc library in world in ELF mode. 2011-06-24 11:46:30 +02:00
rawspeed Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
rcp Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
rdate Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
readall retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
readclock remove hardcoding of system.conf path in various service calls 2010-09-10 09:22:22 +00:00
reboot retire _CONST, _VOLATILE, _SIZET, _ARGS, _VOID 2012-03-25 21:58:20 +02:00
recwave retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
remsync Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
repartition Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
rev Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
rget Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
rlogin retire _CONST, _VOLATILE, _SIZET, _ARGS, _VOID 2012-03-25 21:58:20 +02:00
rotate Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
rsh retire _CONST, _VOLATILE, _SIZET, _ARGS, _VOID 2012-03-25 21:58:20 +02:00
rshd Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
screendump commands: fixes for clang errors. 2010-07-06 12:10:23 +00:00
service Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
setup Add entry in fstab and let the mount system call start devman. 2012-07-05 14:52:16 +02:00
shar retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
sleep retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
slip Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
sort retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
spell Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
split retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
srccrc Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
stty retire _ANSI and <minix/ansi.h> 2012-03-25 21:58:27 +02:00
sum retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
svclog Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
svrctl Add a simple utility to send control messages 2012-04-13 12:58:41 +00:00
swifi swifi: modernize a bit 2012-03-05 22:41:49 +01:00
sync retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
synctree synctree compile fix 2012-05-31 22:42:49 +02:00
sysenv Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
syslogd generate sys_errlist without holes 2011-07-13 23:42:07 +02:00
tail retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
tar Enable LZMA supprt with tar(1) 2012-04-25 17:52:33 +02:00
tcpd Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
tcpdp Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
tcpstat Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
tee retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
telnet Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
telnetd retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
term retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
termcap retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
tget commands: fixes for clang errors. 2010-07-06 12:10:23 +00:00
time retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
touch Cleanup dep file. 2010-07-05 21:04:31 +00:00
tr Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
truncate Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
tsort retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
tty retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
udpstat Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
umount retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
uname retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
unexpand retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
unstack changes for detecting and building for clang/binutils elf 2011-06-07 16:49:52 +02:00
update retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
update_bootcfg update_bootcfg: fix: generate absolute paths 2012-04-18 16:30:06 +02:00
updateboot updateboot script for netbsd bootloader 2012-02-15 03:51:27 +01:00
uud retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
uue retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
version Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
vol retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
wc retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
whereis Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
which retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
who Move minix/paths.h to paths.h 2010-11-06 20:40:15 +00:00
worldstone worldstone benchmark script 2011-09-24 14:49:55 +00:00
write retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
writeisofs writeisofs: also boots plain binaries with -B 2012-02-09 18:54:49 +01:00
xargs Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
yes Rename mkfiles from minix.*.mk to bsd.*.mk 2010-06-25 18:29:09 +00:00
zdump Remove MINIXSRCDIR and use NETBSDSRCDIR 2012-06-18 10:53:35 +00:00
zmodem retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
Makefile No more intel/minix segments. 2012-07-15 22:30:15 +02:00
Makefile.inc Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00