diff options
Diffstat (limited to 'bootblocks/i86_funcs.c')
-rw-r--r-- | bootblocks/i86_funcs.c | 94 |
1 files changed, 16 insertions, 78 deletions
diff --git a/bootblocks/i86_funcs.c b/bootblocks/i86_funcs.c index 2112141..7d010f5 100644 --- a/bootblocks/i86_funcs.c +++ b/bootblocks/i86_funcs.c @@ -1,77 +1,21 @@ #include "monitor.h" -int x86 = 0; /* CPU major number */ +#ifndef NOMONITOR +int x86 = 3; /* CPU major number */ char *x86_name = ""; /* and it's name */ int x86_emu = 0; /* Is this a PC emulator ? */ -int x86_a20_closed = 1; /* Is the A20 gate closed ? */ int x86_fpu = 0; +#endif int x86_test = 0; /* In test mode */ unsigned boot_mem_top = 0x2000; /* Default 128k, the minimum */ long main_mem_top = 0; /* K of extended memory */ -int a20_closed() -{ - register int v, rv = 0; - if (x86_test) return 1; /* If not standalone don't try */ - - __set_es(0); - v = __peek_es(512); - __set_es(0xFFFF); - if (v == __peek_es(512+16)) - { - __set_es(0); - __poke_es(512, v+1); - __set_es(0xFFFF); - if (v+1 == __peek_es(512+16)) - rv = 1; - __set_es(0); - __poke_es(512, v); - } - return x86_a20_closed = rv; -} - -static void asm_open_a20() -{ -#asm - call empty_8042 - mov al,#0xD1 ! command write - out #0x64,al - call empty_8042 - mov al,#0xDF ! A20 on - out #0x60,al -empty_8042: - .word 0x00eb,0x00eb - in al,#0x64 ! 8042 status port - test al,#2 ! is input buffer full? - jnz empty_8042 ! yes - loop, with no timeout! -#endasm -} - -void open_a20() { if(!x86_test) asm_open_a20(); } - -/* This calls the BIOS to open the A20 gate, officially this is only supported - on PS/2s but if the normal routine fails we may as well try this. - */ -void asm_bios_open_a20() -{ -#asm - mov ax,#$2401 - int $15 - jc bios_failed_a20 - xor ax,ax -bios_failed_a20: - mov al,ah - xor ah,ah -#endasm -} - -void bios_open_a20() { if(!x86_test) asm_bios_open_a20(); } - void cpu_check() { +#ifndef NOMONITOR static char *name_808x[] = { "8088", "8086", "80C88", "80C86", "NEC V20", "NEC V30", "808x Clone" @@ -107,8 +51,12 @@ void cpu_check() if (c & 0x01) x86_emu = 1; /* Already in protected mode !!! */ } -#ifdef __STANDALONE__ x86_test = x86_emu; + if (x86<3) + x86_test = 1; +#endif + +#ifdef __STANDALONE__ if (__argr.x.cflag) x86_test = 1; #else @@ -118,35 +66,27 @@ void cpu_check() void mem_check() { -#ifndef __STANDALONE__ - main_mem_top = 16384; - return; /* If not standalone don't try */ -#else + if (x86_test) { + main_mem_top = 0; + return; + } + #asm int 0x12 ! Amount of boot memory mov cl,#6 sal ax,cl ! In segments mov [_boot_mem_top],ax - ! Next check for extended - mov al,[_x86] ! If we ain't got a 286+ we can't access it anyway - cmp al,#2 - jl is_xt - - mov ah,#0x88 ! + mov ah,#0x88 ! Next check for extended int 0x15 - jnc got_ext ! Error!? This should _not_ happen ... but ... + jnc got_ext ! Error! is_xt: xor ax,ax got_ext: mov word ptr [_main_mem_top+2],#0 mov [_main_mem_top],ax - #endasm - /* Rest are big memory for 80386+ */ - if( x86 < 3 ) return; - /* Try int $15 EAX=$E820 */ { struct e820_dat { @@ -202,8 +142,6 @@ got_e820: no_e801: #endasm } - -#endif } #define RIGHTS (0x93000000L) |