Commit Graph

74 Commits

Author SHA1 Message Date
Ruslan Ermilov
e653b48c80 Start the dreaded NOFOO -> NO_FOO conversion.
OK'ed by:	core
2004-12-21 08:47:35 +00:00
John Baldwin
8b8d44db27 Fix comments for serial I/O function prototypes that were broken in the
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
2004-11-24 14:54:33 +00:00
Alexander Kabaev
2939c8a0b9 Move boot2 BSS zeroing into btx startup code out of boot1. boot1 does not
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)
2004-08-05 06:00:05 +00:00
Ruslan Ermilov
237266b2e6 Back out last revision that unnecessarily changed valid assembler
line comments and damaged the CVS history.

Prompted by:	bde, jhb
2004-05-14 20:29:30 +00:00
Ruslan Ermilov
edfa817773 After talking to Bruce Evans and reading more standards specs,
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.
2004-04-28 14:31:44 +00:00
Ruslan Ermilov
d1974eb1c5 Use C (and CPP) style comments for assembler-with-cpp sources,
for lines that start with a comment.
2004-04-28 10:09:21 +00:00
Ruslan Ermilov
c9be1bb2f8 Removed now redundant CLEANFILES assignments.
Not read enough of my patch by:	obrien ;)
2004-04-27 19:45:16 +00:00
David E. O'Brien
a606451bd2 Use a more compact syntax for passing the "binary" options to 'ld'. 2004-04-25 20:36:44 +00:00
David E. O'Brien
a50d1c0876 Simplify the building of our i386 'binary' boot components by directly
producing them using 'ld' options rather than post-processing with 'objcopy'.

Idea by:	Ryan Sommers <ryans@gamersimpact.com>
2004-04-25 19:50:20 +00:00
Ruslan Ermilov
846a4356ea Get rid of unnecessary use of m4(1) by using cpp(1) instead.
(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
2004-02-11 08:42:38 +00:00
Ruslan Ermilov
bcd106e18b - Factor out -nostdlib to an upper level Makefile.inc.
- 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
2004-02-09 14:11:58 +00:00
Ruslan Ermilov
a4a62f5d1f First round of cleanups to sys/boot/ makefiles:
- 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
2004-02-06 21:58:32 +00:00
Poul-Henning Kamp
5c391f4d6b When rebooting the machine jump to 0xf000:0xfff0 instead of 0xffff:0x0.
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>
2003-11-16 18:24:23 +00:00
John Baldwin
7af6cc7dee Fix an incorrect quote character in an M4 test conditon. Basically, one
of the verbose print statements that BTXLDR_VERBOSE enables wasn't properly
enabled.
2003-11-06 21:33:17 +00:00
Ruslan Ermilov
6c874d4fa8 Switch to using bsd.prog.mk; this gives us back the standard
.s.o transformation rule.
2003-06-30 14:10:58 +00:00
Peter Wemm
062b3e0c77 Build on amd64. Yes, I know this isn't particularly nice. 2003-06-26 03:51:57 +00:00
John Baldwin
66648a06a0 Revert MEM_USR back to 0xa000 for BTX clients. Instead, adjust boot2
to run at 0xc000 by changing its virtual start address from 0x1000 to
0x2000.

Tested by:	phk
2002-10-08 18:19:02 +00:00
Poul-Henning Kamp
10aabd9039 Correctly adjust for moved start address.
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
2002-10-07 19:12:36 +00:00
Poul-Henning Kamp
e74334caae Move MEM_USR a page upwards to make space for larger UFS1 boot2.
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
2002-10-07 12:15:11 +00:00
Peter Wemm
66422f5b7a Initiate deorbit burn for the i386-only a.out related support. Moves are
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
2002-09-17 01:49:00 +00:00
Ruslan Ermilov
26aace39ab Fixed CLEANFILES after bsd.lib.mk sweep. 2002-05-13 15:48:05 +00:00
Ruslan Ermilov
2a53f3fb35 Major cleanup of bsd.lib.mk.
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.
2002-05-13 10:53:24 +00:00
David E. O'Brien
95cfc25d0d Back out last commit. I expect our bsd.*.mk gods to remove the need for
defining so many extra things in addition to INTERNALLIB.  We don't like
repetitive C code and we shouldn't for make code either.
2002-05-12 13:54:42 +00:00
David E. O'Brien
3bf8b9cee3 NOPIC, NOPROFILE, NOMAN, and INTERNALSTATICLIB are redundant when using
INTERNALLIB now.
2002-05-11 18:02:33 +00:00
John Baldwin
dfd89d691e Whoops, missed these bits in the previous commit. 2001-11-03 22:21:21 +00:00
John Baldwin
580d63df68 Add support for sending messages to the serial console which is helpful
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.
2001-11-03 22:09:30 +00:00
John Baldwin
0535c2bbad Add support for outputting multiple lines when dumping memory during the
register dump.  Change the default to bump 2 lines of output (32 bytes)
instead of 1 line (16 byte).
2001-11-03 21:53:46 +00:00
John Baldwin
5eef06c222 Add support for trace traps by returning from them just as for breakpoint
traps rather than halting.  Ideally, we should avoid printing the
'BTX halted' message for debug register dumps.
2001-11-03 21:42:25 +00:00
John Baldwin
25895accd8 Output a newline at the end of a dump so that there are blank lines between
dumps when using breakpoints or tracing.
2001-11-03 21:40:47 +00:00
Robert Nordier
816aa3c0b5 Unset MAINTAINER. 2001-07-21 14:32:47 +00:00
Robert Nordier
9dfe98e24e Fix reboot buglet when BOOT_BTX_NOHANG is defined.
Submitted by: Umesh Krishnaswamy <umesh@juniper.net>
2001-05-27 20:15:10 +00:00
John Baldwin
b833d157c7 Always disable paging when exiting back to real mode after receiving a
fatal trap.  Also, reload the GDT register to point to BTX's GDT before
playing around with the segment registers to return to real mode.  This is
helpful if the kernel causes a fatal exception before it has setup its own
IDT and fault handlers.  For example, if one happens to break mtx_init().
Without these changes BTX would recursively page fault (if paging was not
disabled) or triple fault and reset the CPU (without the GDT reload)
instead of providing a potentially useful register dump.

Reviewed by:	rnordier
2001-03-21 20:08:07 +00:00
Robert Nordier
ce6a6a0f90 Set MAINTAINER. 2000-10-02 17:23:16 +00:00
John Baldwin
6bd9abd49a Add a new compile-time tweak to BTX. If you set the make(1) variable
BOOT_BTX_NOHANG, then BTX will be compiled with the appropriate flags so
that it reboots after a fault instead of hanging forever.

Requested by:	ps
Approved by:	rnordier
2000-08-24 20:57:44 +00:00
John Baldwin
bd61ce880f Emulate the WBINVD instruction when it is called by the BIOS. 2000-07-06 00:13:21 +00:00
John Baldwin
0b74850760 Change the fault message to say 'BTX halted' isntead of 'System halted' to
avoid confusion.

Submitted by:	George Scott <George.Scott@its.monash.edu.au>
2000-06-29 08:24:50 +00:00
John Baldwin
52f5035190 Rework the detecting of the rdmsr and wrmsr instructions in the v86
monitor so that the codepath is cleaner and easier to maintain in the
future.
2000-06-29 01:25:31 +00:00
John Baldwin
1ddb0ab555 Add support for emulating the RDMSR and WRMSR instructions into BTX. In
theory, this should allow the K7V Athlon motherboard to boot ok with boot
virus protection enabled.  However, I have no hardware to test this.  It
shouldn't break anything though. :)

Prodded by:	Kelly Yancey <kbyanc@posi.net>
2000-06-17 06:45:40 +00:00
John Baldwin
e1efa49a84 Convert the short stub of real-mode code into 16-bit assembly. 2000-05-24 02:20:34 +00:00
John Baldwin
638bac9fc0 Clean up all of the 16-bit assembly code in the x86 bootstrap to work
with the new binutils.  Now that we have a decent assembler, all the old
m4 macros are no longer needed.  Instead, straight assembly can be used
since as(1) now understands 16-bit addressing, branches, etc.  Also,
several bugs have been fixed in as(1), allowing boot0.s to be further
cleaned up.
2000-05-23 12:18:49 +00:00
John Baldwin
36273c5d79 Don't disable interrupts when calling a vm86 mode interrupt or routine
from user mode.  Don't disable interrupts when returning from vm86 mode
to user mode either.  Now, we only disable interrupts before calling a
hardware interrupt handler, which is the only time we _should_ be
disabling interrupts.

Because of this, err, feature, any routine that one called in vm86 mode
had to re-enable interrupts by setting the interrupt flag or interrupts
would remain disabled even after the routine returned.  For example, I
have a simple debugging routine that uses a vm86 mode function to dump
any arbitrary memory word that I use to read the BIOS timer or any other
memory location.  This function does 1 load instruction from memory and
then returns.  Since it didn't re-enable interrupts, the first time I
called it to read the BIOS timer, it disabled interrupts.   This also
affected the PXE bootstrap as it needs interrupts enabled while it is
processing.  This patch fixes both of those situations so that those
functions do not worry about having to enable interrupts.  Hardware
interrupt handlers worked fine with the old code because they always
enable interrupts as part of their routine.

If you have any problems with the loader after this commit, please
let me know.  I'd like to MFC it in a week or two since PXE support
needs it.

Noticed by:	ps, Michael Johnston <michael.johnston@intel.com>
2000-04-26 04:35:25 +00:00
John Baldwin
48a0c4ea04 Mega i386 loader commit.
- Don't hard code 0x10000 as the entry point for the loader.  Instead add
  src/sys/boot/i386/Makefile.inc which defines a make variable with the
  entry point for the loader.  Move the loader's entry point up to
  0x20000, which makes PXE happy.
- Don't try to use cpp to parse btxldr for the optional BTXLDR_VERBOSE,
  instead use m4 to achieve this.  Also, add a BTXLDR_VERBOSE knob in the
  btxldr Makefile to turn this option on.
- Redo parts of cdldr's Makefile so that it now builds and installs cdboot
  instead of having i386/loader/Makefile do that.  Also, add in some more
  variables to make the pxeldr Makefile almost identical and thus to ease
  maintainability.
- Teach cdldr about the a.out format.  Cdldr now parsers the a.out header
  of the loader binary and relocates it based on that.  The entry point of
  the loader no longer has to be hardcoded into cdldr.  Also, the boot
  info table from mkisofs is no longer required to get a useful cdboot.
- Update the lsdev function for BIOS disks to parse other file systems
  (such as DOS FAT) that we currently support.  This is still buggy as
  it assumes that a floppy with a DOS boot sector actually has a MBR and
  parses it as such.  I'll be fixing this in the future.
- The biggie:  Add in support for booting off of PXE-enabled network
  adapters.  Currently, we use the TFTP API provided by the PXE BIOS.
  Eventually we will switch to using the low-level NIC driver thus
  allowing both TFTP and NFS to be used, but for now it's just TFTP.

Submitted by:	ps, alfred
Testing by:	Benno Rice <benno@netizen.com.au>
2000-03-28 01:19:53 +00:00
John Baldwin
536fcb08bf This patch to BTX fixes several small things:
1) Fix a bug in the int15 function 87 emulation where we only copied half
   of what the BIOS asked for.  This caused the Mylex RAID adapter to go
   haywire and start trashing memory when you tried to boot from it.
2) Don't use interrupt 19 to reboot.  Instead, set the reboot flag to a warm
   boot and jump to the BIOS's reboot handler.  int 19 doesn't clear memory
   or restore the interrupt vector table, and thus really isn't safe.  For
   example, when booting off of PXE, the PXE BIOS eats up a chunk of memory
   for its internal data and structures.  Since we rebooted via int 19,
   using the 'reboot' command in the loader resulted in that memory not
   being reclaimed by the BIOS.  Thus, after a few PXE boots, the system
   was out of lower memory.
3) Catch any int 19 calls made by a BTX client or a user pressing
   Ctrl-Alt-Delete and shutdown BTX and reboot the machine cleanly.  This
   fixes Ctrl-Alt-Delete in the loader and in boot2 instead of presenting
   the user with a BTX fault.

Approved by:	jkh
Found by:	1) by msmith
2000-02-16 07:00:16 +00:00
John Baldwin
c8bb85f758 Add the new cdldr CD bootstrap loader. This patch includes the following:
- Fix btxldr to preserve a NULL bootinfo pointer when it copies the kernel
  arguments.
- Add the cdldr bootstrap program.  This program is tacked onto the
  beginning of the standard 3rd stage boot loader (/boot/loader) to form
  the CD boot loader (/boot/cdboot).  When a CD is booted, the cdboot file
  is copied into memory instead and executed.  The cdldr stub emulates the
  environment normally provided by boot2 and then starts the loader.  This
  booting method does not emulate a floppy drive, but boots directly off of
  the CD.  This should fix the problems some BIOS's have with emulating a
  2.88 MB floppy image.
- Add support to the loader to recognize that it has been booted by cdldr
  instead of boot2 and use a simpler method of extracting the BIOS boot
  device.
2000-01-27 21:21:01 +00:00
John Baldwin
c299f41fd9 Fix brokenness introduced with the PAGING conditional variable. The value
of %cr0 wasn't reloaded into %eax before being modified to turn protected
mode off if PAGING was not defined.  The result was that the processor did
not exit protected mode, so when it tried to jump to segment 0x0 in the
next instruction to clear the prefetch cache like one should when leaving
protected mode, it actually tried to jump to a null selector, causing a
GPF.
2000-01-27 21:06:13 +00:00
John Baldwin
260c5d350e If PAGING is defined then actually turn it on when entering protected
mode.
1999-10-27 02:22:52 +00:00
John Baldwin
228ace6ebf aThis patch updates the BTX to emulate the BIOS function "Copy Extended
Memory" called as function 0x87 of interrupt 0x15.  Since the Mylex RAID
adapter's BIOS used this function to access memory (actually PCI bus
space) beyond 16 MB, this patch also allows BTX to address all 4 Gig of
possible address space on i386+.  Since the loader does not have room for
4 MB of page tables, this was done by turning off paging.

Paging was turned off via a compile time setting which defaults to off.
To enable paging, simply define the make variable PAGING.

rnordier might want to clean this up later.

Submitted by:	W. Gerald Hicks <wghicks@bellsouth.net>,
		Bosko Milekic <bmilekic@ares.dsuper.net>
Reviewed by:	msmith
Required by:	Mylex RAID adapter's BIOS
1999-10-12 21:33:49 +00:00
Brian Somers
ad128796fd Blank out the twiddly thing when outputting the ``BTX loader'' message. 1999-10-12 06:57:26 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Robert Nordier
e2c9098e4f Drop some non-existent commented-out targets. 1999-05-18 22:10:05 +00:00