diff options
Diffstat (limited to 'microkernel')
-rw-r--r-- | microkernel/mach.mdwn | 19 | ||||
-rw-r--r-- | microkernel/mach/coding_style.mdwn | 16 | ||||
-rw-r--r-- | microkernel/mach/documentation.mdwn | 10 | ||||
-rw-r--r-- | microkernel/mach/gnumach.mdwn | 11 | ||||
-rw-r--r-- | microkernel/mach/gnumach/building.mdwn | 28 | ||||
-rw-r--r-- | microkernel/mach/gnumach/debugging.mdwn | 89 | ||||
-rw-r--r-- | microkernel/mach/gnumach/hardware_compatibility_list.mdwn | 4 | ||||
-rw-r--r-- | microkernel/mach/gnumach/preemption.mdwn | 2 | ||||
-rw-r--r-- | microkernel/mach/mig/documentation.mdwn | 4 | ||||
-rw-r--r-- | microkernel/mach/mig/gnu_mig/building.mdwn | 13 | ||||
-rw-r--r-- | microkernel/mach/mig/gnu_mig/discussion.mdwn | 9 | ||||
-rw-r--r-- | microkernel/mach/thread.mdwn | 2 |
12 files changed, 156 insertions, 51 deletions
diff --git a/microkernel/mach.mdwn b/microkernel/mach.mdwn index 02627766..3abb548d 100644 --- a/microkernel/mach.mdwn +++ b/microkernel/mach.mdwn @@ -1,5 +1,4 @@ -[[!meta copyright="Copyright © 2007, 2008, 2010, 2012 Free Software Foundation, -Inc."]] +[//]: # ([[meta copyright="Copyright © 2007, 2008, 2010, 2012 Free Software Foundation, Inc."]]) [[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable id="license" text="Permission is granted to copy, distribute and/or modify this @@ -9,29 +8,23 @@ Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled [[GNU Free Documentation License|/fdl]]."]]"""]] -Mach is a so-called first generation [[microkernel]]. It is the +[[!meta title="Mach"]] + +Mach is a so-called first generation [[microkernel]]. Originally developed by Carnegie Mellon University (CMU) from 1985 to 1994, which was then forked and carried from 1996 onward by GNU. It is the microkernel currently used by the [[Hurd]]. * [[Concepts]] - * [[Deficiencies]] - * [[Documentation]] - * [[History]] - * [Torvalds, Tanenbaum - Debate](http://www.dina.dk/~abraham/Linus_vs_Tanenbaum.html) + Debate](http://choices.cs.illinois.edu/cache/Linus_vs_Tanenbaum.html) # Implementations * [[GNU_Mach|gnumach]] - - * [Apple's Darwin](http://developer.apple.com/darwin/) - ([API](http://developer.apple.com/documentation/Darwin/Conceptual/KernelProgramming/index.html)) - (**non-free**) - + * [Apple's XNU (Darwin)](https://github.com/apple-oss-distributions/xnu) (**non-free**) * [[open_issues/OSF_Mach]] diff --git a/microkernel/mach/coding_style.mdwn b/microkernel/mach/coding_style.mdwn new file mode 100644 index 00000000..061136c4 --- /dev/null +++ b/microkernel/mach/coding_style.mdwn @@ -0,0 +1,16 @@ +[[!meta copyright="Copyright © 2020 Free Software Foundation, Inc."]] + +[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable +id="license" text="Permission is granted to copy, distribute and/or modify this +document under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation; with no Invariant +Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license +is included in the section entitled [[GNU Free Documentation +License|/fdl]]."]]"""]] + +[[!tag open_issue_documentation]] + +The Mach source code uses a few varying coding styles. When adding code to an +existing file, please stick to the coding style already used around the code you +are adding. For new files, use the +[FreeBSD Coding Style](https://www.freebsd.org/cgi/man.cgi?query=style&sektion=9) diff --git a/microkernel/mach/documentation.mdwn b/microkernel/mach/documentation.mdwn index 61e3469b..a4e455e4 100644 --- a/microkernel/mach/documentation.mdwn +++ b/microkernel/mach/documentation.mdwn @@ -1,5 +1,4 @@ -[[!meta copyright="Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -2010, 2013 Free Software Foundation, Inc."]] +[//]: # ([[meta copyright="Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2013 Free Software Foundation, Inc."]]) [[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable id="license" text="Permission is granted to copy, distribute and/or modify this @@ -9,6 +8,8 @@ Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled [[GNU Free Documentation License|/fdl]]."]]"""]] +[[!meta title="Mach Documentation"]] + * Mach's [[concepts]]. * [*Meet Mach* by James @@ -49,11 +50,10 @@ License|/fdl]]."]]"""]] - [A Programmers' Guide to Mach System Call](http://shakthimaan.com/downloads/hurd/A.Programmers.Guide.to.the.Mach.System.Calls.pdf) -# IRC, freenode, #hurd, 2013-09-15 +### IRC, freenode, #hurd, 2013-09-15 <teythoon> braunr: btw, are there multiple kernel threads in gnumach? - <teythoon> and is it safe to do a synchronous rpc call to a userspace - server? + <teythoon> and is it safe to do a synchronous rpc call to a userspace server? <braunr> teythoon: there are yes, but few <braunr> teythoon: the main (perhaps only) kernel thread is the page daemon <braunr> and no, it's not safe to do synchronous calls to userspace diff --git a/microkernel/mach/gnumach.mdwn b/microkernel/mach/gnumach.mdwn index 08331b04..9626161b 100644 --- a/microkernel/mach/gnumach.mdwn +++ b/microkernel/mach/gnumach.mdwn @@ -1,5 +1,4 @@ -[[!meta copyright="Copyright © 2001, 2002, 2007, 2008, 2011, 2013, 2015, 2016 -Free Software Foundation, Inc."]] +[//]: # (meta copyright="Copyright © 2001, 2002, 2007, 2008, 2011, 2013, 2015, 2016 Free Software Foundation, Inc.") [[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable id="license" text="Permission is granted to copy, distribute and/or modify this @@ -9,6 +8,8 @@ Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled [[GNU Free Documentation License|/fdl]]."]]"""]] +[[!meta title="GNU Mach"]] + GNU Mach is the microkernel upon which a GNU Hurd system is based. It provides an Inter Process Communication (IPC) mechanism that the Hurd uses to define interfaces for implementing in a distributed multi-server fashion the services @@ -26,7 +27,7 @@ GNU Mach runs on x86 machines. See the The latest release is [[GNU Mach 1.8|news/2016-12-18-releases]]. - +--- # Advantages of GNU Mach GNU Mach is not the most advanced [[microkernel]] known to the planet, nor is @@ -64,7 +65,7 @@ features which make it useful as the base of the [[Hurd]] system. Mach is the base of a functional multi-server operating system, the [[Hurd]]. - +--- # Booting To actually use the kernel and boot the GNU operating system, you need a boot @@ -73,7 +74,7 @@ that supports the multiboot standard. The bootloader of the GNU system is [[GNU_GRUB|grub]], which supports a broad range of operating systems including GNU/Hurd. - +--- # Development * [[Reference_Manual]] diff --git a/microkernel/mach/gnumach/building.mdwn b/microkernel/mach/gnumach/building.mdwn index cf5843ff..e8236a83 100644 --- a/microkernel/mach/gnumach/building.mdwn +++ b/microkernel/mach/gnumach/building.mdwn @@ -22,28 +22,27 @@ enabled) is around 50 MiB. You can either use the git repository (see <http://git.savannah.gnu.org/git/hurd/>), $ git clone https://git.savannah.gnu.org/git/hurd/gnumach.git/ + $ cd gnumach + $ autoreconf --install -... or get the Debian sources, if you're using Debian. (See +... or get the Debian sources to build a Debian package, if you're using Debian. (See [here](http://packages.debian.net/source/unstable/gnumach).) - $ apt-get source gnumach + $ apt source gnumach + $ cd gnumach-XXXXXXXX -## On Debian Systems: +## Building a `.deb` package on Debian Systems: ### Preparing for the Build Building GNU Mach requires the *build-essential* and *fakeroot* packages, and some additional dependencies specified by the gnumach source package: - # apt-get install build-essential fakeroot - # apt-get build-dep gnumach + # apt install build-essential fakeroot + # apt build-dep gnumach ### Building and Installing ... Debian `.deb` files -Change into the directory with the downloaded / unpacked GNU Mach sources, - - $ cd gnumach-XXXXXXXX - Start the build process with $ dpkg-buildpackage -us -uc -b -rfakeroot @@ -56,18 +55,13 @@ directory and has a similar name as the build directory: You can now reboot your computer and enjoy the new kernel. -## On non-Debian Systems: +## Building from the git repository: ### Preparing for the Build Building GNU Mach requires a C compiler, a _static_ 32 bit standard C library, your favourite flavor of awk (gawk) and GNU make. -First, create the configuration files: - - $ cd gnumach - $ autoreconf --install - GNU Mach (and the associated headers) need be built in a separate build directory: $ mkdir build @@ -77,10 +71,10 @@ Run configure: $ ../configure --prefix= -If building on a 64 bit host system, +If building on a Linux 64 bit host system, you need a number of additional settings to force a 32 bit build: - $ CPP='gcc -m32 -E -x c -undef -ansi' CC='gcc -m32' LD='ld -melf_i386' ../configure --prefix= --host=i686-unknown-linux-gnu + $ ../configure --prefix= --host=i686-gnu LD=i686-linux-gnu-ld CC=i686-linux-gnu-gcc ### Installing the Header Files First diff --git a/microkernel/mach/gnumach/debugging.mdwn b/microkernel/mach/gnumach/debugging.mdwn index 9534c758..bcff970e 100644 --- a/microkernel/mach/gnumach/debugging.mdwn +++ b/microkernel/mach/gnumach/debugging.mdwn @@ -73,15 +73,102 @@ and then type continue, to let Mach continue execution. The debugger will be ent struct db_watchpoint watch = { .task = NULL, .loaddr= 0x40e, .hiaddr = 0x40e+2, .link = NULL}; db_set_hw_watchpoint(&watch, 0); +To discover what an arbitrary address points to, try + + whatis 0x123400 + # GDB in QEMU When you're [[running_a_system_in_QEMU|hurd/running/qemu]] you can directly [use GDB on the running -kernel](http://www.nongnu.org/qemu/qemu-doc.html#SEC48). +kernel](https://www.qemu.org/docs/master/system/gdb.html). + +When debugggin 32-bit gnumach, you can specify the kernel file in the +command line with the `-kernel` option and the boot modules with +`-initrd`, as described in [[hurd/running/qemu]]. This however does +not work for 64-bit gnumach, due to a [limitation in +qemu](https://gitlab.com/qemu-project/qemu/-/issues/243). To overcome +this, you can either patch qemu to enable multiboot also for 64-bit +ELF, or build a bootable ISO image with `grub-mkrescue`. + +To enable the gdbserver on a running instance, you need to access the +qemu monitor and use the `gdbserver` command. For example, with +libvirt/virt-manager + + $ virsh --connect qemu:///session qemu-monitor-command --domain hurd --hmp --cmd gdbserver + +Otherwise, if you start qemu manually, you can use the `-s` and `-S` +shortcuts, that will open a tcp connection on port 1234 and wait for +gdb to attach before starting the vm. + +If you don't need a graphical interface, e.g. you're working on the +boot process, you could use stdio as an emulated serial port with +`-nographic`, and append `console=com0` to the kernel command line, +either in grub or with the `-append` option. + +Once qemu has started, you can connect to the gdbserver with + + $ gdb gnumach + ... + (gdb) target remote :1234 + (gdb) c + +You can also automate some steps with a `.gdbinit` file in your +working directory. For example: + + set print pretty + target remote :1234 + # let's set some breakpoints + b Panic + b c_boot_entry + b user_bootstrap + b ../i386/intel/pmap.c:1981 + # we can also refer to virtual addresses in userspace + b *0x804901d + # this shows the instruction being executed + display/i $pc + layout asm ## [[open_issues/debugging_gnumach_startup_qemu_gdb]] +## Debug 64-bit gnumach + +[[build|microkernel/mach/gnumach/building/]] 64-bit gnumach with: + + $ export CFLAGS=-g + $ ../configure --enable-kdb ... + +run a spare Hurd vm (prepare for data loss in vm): + +* `kvm -net user,hostfwd=tcp:127.0.0.1:2222-:22 -net nic,model=e1000 -drive file=$(echo debian-hurd*.img),cache=writeback -m 1G` +* `cd gnumach/build` +* `scp -P 2222 gnumach.gz user@127.0.0.1:/home/user/` +* You may copy `gnumach.gz` (also create new grub entry) or replace using `mv /home/user/gnumach.gz /boot/gnumach-xxx.gz` +* Shutdown vm. +* Append `console=com0` in boot menu and switch to console mode in qemu. (We have known issues with vga output for 64-bit.) +* You may load only required modules for debugging. +* `kvm -s -S -net user,hostfwd=tcp:127.0.0.1:2222-:22 -net nic,model=e1000 -drive file=$(echo debian-hurd*.img),cache=writeback -m 1G` (note: `-s -S` added.) +* `gdb ./gnumach` +* `(gdb) target remote :1234` +* Press `c` to continue booting. + + +example `/boot/grub/grub.cfg`: + + multiboot /boot/gnumach-1.8-486.gz root=part:2:device:hd0 console=com0 + ... + echo 'Loading the Hurd ...' + module /hurd/ext2fs.static ext2fs --readonly \ + --multiboot-command-line='${kernel-command-line}' \ + \ + --host-priv-port='${host-port}' --device-master-port='${device-port}' \ + --exec-server-task='${exec-task}' -T typed '${root}' \ + '$(fs-task=task-create)' '$(task-resume)' + module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)' + + + # Code Inside the Kernel diff --git a/microkernel/mach/gnumach/hardware_compatibility_list.mdwn b/microkernel/mach/gnumach/hardware_compatibility_list.mdwn index 460c8aba..d7387d4c 100644 --- a/microkernel/mach/gnumach/hardware_compatibility_list.mdwn +++ b/microkernel/mach/gnumach/hardware_compatibility_list.mdwn @@ -17,7 +17,7 @@ GNU Mach current only supports the `x86` (alias `ia32` or `i386`) architecture. `amd64` systems seem to be troublesome more often than not. This is probably related to the same (chipset-related) problems we often see with recent machines; but it seems that `amd64` ones use problematic chipsets particularily -often. So far we haven't heard of similar problems with Intel's eqivalent +often. So far we haven't heard of similar problems with Intel's equivalent `ix64` (or `EM64T` as it used to be called) -- but maybe that just means fewer people tried running the Hurd on such machines :-) @@ -123,5 +123,5 @@ Some people couldn't get these hardware combinations to work with Hurd. The present Debian GNU/Hurd installer itself runs on Hurd, so failure on the installer may mean that the hardware is uncompatible with Hurd. * ASUS P5A motherboard and AMD K6-2 333MHz CPU - doesn't boot -* ASUS P2B-LS motherboard with an Intel PII-MMX 400 MHz CPU - this board had a defective onboard NIC (that could not be disable in BIOS) and working 3COM Etherlink III NIC in a PCI bus slot. This combination worked with GNU/Linux. The 3COM NIC is known to work with the Hurd. However, while gnumach/Hurd will boot on this system, it is confused by the defective onboard NIC and unable to use the 3COM NIC. Attempting to start networking generates a continous stream of eth0 and eth1 reset messages on the console that renders the system unusable. +* ASUS P2B-LS motherboard with an Intel PII-MMX 400 MHz CPU - this board had a defective onboard NIC (that could not be disable in BIOS) and working 3COM Etherlink III NIC in a PCI bus slot. This combination worked with GNU/Linux. The 3COM NIC is known to work with the Hurd. However, while gnumach/Hurd will boot on this system, it is confused by the defective onboard NIC and unable to use the 3COM NIC. Attempting to start networking generates a continuous stream of eth0 and eth1 reset messages on the console that renders the system unusable. * ASrock 775Twins-HDTV with a Pentium D 810 (533 MGz FSB/2600GHz core -- information no longer present on intel's site). Doesn't boot. diff --git a/microkernel/mach/gnumach/preemption.mdwn b/microkernel/mach/gnumach/preemption.mdwn index 520f7bc9..130bb58b 100644 --- a/microkernel/mach/gnumach/preemption.mdwn +++ b/microkernel/mach/gnumach/preemption.mdwn @@ -11,7 +11,7 @@ License|/fdl]]."]]"""]] [[!tag open_issue_gnumach]] -There currently is no kernel preemption in GNU Mach. +There currently is no kernel-land preemption in GNU Mach, only user-land preemption. If GNU Mach were made a a preemptive kernel, using [[continuation]]s would probably no longer make sense as the kernel itself, that is, kernel threads can diff --git a/microkernel/mach/mig/documentation.mdwn b/microkernel/mach/mig/documentation.mdwn index 07299d48..740949e0 100644 --- a/microkernel/mach/mig/documentation.mdwn +++ b/microkernel/mach/mig/documentation.mdwn @@ -57,7 +57,9 @@ November 1989. Department of Computer Science, Carnegie-Mellon University. See the citations about [Mach and matchmaker: kernel and language support for objectoriented distributed -systems](http://citeseer.ist.psu.edu/context/93073/0). "M. B. Jones and +systems](http://citeseer.ist.psu.edu/context/93073/0) +[(pdf)](https://kilthub.cmu.edu/ndownloader/files/12097610). +"M. B. Jones and R. F. Rashid, *Mach and matchmaker: kernel and language support for objectoriented distributed systems*, Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications, October 1986, diff --git a/microkernel/mach/mig/gnu_mig/building.mdwn b/microkernel/mach/mig/gnu_mig/building.mdwn index 486c461e..eed12e03 100644 --- a/microkernel/mach/mig/gnu_mig/building.mdwn +++ b/microkernel/mach/mig/gnu_mig/building.mdwn @@ -24,7 +24,7 @@ RCS](https://git.savannah.gnu.org/git/hurd/): ... or (if you are working on a Debian system) get the sources that are used for the [current Debian mig package](http://packages.debian.net/source/unstable/mig): - $ apt-get source mig + $ apt source mig The unpacked source tree is around 1 MiB, and the build tree also is around 1 MiB. @@ -35,8 +35,8 @@ The unpacked source tree is around 1 MiB, and the build tree also is around 1 Mi Building MIG requires the *build-essential* and *fakeroot* packages, and some additional dependencies specified by the mig source package: - # apt-get install build-essential fakeroot - # apt-get build-dep mig + # apt install build-essential fakeroot + # apt build-dep mig ### <a name="Building_and_Installing"> Building and Installing </a> <a name="_a_deb_file"> ... a _.deb_ file </a> @@ -48,6 +48,9 @@ Start the build process: $ dpkg-buildpackage -us -uc -b -rfakeroot +Note: if you are building on a non-32bit system, you need to also pass e.g. +`--target-arch=i386` to build the 32bit version. + This will create a _.deb_ package in the parent directory, which you can then install on your system. @@ -81,10 +84,10 @@ configure: $ GNU=~/gnu $ TARGET_CPPFLAGS=-I"$GNU"/include ../configure --prefix="$GNU" -If you are building on a 64 bit machine, you need to add a --host option: +If you want to build 32-bit gnumach on a 64-bit machine, you need to add a --target option. mig(com) will be build as ELF64 binary, but it will generate 32-bit stub code for gnumach: $ GNU=~/gnu - $ TARGET_CPPFLAGS=-I"$GNU"/include ../configure --prefix="$GNU" --host=i686-unknown-linux-gnu + $ TARGET_CPPFLAGS=-I"$GNU"/include ../configure --prefix="$GNU" --target=i686-gnu TARGET_CC=i686-linux-gnu-gcc Build and install the Mach Interface Generator into _$GNU_ (i.e. _~/gnu/_ in our example): diff --git a/microkernel/mach/mig/gnu_mig/discussion.mdwn b/microkernel/mach/mig/gnu_mig/discussion.mdwn new file mode 100644 index 00000000..720cf92c --- /dev/null +++ b/microkernel/mach/mig/gnu_mig/discussion.mdwn @@ -0,0 +1,9 @@ +[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable +id="license" text="Permission is granted to copy, distribute and/or modify this +document under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation; with no Invariant +Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license +is included in the section entitled [[GNU Free Documentation +License|/fdl]]."]]"""]] + +`MutoShack, March 23, 2019` - Is GNU MIG obsolete as of glibc 2.28? "Building and running on GNU/Hurd systems now works without out-of-tree patches". I don't currently have a build environment on this machine so I cannot check. diff --git a/microkernel/mach/thread.mdwn b/microkernel/mach/thread.mdwn index ccce643e..911b4493 100644 --- a/microkernel/mach/thread.mdwn +++ b/microkernel/mach/thread.mdwn @@ -32,6 +32,6 @@ Threads have scheduling parameters and maintain various statistics about themselves. On GNU/Hurd, APIs for Mach threads and thereabouts are provided by the -[[hurd/libthreads]] (cthreads), and [[libpthread]] (POSIX Threads) packages. +[[/libpthread]] (POSIX Threads) package. A task backing a thread is the basis for a [[UNIX process|unix/process]]. |