[boot] Refine boot stages.

This commit is contained in:
Kevin Lange 2011-02-21 16:50:07 -06:00
parent 0b9cc2c3ec
commit 93f0dbb983
4 changed files with 8 additions and 39 deletions

View File

@ -32,8 +32,9 @@ void read(unsigned char count, unsigned char sector, short segment, short offset
*/
void main()
{
PRINT("Loading...\r\n");
PRINT("Loading... ");
read(2,2,0,0x7e00);
PRINT("Ready.\r\n");
/* Let's do this... */
__asm__ __volatile__ ("jmp $0x00, $0x7e00");

View File

@ -1,17 +1,5 @@
# Mr. Boots - Stage 1
# Find Stage 2 and immediately load it.
#
# NOTICE: This stage should be loaded from a partition on
# an EXT2-only disk without a partition table.
# If you want to use it with a different set up
# you need to patch it to include an MBR header
# and all the other necessary bits.
#
# Part of the ToAruOS Distribution of the ToAru Kernel
#
# NCSA license is available from the root directory of the
# source tree in which this file is shipped.
#
# Mr. Boots - Stage 1 (ASM entry point)
#
.code16

View File

@ -7,22 +7,16 @@
*/
__asm__(".code16gcc\n");
void kprint(short s)
{
__asm__ __volatile__ ("movw %0, %%si\n"
"call _print" : : "l" ((short)s));
}
#define PRINT(s) __asm__ ("movw %0, %%si\ncall _print" : : "l"((short)(int)s))
/*
* Main entry point
*/
int main() {
kprint((short)(int)"Welcome to C!\r\n");
void main()
{
PRINT("== Mr. Boots Stage 2 Bootloader ==\r\n");
/* And that's it for now... */
__asm__ __volatile__ ("hlt");
while (1) {};
/* Uh oh */
return -1;
}

View File

@ -15,15 +15,8 @@ _start:
movw $0x7bf0,%sp # stack pointer
movw $bmsga, %si # Print "Starting..."
calll _print # ...
.extern main # Jump the C main entry point...
calll main
movw $bmsgb, %si # We should not be here...
calll _print # ...
hlt
jmp main
_print:
movb $0x0E,%ah # set registers for
@ -37,10 +30,3 @@ _print.next:
jmp _print.next # continue
_print.return:
retl
.data
bmsga:
.string "Starting Stage 2...\r\n"
bmsgb:
.string "Critical failure!\r\n"