version 1.1.1.1, 2008/06/03 10:38:41 |
version 1.1.1.1.2.1, 2008/08/13 17:12:21 |
|
|
*/ |
*/ |
movl $(ARCHIVE_START), %edi /* Relocation target */ |
movl $(ARCHIVE_START), %edi /* Relocation target */ |
movl $0x32000, %esi |
movl $0x32000, %esi |
movl $0x1B8000, %ecx /* size 0x6e000 */ |
movl $0x1B800, %ecx /* size 0x6e000 */ |
rep movsl |
rep movsl |
|
|
jmp loader_main /* Jump to main routine in C */ |
jmp loader_main /* Jump to main routine in C */ |
|
|
movb $0xdf, %al |
movb $0xdf, %al |
outb %al, $0x60 |
outb %al, $0x60 |
call empty_8042 |
call empty_8042 |
wait_enable: |
call wait_a20 |
ret |
ret |
|
|
/* |
/* |
* empty_8042 - Empty 8042 |
* empty_8042 - Empty 8042 |
*/ |
*/ |
empty_8042: |
empty_8042: |
pushw %ax |
|
retry: |
|
call io_delay |
|
inb $0x64, %al |
inb $0x64, %al |
testb $1, %al |
testb $0x01, %al |
jz no_output |
jz no_output |
|
|
call io_delay |
|
inb $0x60, %al |
inb $0x60, %al |
jmp retry |
jmp empty_8042 |
|
|
no_output: |
no_output: |
testb $2, %al |
testb $0x02, %al |
jnz retry |
jnz empty_8042 |
popw %ax |
|
ret |
ret |
|
|
/* |
/* |
* io_delay - I/O delay |
* wait_a20 - Wait A20 ready |
*/ |
*/ |
io_delay: |
wait_a20: |
pushw %ax |
xorw %ax, %ax |
inb $0x80, %al |
movw %ax, %fs |
inb $0x80, %al |
movw $0xffff, %ax |
popw %ax |
movw %ax, %gs |
ret |
movw %fs:(0x0), %ax |
|
cmp %gs:(16), %ax |
|
jne a20_ready |
|
movw %dx, %ax |
|
notw %ax |
|
movw %ax, %fs:(0x0) |
|
cmp %gs:(16), %ax |
|
mov %fs:(0), %dx |
|
jne a20_ready |
|
jmp wait_a20 |
|
a20_ready: |
|
ret |
|
|
/* |
/* |
* Setup screen |
* Setup screen |
|
|
movl %eax, kern_start |
movl %eax, kern_start |
jmp code_flush |
jmp code_flush |
code_flush: |
code_flush: |
|
|
/* Prepare registers for kernel */ |
/* Prepare registers for kernel */ |
movw $(SEL_DATA32), %ax |
movw $(SEL_DATA32), %ax |
movw %ax, %ds |
movw %ax, %ds |
|
|
kern_start: |
kern_start: |
.long 0 |
.long 0 |
.word SEL_CODE32 |
.word SEL_CODE32 |
|
|
|
/* |
|
* putchar - output to bochs emulater console. |
|
*/ |
|
ENTRY(putchar) |
|
#if defined(DEBUG) && defined(CONFIG_DIAG_BOCHS) |
|
inb $0xe9, %al |
|
cmpb $0xe9, %al |
|
jne no_bochs |
|
movl 4(%esp), %eax |
|
outb %al, $0xe9 |
|
no_bochs: |
|
#endif |
|
ret |
|
|
|
|
|
/* |
|
* machine_panic - panic handler |
|
*/ |
|
ENTRY(machine_panic) |
|
stop: |
|
jmp stop |
|
|
/* |
/* |
* Data |
* Data |