summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386/btx
Commit message (Collapse)AuthorAgeFilesLines
* MFC r264400,r265836:ngie2014-12-313-3/+3
| | | | | | | | | | | | | | r264400: NO_MAN= has been deprecated in favor of MAN= for some time, go ahead and finish the job. ncurses is now the only Makefile in the tree that uses it since it wasn't a simple mechanical change, and will be addressed in a future commit. r265836: Remove last two NO_MAN= in the tree. In both of these cases, MAN= is what is needed.
* MFC 256293:jhb2013-10-151-2/+5
| | | | | | | | | Sanitize the %eflags returned by BIOS routines. Some BIOS routines enter protected mode and may leave protected-mode-specific flags like PSL_NT set when they return to real mode. This can cause a fault when BTX re-enters protected mode after the BIOS mode returns. Approved by: re (gjb)
* When rebooting (exiting) from the BTX loader, make sure to restore thedim2013-04-241-1/+1
| | | | | | | | | | | GDT from the correct segment, otherwise a triple fault would be caused. In some virtual environments (VMware, VirtualBox, etc) this could lead to a unhandled error or hang in the guest emulation software. Thanks to avg and jhb for a few hints in the right direction. Noticed by: Jeremy Chadwick <jdc@koitsu.org> (and many others) MFC after: 1 week
* add detection of serial console presence to btx and boot2-like blocksavg2012-10-061-6/+11
| | | | | | | | Note that this commit slightly increases size of boot blocks. Reviewed by: jhb Tested by: Olivier Cochard-Labbe <olivier@cochard.me> MFC after: 26 days
* btxldr: future-proof argument passing from boot1/2-ish to loaderavg2012-05-096-14/+23
| | | | | | | | | | | | | | | Place the arguments at a fixed offset of 0x800 withing the argument area (of size 0x1000). Allow variable size extended arguments first of which should be a size of the extended arguments (including the size parameter). Consolidate all related definitions in a new i386/common/bootargs.h header. Many thanks to jhb and bde for their guidance and reviews. Reviewed by: jhb, bde Approved by: jhb MFC after: 1 month
* Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, todim2012-02-282-10/+8
| | | | | | | | | | | | | | | | | | | | | get rid of testing explicitly for clang (using ${CC:T:Mclang}) in individual Makefiles. Instead, use the following extra macros, for use with clang: - NO_WERROR.clang (disables -Werror) - NO_WCAST_ALIGN.clang (disables -Wcast-align) - NO_WFORMAT.clang (disables -Wformat and friends) - CLANG_NO_IAS (disables integrated assembler) - CLANG_OPT_SMALL (adds flags for extra small size optimizations) As a side effect, this enables setting CC/CXX/CPP in src.conf instead of make.conf! For clang, use the following: CC=clang CXX=clang++ CPP=clang-cpp MFC after: 2 weeks
* Consolidate duplicate definitions of V86_CY() and V86_ZR() which check forjhb2011-10-251-0/+4
| | | | | the carry and zero flags being set, respectively, in <btxv86.h> and use them throughout the x86 boot code.
* Upgrade our copy of llvm/clang to r126079, from upstream's trunk.dim2011-02-202-0/+10
| | | | | This contains many improvements, primarily better C++ support, an integrated assembler for x86 and support for -pg.
* Use -Wl,-N instead of the undocumented -N option for GCC.ed2010-06-032-2/+2
| | | | | | | GCC forwards the -N flag directly to ld. This flag is not documented and not supported by (for example) Clang. Just use -Wl,-N. Submitted by: Pawel Worach
* Fix some more issues with the real mode BTX.jhb2009-02-241-35/+60
| | | | | | | | | | | | | | | | | | | | | | | | | The old BTX passed the general purpose registers from the 32-bit client to the routines called via virtual 86 mode. The new BTX did the same thing. However, it turns out that some instructions behave differently in virtual 86 mode and real mode (even though this is under-documented). For example, the LEAVE instruction will cause an exception in real mode if any of the upper 16-bits of %ebp are non-zero after it executes. In virtual 8086 mode the upper 16-bits are simply ignored. This could cause faults in hardware interrupt handlers that inherited an %ebp larger than 0xffff from the 32-bit client (loader, boot2, etc.) while running in real mode. To fix, when executing hardware interrupt handlers provide an explicit clean state where all the general purpose and segment registers are zero upon entry to the interrupt handler. While here, I attempted to simplify the control flow in the 'intusr' code that sets up the various stack frames and exits protected mode to invoke the requested routine via real mode. A huge thanks to Tor Egge (tegge@) for debugging this issue. Submitted by: tegge Reviewed by: tegge Tested by: bz MFC after: 1 week
* Remove now unused label.sobomax2008-12-091-1/+1
| | | | | | Submitted by: Christoph Mallon MFC after: 4 weeks (along with r185779 and r185780)
* Optimiza assembly in the previous r185779, to save whooping 16 bytes.sobomax2008-12-081-9/+5
| | | | | | Submitted by: Christoph Mallon MFC after: 4 weeks (including r185779)
* Respect RBX_MUTE flag from boot[012].sobomax2008-12-081-1/+18
| | | | MFC after: 4 weeks
* Fix the hangs reported with the real mode BTX:jhb2008-08-081-11/+22
| | | | | | | | | | | | | - I had errantly assumed that all user requests should run with interrupts enabled. User requests for software interrupts, however, need to disable interrupts (and tracing) just like hardware interrupts. - Disable alignment checking when emulating a hardware interrupt as well (based on the description of the real mode operation of the 'INT' instruction in the IA-32 manuals). - Use constants for fields in %eflags. Tested by: bz MFC after: 3 days
* Change the BTX kernel to drop all the way out to real mode to invoke BIOSjhb2008-03-101-401/+316
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | routines (V86 requests from the client and hardware interrupt handlers): - Install trampoline real mode interrupt handlers at IDT vectors 0x20-0x2f to handle hardware interrupts by invoking the appropriate vector (0x8-0xf or 0x70-0x78). This allows the 8259As to use vectors 0x20-0x2f in real mode as well as protected mode will ensuring that the master 8259A doesn't share IDT space with CPU exceptions in protected mode. - Since we don't need to reserve space for page tables and a page directory anymore since dropping paging support, move the TSS and protected mode IDT up by 16k. Grow the ring 1 link stack by 16k as a result. - Repurpose the ring 1 link stack to be used as a real mode stack when invoking real mode routines either via a V86 request or a hardware interrupts. This simplifies a few things as we avoid disturbing the original user stack. - Add some more block comments to explain how the code interacts with the V86 structure as this wasn't immediately obvious from the prior comments (e.g. that we explicitly copy the seg regs for real mode out of the V86 struct onto the stack to be popped off when going into real mode, etc.). Also, document some of the stack frames we create going to real mode and back. - Remove all of the virtual 86 related code including having to simulate various instructions and BIOS calls on a trap from virtual 86 mode. - Explicitly panic if a user client attempts to perform a V86 CALL request that isn't a far call. - Bump version to 1.2. Assuming this works ok this should fix some of the long standing issues with USB booting as well as etherboot. MFC after: 2 weeks Submitted by: kib (some parts from his original real mode patch)
* Retire the support for using paging in BTX. It hasn't been used sincejhb2008-02-272-57/+2
| | | | | | before 4.0. Submitted by: kib
* Ignore any breakpoint instructions (int 3) we encounter in vm86 modejhb2006-12-061-0/+2
| | | | | | | | rather than treating them as a fatal exception and halting. At least one storage BIOS (some newer mpt(4) parts) have a breakpoint instruction in their disk read routine. MFC after: 3 days
* - Fix a couple of improper uses of leal in the previous space savingjhb2006-10-051-5/+7
| | | | | | | | | | | | | | | commits. For some reason I thought the scale factor was a shift count rather than the multiplicand (that is, I thought leal (%eax,%edx,4) was going to generate %eax + %edx << 4 rather than %eax + %edx * 4). What I need is to multiply by 16 to convert a real-mode (seg, offset) tuple into a flat address. However, the max multiplicand for scaled/index addressing on i386 is 8, so go back to using a shl and an add. - Convert two more inter-register mov instructions where we don't need to preserve the source register to xchg instructions to keep our space savings. Tested by: Ian FREISLICH if at hetzner.co.za MFC after: 1 week
* Tweak the code to handle intercepting BIOS calls to int 0x15 to shavejhb2006-09-281-17/+10
| | | | | | | | | | | | another 16 bytes off of BTX (and thus boot2): - Compare against the value of %eax that is saved on the stack instead of loading it into %eax (which requires saving the current %eax on the stack). - Use %ch to examine the keyboard flag state in the BIOS to see if Ctrl-Alt-Del is pressed instead of %al so we don't have to save %eax on the stack anymore. MFC after: 1 week
* Optimize the int 15/87 handler for space to shave another 16 bytes off ofjhb2006-09-281-31/+17
| | | | | | | | | | | | | | | | | BTX (and thus boot2): - Don't bother saving %eax, %ebx, or %ecx as it is not necessary. - Use a more compact sequence to load the base value out of a GDT entry by loading the contiguous low 24 bits into the upper 24 bits of %eax, loading the high 8 bits into %al, and using a ror to rotate the bits (2 mov's and a ror) rather than loading the pieces in smaller chunks (3 mov's and a shl). - Use movzwl + leal instead of movl + movw + shll + addl. - Use 'xchgl %eax,%foo' rather than 'movl %eax,%foo' for cases where it's ok to trash %eax. xchgl %eax, foo is a 1-byte opcode whereas the mov is a 2-byte opcode. - Use movzwl rather than xorl + movw. MFC after: 1 week
* A couple of simple tweaks that trim BTX by 6 bytes. Since BTX isjhb2006-09-281-3/+2
| | | | | 16-byte aligned within boot2 however, this actually trims boot2 by 16 bytes.
* Emulate moving cr0, cr2, cr3, or cr4 into any i386 general registerjhb2006-09-271-7/+19
| | | | | | | | rather than just emulating mov cr0, eax. This fixes some Compaq/HP BIOS with DMA (as the BIOS tried to read cr3 so it could translate addresses if paging was enabled). MFC after: 1 week
* Start the dreaded NOFOO -> NO_FOO conversion.ru2004-12-213-3/+3
| | | | OK'ed by: core
* Fix comments for serial I/O function prototypes that were broken in thejhb2004-11-241-5/+10
| | | | | | | | assembler to cpp(1) comment conversions. This allows btx to compile again when BTX_SERIAL is defined. Reported by: Danny Braniss danny at cs dot huji dot ac dot il MFC after: 1 month
* Move boot2 BSS zeroing into btx startup code out of boot1. boot1 does notkan2004-08-051-1/+9
| | | | | | | have clear idea on boot2 BSS size and leaves portion of it not zeroed out. btxcsu.s is in much better position for this job. Obtained from: DragonflyBSD (with minor adjustments)
* Back out last revision that unnecessarily changed valid assemblerru2004-05-142-1182/+1181
| | | | | | line comments and damaged the CVS history. Prompted by: bde, jhb
* After talking to Bruce Evans and reading more standards specs,ru2004-04-282-1181/+1182
| | | | | | | | | switch to using C99-style comments everywhere in preprocessed assembler. The reason is that lines starting with the regexp '^[[:space:]]#' are treated as preprocessing directives, and while it seems to work now with GCC, it's not necessarily has to work. Use C99 comments `//' for the trailing comments to save whitespace.
* Use C (and CPP) style comments for assembler-with-cpp sources,ru2004-04-282-290/+290
| | | | for lines that start with a comment.
* Removed now redundant CLEANFILES assignments.ru2004-04-272-2/+0
| | | | Not read enough of my patch by: obrien ;)
* Use a more compact syntax for passing the "binary" options to 'ld'.obrien2004-04-252-2/+2
|
* Simplify the building of our i386 'binary' boot components by directlyobrien2004-04-252-14/+4
| | | | | | producing them using 'ld' options rather than post-processing with 'objcopy'. Idea by: Ryan Sommers <ryans@gamersimpact.com>
* Get rid of unnecessary use of m4(1) by using cpp(1) instead.ru2004-02-116-1626/+46
| | | | | | | | (John tells me there were problems when trying this before, but it appears to be safe these day.) OK'ed by: jhb Repocopied by: joe
* - Factor out -nostdlib to an upper level Makefile.inc.ru2004-02-093-15/+23
| | | | | | | | | | | - Now that bsd.prog.mk deals with programs linked with -nostdlib better, and has a notion of an "internal" program, use PROG where possible. This has a good impact on the contents of .depend files and causes programs to be linked with cc(1). XXX: boot2 couldn't be converted as it's actually two programs. Tested on: i386, amd64
* First round of cleanups to sys/boot/ makefiles:ru2004-02-061-1/+2
| | | | | | | | | | | | - do not use PROG for what's not a real C program, - use sys.mk transformation rules where possible, - only create the "machine" symlink on AMD64, - removed MAINTAINER lines in individual makefiles, - added the LIBSTAND defitinion to <bsd.libnames.mk>, - somewhat better contents in .depend files. Tested on: i386, amd64 Prodded by: bde
* When rebooting the machine jump to 0xf000:0xfff0 instead of 0xffff:0x0.phk2003-11-162-2/+2
| | | | | | | | | | While we end up the same place, we end up with two different CS register values after the jump and 0xf000 is compatible with the hardware reset value. This makes a difference if the BIOS does a near jump before a far jump. Detective work and patch by: Adrian Steinmann <ast@marabu.ch>
* Fix an incorrect quote character in an M4 test conditon. Basically, onejhb2003-11-062-2/+2
| | | | | of the verbose print statements that BTXLDR_VERBOSE enables wasn't properly enabled.
* Switch to using bsd.prog.mk; this gives us back the standardru2003-06-301-5/+2
| | | | .s.o transformation rule.
* Build on amd64. Yes, I know this isn't particularly nice.peter2003-06-262-1/+2
|
* Revert MEM_USR back to 0xa000 for BTX clients. Instead, adjust boot2jhb2002-10-084-4/+4
| | | | | | | to run at 0xc000 by changing its virtual start address from 0x1000 to 0x2000. Tested by: phk
* Correctly adjust for moved start address.phk2002-10-072-2/+2
| | | | | | | | It seems that the existence of a "depend" target in src/sys/boot is not to be taken as an indication that it actually does what one would expect, at least it clearly threw my testing off. Apologies to: jhb
* Move MEM_USR a page upwards to make space for larger UFS1 boot2.phk2002-10-072-2/+2
| | | | | | | Load 4 sectors more than we used to. This is harmless overhead for the UFS1_ONLY case, but sufficient for boot2(UFS1+2). Sponsored by: DARPA & NAI Labs
* Initiate deorbit burn for the i386-only a.out related support. Moves arepeter2002-09-173-12/+0
| | | | | | | | | | | | | | | under way to move the remnants of the a.out toolchain to ports. As the comment in src/Makefile said, this stuff is deprecated and one should not expect this to remain beyond 4.0-REL. It has already lasted WAY beyond that. Notable exceptions: gcc - I have not touched the a.out generation stuff there. ldd/ldconfig - still have some code to interface with a.out rtld. old as/ld/etc - I have not removed these yet, pending their move to ports. some includes - necessary for ldd/ldconfig for now. Tested on: i386 (extensively), alpha
* Fixed CLEANFILES after bsd.lib.mk sweep.ru2002-05-131-1/+1
|
* Major cleanup of bsd.lib.mk.ru2002-05-131-4/+0
| | | | | | | Get rid of the INTERNALSTATICLIB knob and just use plain INTERNALLIB. INTERNALLIB now means to build static library only and don't install anything. Added a NOINSTALLLIB knob for libpam/modules. To not build any library at all, just do not set LIB.
* Back out last commit. I expect our bsd.*.mk gods to remove the need forobrien2002-05-121-0/+3
| | | | | defining so many extra things in addition to INTERNALLIB. We don't like repetitive C code and we shouldn't for make code either.
* NOPIC, NOPROFILE, NOMAN, and INTERNALSTATICLIB are redundant when usingobrien2002-05-111-3/+0
| | | | INTERNALLIB now.
* Whoops, missed these bits in the previous commit.jhb2001-11-032-2/+4
|
* Add support for sending messages to the serial console which is helpfuljhb2001-11-033-0/+163
| | | | | | when debugging boot problems. It is not on by default but is enabled via the BTX_SERIAL variable. The port and speed can be set via the same variables used by boot2 and the loader.
* Add support for outputting multiple lines when dumping memory during thejhb2001-11-032-4/+26
| | | | | register dump. Change the default to bump 2 lines of output (32 bytes) instead of 1 line (16 byte).
* Add support for trace traps by returning from them just as for breakpointjhb2001-11-032-2/+10
| | | | | traps rather than halting. Ideally, we should avoid printing the 'BTX halted' message for debug register dumps.
OpenPOWER on IntegriCloud