Andres Salomon wrote:The x86 architecture doesn't make this problem easy. The conventional solution is to have the BIOS operate in real mode. When the kernel calls into the BIOS, it has to do a grotesque dance that involves jumping through a chain of several segments of different flavors, thus gradually shutting down the multi-tiered address translation mechanism. Then, if the BIOS is actually operating in protected mode (which is necessary if it is larger than 64K, as all modern BIOSes are), it has to perform the inverse process, do the requested work, then go back into real mode to return to the kernel. The net result is that a "call" into the BIOS involves: a) Copying the arguments to a real-mode register shadow array b) Saving all the registers - general ones and a few special ones too c) Far call to a linear-mapped code segment with an execution address in the first 1M of memory d) Switching to a different stack e) Turning off page translation f) Switching from protected mode to real mode (or in some cases, V86 mode instead, which requires an additional Task State Segment dance to set the IO permission mask) g) Switching to a real-mode interrupt descriptor table h) Executing an INT instruction I) Performing the inverse of a - g inside the BIOS j) Doing the requested work K) Performing a - g again to get back into real mode l) Executing an "iret" instruction M) Performing the inverse of a-g to return to normal operation The machinery that you need to do all that is predictably complex - extra segment descriptors that are set up just-so, several little code fragments that must be at special addresses in the first meg, additional stacks, a real-mode interrupt table at a fixed address, and several data save arrays. That machinery has to be in assembly language, spanning several different instruction set modes. Compared to that, I think that sharing one or two page directory entries at the very top of the virtual address space is pretty clean and simple. With that sharing, the BIOS call is just an ordinary subroutine call. (The setup code copies the entire page directory, but only a couple of entries are actually needed. The reason for copying the whole thing is because it is rather more work to determine the exact number of entries necessary, compared to copying everything and then letting Linux replace the ones it uses.) Every other solution that I know of requires some sort of heroic dance, either from the OS or from the BIOS or (usually) both. --
| Ryan Hope | reiser4 for 2.6.27-rc1 |
| Paul Menage | Re: [RFC][PATCH 6/7] Account for the number of tasks within container |
| Glauber de Oliveira Costa | [PATCH 1/19] unify desc_struct |
| David Woodhouse | Re: OT: character encodings (was: Linux 2.6.20-rc4) |
git: | |
| Eric Wong | Re: [RFC] Git config file reader in Perl (WIP) |
| Junio C Hamano | [PATCH/POLL] git-format-patch: the default suffix is now .patch, not .txt |
| Martin Langhoff | Re: pack operation is thrashing my server |
| Franck Bui-Huu | Re: [PATCH 1/2] Add git-archive |
| Chris Bullock | OpenBSD isakmpd and pf vs Cisco PIX or ASA |
| Richard Stallman | Real men don't attack straw men |
| Axton | Re: rouge IPs / user |
| Hannah Schroeter | Re: Improving disk reliability |
| Andi Kleen | [PATCH RFC] [4/9] modpost: Fix format string warnings |
| Jeff Garzik | Re: [regression] e1000e broke e1000 |
| Linus Torvalds | Re: [GIT]: Networking |
| Pekka Enberg | Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment |
