add ADLO to v2
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2457 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
5ed51d1933
commit
c1c3fdc79f
|
@ -0,0 +1,9 @@
|
|||
Most of the analysis, design and implementation of the project was done by
|
||||
me, Adam Sulmicki. I have received invaluable help from Adam Agnew. Bill
|
||||
Arbaugh was the person who made it all possible.
|
||||
|
||||
I also received help from Christophe Bothamy, Bochs' developer, on all
|
||||
Boch's bios related issues. Thanks!
|
||||
|
||||
I also got tips from Eric W. Biederman, as well as other members of the
|
||||
LinuxBIOS mailing list.
|
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,16 @@
|
|||
DEVELOPER/HACKING/DESIGN
|
||||
|
||||
- bochs bios.
|
||||
|
||||
we expect most of the bochs patches will be rolled back into
|
||||
the bochs mainline.
|
||||
|
||||
thus when designing an patch for rombios.c both needs of
|
||||
linuxbios as well as bochs needed to be taken into
|
||||
consideration.
|
||||
|
||||
- there are motherboard specific code in loader.s. until this issue
|
||||
is fixed, you need to adjust various motherboard specific
|
||||
settings in loader.s In particular control of the
|
||||
shadow ram.
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
1) Are you familar with LinuxBIOS?
|
||||
|
||||
no : abort
|
||||
yes: go to next step.
|
||||
|
||||
2) do you have Matsonic 7308e motherboard?
|
||||
|
||||
no : you are on your own (untested).
|
||||
yes: go to next step.
|
||||
|
||||
3) do you have LiuxBIOS running on Matsonic 7308e motherboard?
|
||||
|
||||
no : get it working first on your motherboard.
|
||||
yes: go to next step.
|
||||
|
||||
4) Acquire copy of your VIDEO BIOS.
|
||||
|
||||
-Put in your PC BIOS into the system,
|
||||
-Boot into linux.
|
||||
-as root run "make videobios" from ADLO's root dir.
|
||||
-copy the file to video directory
|
||||
adjust make file as needed.
|
||||
|
||||
5) Acquire copy of your PIRQ table.
|
||||
|
||||
At present time it is not necessary to do this
|
||||
and you can use supplied PIRQ table.
|
||||
|
||||
6) Acquire copy of BOCHS bios.
|
||||
|
||||
At present time it is not necessary to do this
|
||||
and you can use supplied rombios.c.
|
||||
|
||||
In fact you should use supplied rombios.c
|
||||
file as the one used with BOCHS is not
|
||||
complete at the present time.
|
||||
|
||||
7) Examine make file to see that it does what u want.
|
||||
|
||||
8) compile
|
||||
|
||||
make
|
||||
|
||||
9) use the resulting elf "payload" file with LinuxBIOS as you would
|
||||
have used any other elf file. For example put it on the same
|
||||
EERPOM as LinuxBIOS is, or use EtherBOOT to load the payload
|
||||
file from hdd or network.
|
|
@ -0,0 +1,110 @@
|
|||
#-------------------------------------------------
|
||||
# $Id: Makefile,v 1.2 2003/05/22 12:52:38 aip Exp $
|
||||
#-------------------------------------------------
|
||||
|
||||
ELF064=elf/elf-header-065kb.payload
|
||||
ELF113=elf/elf-header-113kb.payload
|
||||
ELF129=elf/elf-header-129kb.payload
|
||||
|
||||
LOADER=loader.o
|
||||
|
||||
BOCHS_R=bochs
|
||||
BOCHS_B=bochs/bios
|
||||
BOCHS_C=bochs/bochs-cvs
|
||||
BOCHS_X=bochs/bochs-cvs/bochs/bios
|
||||
|
||||
BIOS_R=${BOCHS_R}/rombios.bin
|
||||
BIOS_B=${BOCHS_B}/rombios.bin
|
||||
BIOS_X=${BOCHS_X}/rombios.bin
|
||||
|
||||
PAYLOAD=payload
|
||||
|
||||
BOCHSCVS=-d:pserver:anonymous@cvs.bochs.sourceforge.net:/cvsroot/bochs
|
||||
|
||||
#-------------------------------------------------
|
||||
|
||||
all: clean build #install
|
||||
|
||||
#-------------------------------------------------
|
||||
|
||||
epia: loader.o bios
|
||||
cat ${ELF064} ${LOADER} ${BIOS_B} > ${PAYLOAD}
|
||||
build: loader.o bios
|
||||
cat ${ELF064} ${LOADER} ${BIOS_B} > ${PAYLOAD}
|
||||
|
||||
#-------------------------------------------------
|
||||
|
||||
loader.o: loader.s
|
||||
as86 loader.s -b ${LOADER}
|
||||
|
||||
#-------------------------------------------------
|
||||
|
||||
bios:
|
||||
( cd ${BOCHS_B} ; make )
|
||||
sync
|
||||
|
||||
#-------------------------------------------------
|
||||
|
||||
#64kb -- sive of Video BIOS
|
||||
#
|
||||
#C=`echo 64*1024 | bc`
|
||||
C=65536
|
||||
|
||||
#0xC0000 -- start of Video BIOS in ram.
|
||||
#S=`echo -e "ibase=16 \n C0000" | bc`
|
||||
#
|
||||
# ELF header offset -- 0x1000 == 4096
|
||||
#
|
||||
# 786432+4096 = 790528
|
||||
S=790528
|
||||
|
||||
videobios:
|
||||
dd if=/proc/kcore of=./video.bios.bin bs=1 count=${C} skip=${S}
|
||||
|
||||
# 0xF000+0x1000
|
||||
S2=987136
|
||||
|
||||
pcbios:
|
||||
dd if=/proc/kcore of=./pc.bios.bin bs=1 count=${C} skip=${S2}
|
||||
|
||||
pirq: pcbios
|
||||
#grep -a "\$PIR" -B0 -A127 pc.bios.bin > pirq.bin
|
||||
grep -a "\$PIR" -B0 -A0 pc.bios.bin > pirq.bin
|
||||
|
||||
#now you have to hand edit the pirq.bin file
|
||||
|
||||
#-------------------------------------------------
|
||||
|
||||
bochslogin:
|
||||
mkdir -p ${BOCHS_C}
|
||||
echo "When prompted for a password, simply press the Enter key."
|
||||
( cd ${BOCHS_C} ; cvs ${BOCHSCVS} login )
|
||||
|
||||
bochsco:
|
||||
mkdir -p ${BOCHS_C}
|
||||
( cd ${BOCHS_C} ; cvs ${BOCHSCVS} co bochs/bios )
|
||||
|
||||
bochsstat:
|
||||
( cd ${BOCHS_C} ; cvs ${BOCHSCVS} status bochs/bios/rombios.c )
|
||||
|
||||
bochsupdate:
|
||||
( cd ${BOCHS_C} ; cvs ${BOCHSCVS} update bochs/bios/rombios.c )
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
|
||||
install:
|
||||
cp -abf ${PAYLOAD} /tftpboot/kernel
|
||||
sync
|
||||
|
||||
#-------------------------------------------------
|
||||
|
||||
clean:
|
||||
rm -rf *.o ${PAYLOAD}
|
||||
(cd ${BOCHS_B} ; make clean )
|
||||
|
||||
distclean: clean
|
||||
rm -rf ${BOCHS_C}
|
||||
|
||||
#-------------------------------------------------
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
initial release
|
||||
|
||||
boots LILO
|
||||
|
||||
"linux_alpha" release
|
||||
|
||||
fixed keyboard in lilo
|
||||
|
||||
boots linux
|
||||
(must use "linux mem=100mb ro init=/bin/sh ")
|
||||
|
||||
"win2k" release
|
||||
|
||||
lilo works
|
||||
no restrictions
|
||||
grub works
|
||||
no restrictions
|
||||
linux works
|
||||
no restrictions
|
||||
openbsd works
|
||||
no restrictions
|
||||
win2k
|
||||
no restrictions
|
||||
|
||||
freebsd
|
||||
hangs at /sbin/init
|
||||
win98
|
||||
sometimes boots up to desktop
|
||||
winXP
|
||||
finish text mode bar,
|
||||
switch to gfx mode
|
||||
stop 7b
|
||||
|
||||
"public" release
|
||||
|
||||
just bit of cleanups, other than that same as
|
||||
"win2k" release.
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
==========================================
|
||||
$Id: README,v 1.1 2002/11/25 02:07:53 rminnich Exp $
|
||||
==========================================
|
||||
|
||||
ADLO
|
||||
|
||||
A project to combine LinuxBIOS and BOCHS BIOS to add support
|
||||
for booting legacy applications, such as Microsoft Windows.
|
||||
|
||||
==========================================
|
||||
|
||||
Boot Overvew:
|
||||
|
||||
ADLO requires an boot loader with ELF support.
|
||||
In our case it is either LinuxBIOS or EtherBOOT.
|
||||
|
||||
Sample execution paths:
|
||||
|
||||
LinuxBIOS -> ADLO -> LILO -> LINUX
|
||||
|
||||
LinuxBIOS -> EtherBOOT -> ADLO -> LILO -> LINUX
|
||||
|
||||
Then it can start any real mode application.
|
||||
In our case it could be LILO or GRUB, but
|
||||
choices are not limited to this.
|
||||
|
||||
==========================================
|
||||
|
||||
ADLO overview:
|
||||
|
||||
-Elf header
|
||||
-mainteance routines
|
||||
-bochs bios
|
||||
-vga bios
|
||||
|
||||
------------------------------------------
|
||||
|
||||
Elf header
|
||||
|
||||
hand crafted binary. Currently there are 3 diff binaries
|
||||
for three different sizes of payload (65kb,113kb,129kb).
|
||||
|
||||
they are catted at beginning of file
|
||||
|
||||
------------------------------------------
|
||||
|
||||
mainteance routines
|
||||
|
||||
this is the loader.s file which gets compiled into loader.o binary
|
||||
|
||||
it is catted 2nd right after elf header and it is where
|
||||
control is being transfered when the elf is executed.
|
||||
|
||||
it consist of :
|
||||
-tuneups:
|
||||
select device to boot
|
||||
set memory for Int15/EAX=E820
|
||||
enable LBA
|
||||
copy LinuxBIOS table [TODO]
|
||||
-shadow :
|
||||
enable/write/read
|
||||
-copy:
|
||||
bochs @ 0xF00000
|
||||
video bios (binary only) @ 0xC00000
|
||||
-switch
|
||||
from Real to Protected Mode
|
||||
-jump
|
||||
jmp to the bios at 0xFFFF:0x0000
|
||||
|
||||
we must have bios payload always at 1kb
|
||||
offset from start of ELF payload so loader.o
|
||||
must be always 1024 bytes.
|
||||
|
||||
------------------------------------------
|
||||
|
||||
BOCHS BIOS
|
||||
|
||||
we have taken the boch's project and just extracted
|
||||
its bios from it only. it took us (so far) only
|
||||
minor modifications in order to make it work.
|
||||
|
||||
basically it is the following directory in the
|
||||
bochs sources
|
||||
|
||||
bochs-cvs/bochs/bios
|
||||
|
||||
of all files there the rombios.c is the key file.
|
||||
Most of the times our patches are against current
|
||||
version of the rombios.c file. We try to feed back
|
||||
the patches to bochs maintainers so that's possible
|
||||
to use the bochs bios as is.
|
||||
|
||||
the boch's related stuff are in bochs subdirectory.
|
||||
|
||||
building boch's bios is as simple as
|
||||
|
||||
cd bochs/bochs-cvs/bochs/bios
|
||||
make
|
||||
|
||||
the resulting file rombios.bin is our bios image.
|
||||
|
||||
-----
|
||||
At present time, it is recommended to use
|
||||
dev86-0.16.3 + my patch in order to compile
|
||||
bochs' bios. The dev86 package can be found
|
||||
at:
|
||||
|
||||
http://www.cix.co.uk/~mayday/
|
||||
|
||||
prepatched sources at:
|
||||
|
||||
http://www.missl.cs.umd.edu/~adam/dev86-0.16.3-MSR.tgz
|
||||
|
||||
------------------------------------------
|
||||
|
||||
Video BIOS
|
||||
|
||||
Video BIOS we use is binary only, so far.
|
||||
|
||||
At the present time we are using the original
|
||||
Video BIOS as supplied from the system.
|
||||
|
||||
To get the image simply type:
|
||||
|
||||
make makevideobios
|
||||
|
||||
The right thing will happen. For refernece the
|
||||
magic line in the Makefile is:
|
||||
|
||||
videobios:
|
||||
dd if=/proc/kcore \
|
||||
of=./video.bios.bin \
|
||||
bs=1 count=65536 skip=790528
|
||||
|
||||
---------------
|
||||
|
||||
We assume it is located at 0xC00000-0xE00000
|
||||
and we use 'dd and /proc/kcore to extract it
|
||||
(obviously it works as root only).
|
||||
|
||||
Obviously it needs to be done with original
|
||||
(as shipped by manufactuer bios) so it should
|
||||
be done as the first step of the ADLO setup.
|
||||
|
||||
---------------
|
||||
|
||||
The /proc/kcore is in ELF format (linux kernel
|
||||
2.4.x and later) so if we want to get accurate
|
||||
image of ram we must skip the ELF header.
|
||||
The magic command is :
|
||||
|
||||
readelf -a /proc/kcore
|
||||
|
||||
Program Headers:
|
||||
Type Offset VirtAddr PhysAddr FileSiz MemSiz
|
||||
NOTE 0x0007d4 0x00000000 0x00000000 0x005b0 0x00000
|
||||
LOAD 0x001000 0xc0000000 0x00000000 0xff60000 0xff60000
|
||||
^^^^^^^^
|
||||
|
||||
There we look for the first LOAD section, and see what
|
||||
is its offset (for us it is 0x1000)
|
||||
|
||||
---------------
|
||||
|
||||
64KiB = 65536
|
||||
|
||||
0x0C 00 00 + 0x10 00 = 790528
|
||||
|
||||
---------------
|
||||
|
||||
On technical note in our case video bios
|
||||
is just 48kb, but for paranoia sake we copy
|
||||
64kb.
|
||||
|
||||
==========================================
|
||||
|
||||
Environment overview
|
||||
|
||||
ADLO is an ELF file and thus can be loaded either directly from 1)
|
||||
LinuxBIOS, or 2) via EtherBOOT, or 3) via EtherBOOT+ AA patch for FS
|
||||
support.
|
||||
|
||||
1)
|
||||
Both LinuxBIOS and ADLO are on the same EEPROM chip. From end-user
|
||||
viewpoint it is probably the most similar to the bios classic.
|
||||
(computer boots up and just loads whatever is in MBR).
|
||||
|
||||
2)
|
||||
Set it up in /tftpboot directory on dhcp/tftp server and have it served
|
||||
from there. (this is how we did the development)
|
||||
|
||||
3)
|
||||
Use AA patch and put it as /kernel file and it will be then loaded by
|
||||
etherboot from local hard disk.
|
||||
|
||||
|
||||
------------------------------------------
|
||||
|
||||
Before ADLO starts.
|
||||
|
||||
ADLO requires an boot loader with ELF support.
|
||||
In our case it is:
|
||||
|
||||
-LinuxBIOS
|
||||
-LinuxBIOS and EtherBOOT
|
||||
-LinuxBIOS and EtherBOOT + AA polled I/O patch (w/ FS support).
|
||||
|
||||
As little as LinuxBIOS only is required to get ADLO
|
||||
up and running.
|
||||
|
||||
For development purposes it is recommended full set of
|
||||
LinuxBIOS + EtherBOOT and boot via DHCP/TFTP.
|
||||
|
||||
------------------------------------------
|
||||
|
||||
After ADLO finish.
|
||||
|
||||
ADLO will attempt to locate the first hard disk
|
||||
and read MBR from it and execute.
|
||||
|
||||
Then it can start any real mode application.
|
||||
In our case it could be LILO or GRUB
|
||||
but choices are not limited to this.
|
||||
|
||||
In our case it would cause LILO to load
|
||||
(fully usable) and from there it was able to
|
||||
execute simple programs. so far the list
|
||||
of the program is limited to linux which
|
||||
runs somewhat. More to come in future.
|
||||
|
||||
==========================================
|
|
@ -0,0 +1,37 @@
|
|||
Date: Sat, 23 Nov 2002 22:20:57 -0500
|
||||
From: Adam Sulmicki <adam@cfar.umd.edu>
|
||||
To: LinuxBIOS <linuxbios@clustermatic.org>
|
||||
Cc: William Arbaugh <waa@cs.umd.edu>, Adam Agnew <agnew@cs.umd.edu>
|
||||
Subject: [ANNOUNCE] LinuxBIOS boots Windows 2000, GRUB, and OpenBSD.
|
||||
|
||||
We're happy to announce that we've been able to successfully boot
|
||||
Windows 2000 without a legacy BIOS. We accomplished this by developing
|
||||
software that combined elements from two very successful projects:
|
||||
LinuxBIOS and BOCHS. The Etherboot project also helped in various ways.
|
||||
|
||||
As a result now, we have a completely open source replacement for the
|
||||
BIOS that can use (without modification) either LILO or GRUB as
|
||||
bootloaders, and Linux, OpenBSD, and Windows 2000 as operating systems
|
||||
(NOTE: We're still working on supporting FreeBSD and Windows XP. We
|
||||
expect that improving ATA support will permit Win98 and WinXP to boot,
|
||||
and finishing PIRQ support will permit FreeBSD to boot.) Motherboard
|
||||
support is also limited at this time, but we hope to expand that along
|
||||
with LinuxBIOS.
|
||||
|
||||
More details can be found at:
|
||||
|
||||
http://www.missl.cs.umd.edu/Projects/sebos/main.shtml
|
||||
|
||||
and
|
||||
|
||||
http://www.missl.cs.umd.edu/Projects/sebos/phase2.shtml
|
||||
|
||||
Ironically, twenty years ago this month Compaq introduced their Compaq
|
||||
portable computer with the first BIOS outside of IBM, see
|
||||
http://www.old-computers.com/museum/computer.asp?st=1&c=547 .
|
||||
|
||||
Adam Sulmicki
|
||||
Adam Agnew
|
||||
William Arbaugh
|
||||
|
||||
This work has been funded by a grant from DARPA under the CHATS program.
|
|
@ -0,0 +1,154 @@
|
|||
$Id: STATUS,v 1.1 2002/11/25 02:07:53 rminnich Exp $
|
||||
==========================================
|
||||
==========================================
|
||||
|
||||
STATUS
|
||||
|
||||
==========================================
|
||||
==========================================
|
||||
|
||||
LILO
|
||||
fully supported
|
||||
|
||||
==========================================
|
||||
|
||||
GRUB
|
||||
fully supported
|
||||
|
||||
notes
|
||||
int15/eAX=00C0 - not supported
|
||||
int15/Eax=5300 - not supported
|
||||
int 13 ; fn 41 -> dev 81
|
||||
int 13 ; fn 08 -> dev 81
|
||||
|
||||
==========================================
|
||||
|
||||
LINUX
|
||||
fully supported
|
||||
|
||||
notes
|
||||
won't reboot
|
||||
fix fb?
|
||||
|
||||
==========================================
|
||||
|
||||
openbsd
|
||||
fully supported
|
||||
|
||||
notes
|
||||
won't reboot
|
||||
|
||||
==========================================
|
||||
Win2k
|
||||
|
||||
fully supported
|
||||
|
||||
notes
|
||||
network?
|
||||
better gfx?
|
||||
|
||||
==========================================
|
||||
|
||||
freebsd
|
||||
somewhat supported
|
||||
|
||||
notes
|
||||
won't reboot
|
||||
|
||||
right now it hangs somewhere around fsck/net startup
|
||||
|
||||
probably due to bad PIRQ table,
|
||||
it probably switches to polled IO and is dog slow.
|
||||
|
||||
==========================================
|
||||
|
||||
Win98
|
||||
somewhat supported
|
||||
|
||||
lots of ata issues, but if get past
|
||||
ata hurdles, desktop will show up
|
||||
|
||||
press F8 for safe mode.
|
||||
the desktop comes up
|
||||
(can see "safe mode")
|
||||
|
||||
int 15 D8 (?) not supporte
|
||||
int 15 ?? not supported
|
||||
int 15 fn 24 (set A20 gate) not suported)
|
||||
|
||||
==========================================
|
||||
|
||||
winXP
|
||||
|
||||
no go
|
||||
|
||||
safe/normal boot
|
||||
|
||||
progress bar finishes, switches to gfx mode
|
||||
and immediatelly STOP 7B, no sub error.
|
||||
|
||||
more timing problems!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
more likely "unexpected previous state" problems.
|
||||
|
||||
cold reboot, normal boot and safe mode
|
||||
missing hal
|
||||
\system32\hal.dll
|
||||
|
||||
missing system
|
||||
-------------------
|
||||
no lba - ie none
|
||||
function 02, error 11 - drv not ready.
|
||||
|
||||
|
||||
==========================================
|
||||
==========================================
|
||||
|
||||
syslinux
|
||||
netbsd
|
||||
hurd
|
||||
dos
|
||||
other applications
|
||||
|
||||
not supported/tested at present time
|
||||
|
||||
==========================================
|
||||
TODO:
|
||||
|
||||
timing in ide read code (int13) [WIP]
|
||||
grub boot
|
||||
sometimes it work, sometimes it doesn't
|
||||
|
||||
openbsd boot /WinXP boot.
|
||||
(AH=0x02) misreads sometimes.
|
||||
|
||||
fix int15 memory functions. (E820, etc)
|
||||
so that mem size is not hard coded.
|
||||
(see prep "fixup" section in loader.s)
|
||||
|
||||
fix bios to properly handle reboot
|
||||
|
||||
setup PIRQ table for P6STMT mbo.
|
||||
have it extract from linuxbios somehow..
|
||||
find it in ram and copy...
|
||||
|
||||
hack gcc to support 16 bit real mode.
|
||||
|
||||
|
||||
port 80 card broken?
|
||||
|
||||
hack dev86 to support rdmsr and wrmsr [done]
|
||||
|
||||
|
||||
==========================================
|
||||
problems:
|
||||
-binary only video bios required
|
||||
-binary only bios required
|
||||
-warm reboot from pc bios is required
|
||||
chipset timings or something
|
||||
P6STMT board only.
|
||||
|
||||
|
||||
int 12 not stable, multiple reboot required
|
||||
debug msg for slowing down required
|
||||
|
||||
==========================================
|
|
@ -0,0 +1,50 @@
|
|||
# Copyright (C) 2001 MandrakeSoft S.A.
|
||||
#
|
||||
# MandrakeSoft S.A.
|
||||
# 43, rue d'Aboukir
|
||||
# 75002 Paris - France
|
||||
# http://www.linux-mandrake.com/
|
||||
# http://www.mandrakesoft.com/
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# Makefile for the BIOS component of bochs
|
||||
|
||||
.SUFFIXES: .cc
|
||||
|
||||
# -------- end configurable options --------------------------
|
||||
|
||||
.cc.o:
|
||||
$(CXX) -c $(CXXFLAGS) $(LOCAL_CXXFLAGS) $(BX_INCDIRS) $< -o $@
|
||||
|
||||
bios: rombios.bin
|
||||
|
||||
rombios.bin: rombios.c
|
||||
gcc -E -P $< > _rombios_.c
|
||||
bcc -o rombios.s -C-c -D__i86__ -0 -S _rombios_.c
|
||||
sed -e 's/^\.text//' -e 's/^\.data//' rombios.s > _rombios_.s
|
||||
as86 _rombios_.s -b rombios.bin -u- -w- -g -0 -j -O -l rombios.txt
|
||||
ls -l rombios.bin
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
clean:
|
||||
rm -f *.s
|
||||
rm -f _rombios_.c
|
||||
rm -f rombios.txt
|
||||
rm -f rombios.bin
|
||||
|
||||
|
||||
# -----------------------------------------------------------------
|
|
@ -0,0 +1 @@
|
|||
The bochs bios.
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,461 @@
|
|||
;*****************************************************
|
||||
; $Id: loader.s,v 1.1 2002/11/25 02:07:53 rminnich Exp $
|
||||
;*****************************************************
|
||||
USE32
|
||||
; code it is loaded into memory at 0x7C00
|
||||
;*****************************************************
|
||||
nop
|
||||
nop
|
||||
;*****************************************************
|
||||
; A) setup GDT, so that we do not depend on program
|
||||
; that loaded us for GDT.
|
||||
; Ex: LinuxBIOS and EtherBOOT use different GDT's.
|
||||
|
||||
;-----------------------------------------------------
|
||||
; 0)
|
||||
|
||||
cli
|
||||
|
||||
;-----------------------------------------------------
|
||||
; I)
|
||||
|
||||
lgdt [0x7C00+protected_gdt]
|
||||
|
||||
;-----------------------------------------------------
|
||||
; II) setup CS
|
||||
|
||||
jmp 0x08:0x7C00+newpgdt
|
||||
|
||||
newpgdt: nop
|
||||
|
||||
;-----------------------------------------------------
|
||||
; III) setup all other segments
|
||||
|
||||
mov ax, #0x10
|
||||
mov ss, ax
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
;-----------------------------------------------------
|
||||
; IV)
|
||||
|
||||
; not now
|
||||
;sti
|
||||
|
||||
;*****************************************************
|
||||
nop
|
||||
nop
|
||||
;*****************************************************
|
||||
; B) shadow - ON (enable/read/write)
|
||||
|
||||
mov eax, #0x80000070
|
||||
mov dx, #0x0cf8
|
||||
out dx, eax
|
||||
|
||||
mov eax, #0xFFFFFFFF
|
||||
mov dx, #0x0cfc
|
||||
out dx, eax
|
||||
|
||||
;*****************************************************
|
||||
nop
|
||||
nop
|
||||
;*****************************************************
|
||||
; C) copy -- boch bios
|
||||
|
||||
; counter - 64kb.
|
||||
mov ecx, #0x10000
|
||||
|
||||
; source - 0x8000 ( 0x7C00+0x400 = 0x8000 )
|
||||
mov ax, #0x10 ; src-segment - 2nd entry in GDT
|
||||
mov ds, ax
|
||||
mov eax, #0x8000 ; src-offset - 0x8000
|
||||
mov esi, eax
|
||||
|
||||
; destination - 0xE0000
|
||||
mov ax, #0x10 ; dst-segment - 2nd entry in GDT
|
||||
mov es, ax
|
||||
mov eax, #0xF0000 ; dst-offset - 0xF0000
|
||||
mov edi, eax
|
||||
|
||||
; clear direction flag
|
||||
cld
|
||||
|
||||
; the copy
|
||||
rep
|
||||
movsb
|
||||
|
||||
;*****************************************************
|
||||
nop
|
||||
nop
|
||||
;*****************************************************
|
||||
; X) copy -- LinuxBIOS table into safe place.
|
||||
|
||||
;; TODO.
|
||||
;; Q1 : what is the size of table.
|
||||
;; Q2 : where to copy?
|
||||
|
||||
;*****************************************************
|
||||
nop
|
||||
nop
|
||||
;*****************************************************
|
||||
; E) shadow - OFF (write)
|
||||
|
||||
mov eax, #0x80000070
|
||||
mov dx, #0x0cf8
|
||||
out dx, eax
|
||||
|
||||
;mov eax, #0xFFFFFFFF
|
||||
mov eax, #0x0000FFFF
|
||||
mov dx, #0x0cfc
|
||||
out dx, eax
|
||||
|
||||
;*****************************************************
|
||||
nop
|
||||
nop
|
||||
;*****************************************************
|
||||
; F) do a little prep work.
|
||||
|
||||
;-----------------------------------------------------
|
||||
; I) disable cache
|
||||
|
||||
; if you disable cache, GRUB's GFX mode will be VERY slow.
|
||||
; so DO NOT DISABLE
|
||||
|
||||
;mov eax, cr0
|
||||
;or eax, #0x60000000
|
||||
;wbinvd
|
||||
;mov cr0, eax
|
||||
;wbinvd
|
||||
|
||||
;-----------------------------------------------------
|
||||
; II) disable MTRR
|
||||
; clear the "E" (0x800) and "FE" (0x400) flags in
|
||||
; IA32_MTRRdefType register (0x2FF)
|
||||
|
||||
;-----------------------
|
||||
|
||||
;mov ECX,#0x2FF
|
||||
|
||||
; select either of the two below
|
||||
; depending on if your compiler suports
|
||||
; {RD,WR}MSR or not
|
||||
;rdmsr
|
||||
; .byte 0x0F, 0x32
|
||||
|
||||
;xor edx, edx
|
||||
; xor eax, eax
|
||||
;and eax, #0xFFFFF3FF
|
||||
|
||||
; select either of the two below
|
||||
; depending on if your compiler suports
|
||||
; {RD,WR}MSR or not
|
||||
;wrmsr
|
||||
; .byte 0x0F, 0x30
|
||||
|
||||
;-----------------------
|
||||
;; This is what PC BIOS is setting. -- P6STMT.
|
||||
; add VIDEO BIOS cacheable!!!!
|
||||
;-----------------------
|
||||
; Fixed Range C0--C8
|
||||
;mov ECX,#0x268
|
||||
;mov EDX,#0x05050505
|
||||
;mov EAX,#0x05050505
|
||||
;wrmsr
|
||||
;-----------------------
|
||||
; Fixed Range C8--CF
|
||||
;mov ECX,#0x269
|
||||
;mov EDX,#0x0
|
||||
;mov EAX,#0x05050505
|
||||
;wrmsr
|
||||
;-----------------------
|
||||
|
||||
;-----------------------------------------------------
|
||||
; III) tell BOCHS' BIOS we want to boot from hdd.
|
||||
; 0x00 - floppy
|
||||
; 0x02 - hdd
|
||||
; In future there will be 'fd failover'option in bochs.
|
||||
|
||||
mov al, #0x3d ;; cmos_reg
|
||||
out 0x70, al
|
||||
mov al, #0x02 ;; val (hdd)
|
||||
out 0x71, al
|
||||
|
||||
;-----------------------------------------------------
|
||||
; IV) tell BOCHS' BIOS length of our mem block @ 1mb.
|
||||
; This is for Int 15 / EAX=E820
|
||||
; 119mb = 0x77 00 00 00
|
||||
; (this is for 128mb of ram)
|
||||
; (FIXME: this value is currently hard coded)
|
||||
; (it should be being passed from LinuxBIOS )
|
||||
|
||||
; for WinFast 6300
|
||||
; 07 70 = 0770
|
||||
; 06 80 = 0770 - 00F0 << ALT (for unpatched bochs)
|
||||
|
||||
; for P6STMT - 10kb less ram
|
||||
; 077F - 10 = 07 6F
|
||||
; 07 6F - 00 F0 = 06 7F
|
||||
|
||||
mov al, #0x35 ;; cmos_reg
|
||||
out 0x70, al
|
||||
mov al, #0x06 ;; val
|
||||
out 0x71, al
|
||||
|
||||
mov al, #0x34 ;; cmos_reg
|
||||
out 0x70, al
|
||||
mov al, #0x7F ;; val
|
||||
out 0x71, al
|
||||
|
||||
mov al, #0x31 ;; cmos_reg
|
||||
out 0x70, al
|
||||
mov al, #0x00 ;; val
|
||||
out 0x71, al
|
||||
|
||||
mov al, #0x30 ;; cmos_reg
|
||||
out 0x70, al
|
||||
mov al, #0x00 ;; val
|
||||
out 0x71, al
|
||||
|
||||
;-----------------------------------------------------
|
||||
; V) tell BOCHS' BIOS we want to have LBA translation.
|
||||
; 0x00 - NONE
|
||||
; 0x01 - LBA <<<<
|
||||
; 0x02 - LARGE
|
||||
; 0x03 - R-CHS
|
||||
; In future there will be 'fd failover'option in bochs.
|
||||
|
||||
mov al, #0x39 ;; cmos_reg
|
||||
out 0x70, al
|
||||
mov al, #0x01 ;; val (LBA)
|
||||
out 0x71, al
|
||||
|
||||
;*****************************************************
|
||||
nop
|
||||
nop
|
||||
;*****************************************************
|
||||
; G) the switch -- protected to real mode
|
||||
|
||||
; IASDM, Vol 3
|
||||
; (8-14) 8.8.2 Switching Back to Real-Address Mode
|
||||
|
||||
;=====================================================
|
||||
; 1) disable interrupts
|
||||
|
||||
cli
|
||||
|
||||
;=====================================================
|
||||
nop
|
||||
;=====================================================
|
||||
; 2) paging
|
||||
|
||||
;not enabled, so not applicable.
|
||||
|
||||
;=====================================================
|
||||
; 3) setup CS segment limit (64kb)
|
||||
; I)
|
||||
|
||||
lgdt [0x7C00+new_gdt]
|
||||
|
||||
;-----------------------------------------------------
|
||||
; II)
|
||||
|
||||
jmp 0x08:0x7C00+new64lim
|
||||
|
||||
new64lim: nop
|
||||
|
||||
;=====================================================
|
||||
nop
|
||||
;=====================================================
|
||||
; 4) setup all other segments
|
||||
|
||||
mov ax, #0x10
|
||||
mov ss, ax
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
;=====================================================
|
||||
nop
|
||||
;=====================================================
|
||||
; 5) LIDT
|
||||
; I)
|
||||
|
||||
; set up Real Mode IDT table (0...3FF)
|
||||
|
||||
; for BOCH's BIOS the address 0xF000:0xFF53
|
||||
; cantains value 0xCF which is IRET opcode.
|
||||
|
||||
; counter
|
||||
mov cx, #0xFF ;1024 bytes(255 interrupts)(4*255=0x3FF)
|
||||
|
||||
; destination - 0x00000 = ES:EDI
|
||||
mov ax, #0x10 ; dst-segment - 2nd entry in GDT
|
||||
mov es, ax
|
||||
mov eax, #0x00000 ; dst-offset - 0x00000
|
||||
mov edi, eax
|
||||
|
||||
; data to store -- 0xF000:FF53
|
||||
mov eax, #0xF000FF53
|
||||
|
||||
; clear direction flag
|
||||
cld
|
||||
|
||||
; the store
|
||||
rep
|
||||
stosd
|
||||
|
||||
;-----------------------------------------------------
|
||||
; II)
|
||||
; load interrupt descriptor table
|
||||
|
||||
lidt [0x7C00+new_idt]
|
||||
|
||||
;=====================================================
|
||||
nop
|
||||
nop
|
||||
;=====================================================
|
||||
; 6) clear the PE flag in CR0 register.
|
||||
; I)
|
||||
|
||||
; switch to 16 bit segments
|
||||
mov ax, #0x20
|
||||
mov ss, ax
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
;-----------------------------------------------------
|
||||
; II)
|
||||
|
||||
; switch to 16 bit CS
|
||||
|
||||
jmp 0x018:0x7C00+new16bit
|
||||
|
||||
USE16
|
||||
|
||||
new16bit: nop
|
||||
|
||||
;-----------------------------------------------------
|
||||
; III)
|
||||
; the switch
|
||||
|
||||
;xor eax, eax
|
||||
|
||||
mov eax, cr0
|
||||
and eax, #0xFFFFFFFE
|
||||
mov cr0, eax ;switch to RM
|
||||
|
||||
;=====================================================
|
||||
nop
|
||||
nop
|
||||
;=====================================================
|
||||
; 7) far jump -- (to real mode address)
|
||||
|
||||
jmp 0x0:0x7C00+realcs
|
||||
|
||||
realcs: nop
|
||||
|
||||
;=====================================================
|
||||
; 8) set all segment registers to 0's
|
||||
|
||||
mov ax, #0x0
|
||||
mov ss, ax
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
;=====================================================
|
||||
; 9) re-enable interrupts
|
||||
|
||||
sti
|
||||
|
||||
;*****************************************************
|
||||
nop
|
||||
nop
|
||||
;*****************************************************
|
||||
; G) jump to BIOS.
|
||||
|
||||
jmp 0xFFFF:0x0000
|
||||
;jmp 0xF000:0xFFF0
|
||||
|
||||
;*****************************************************
|
||||
;*****************************************************
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
;*****************************************************
|
||||
;*****************************************************
|
||||
|
||||
USE32
|
||||
|
||||
new_idt:
|
||||
dw 0x03ff ;; limit 15:00
|
||||
dw 0x0000 ;; base 15:00
|
||||
dw 0x0000 ;; base 23:16
|
||||
|
||||
new_gdt:
|
||||
dw 0x0028 ;; limit 15:00
|
||||
dw 0x7C00+new_gdt_table ;; base 15:00
|
||||
dw 0x0000 ;; base 23:16
|
||||
|
||||
protected_gdt:
|
||||
dw 0x0018 ;; limit 15:00
|
||||
dw 0x7C00+pmode_gdt_table ;; base 15:00
|
||||
dw 0x0000 ;; base 23:16
|
||||
|
||||
;-----------------------------------------------------
|
||||
|
||||
new_gdt_table:
|
||||
;// 1 2 3 4
|
||||
;//0
|
||||
dd 0x00000000
|
||||
dd 0x00000000
|
||||
|
||||
;//8
|
||||
dd 0x0000ffff
|
||||
dd 0x00409E00
|
||||
|
||||
;//10
|
||||
dd 0x0000ffff
|
||||
dd 0x00409200
|
||||
|
||||
;//18
|
||||
dd 0x0000ffff
|
||||
dd 0x00009a00
|
||||
|
||||
;//20
|
||||
dd 0x0000ffff
|
||||
dd 0x00009200
|
||||
|
||||
;-------------------------
|
||||
|
||||
pmode_gdt_table:
|
||||
;// 1 2 3 4
|
||||
;//0
|
||||
dd 0x00000000
|
||||
dd 0x00000000
|
||||
|
||||
;//8
|
||||
dd 0x0000ffff
|
||||
dd 0x00CF9E00
|
||||
|
||||
;//10
|
||||
dd 0x0000ffff
|
||||
dd 0x00CF9200
|
||||
|
||||
;*****************************************************
|
||||
;*****************************************************
|
||||
; the file size must be 1024 bytes.
|
||||
|
||||
|
||||
.org 0x400-1
|
||||
; dd 0xdeadbeef
|
||||
db 0x0
|
||||
|
||||
;*****************************************************
|
Loading…
Reference in New Issue