9boot: use 500 ms timeout
This commit is contained in:
parent
a67e921c7f
commit
5648d53cdb
3 changed files with 29 additions and 3 deletions
|
@ -9,6 +9,7 @@ void start(void *sp);
|
||||||
int getc(void);
|
int getc(void);
|
||||||
int gotc(void);
|
int gotc(void);
|
||||||
void putc(int c);
|
void putc(int c);
|
||||||
|
void usleep(int t);
|
||||||
void halt(void);
|
void halt(void);
|
||||||
void jump(void *pc);
|
void jump(void *pc);
|
||||||
|
|
||||||
|
|
|
@ -171,6 +171,17 @@ _pret32:
|
||||||
ANDL $0xFFFF, AX
|
ANDL $0xFFFF, AX
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
TEXT usleep(SB), $0
|
||||||
|
MOVL t+4(SP), AX
|
||||||
|
PUSHL AX
|
||||||
|
CALL rmode16(SB)
|
||||||
|
CALL16(spllo(SB))
|
||||||
|
POPR(rDX)
|
||||||
|
POPR(rCX)
|
||||||
|
MOVB $0x86, AH
|
||||||
|
BIOSCALL(0x15)
|
||||||
|
JMP _pret32
|
||||||
|
|
||||||
#ifdef PXE
|
#ifdef PXE
|
||||||
|
|
||||||
TEXT pxeinit(SB), $0
|
TEXT pxeinit(SB), $0
|
||||||
|
|
|
@ -129,6 +129,18 @@ readline(void *f, char buf[64])
|
||||||
return p - buf;
|
return p - buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
timeout(int ms)
|
||||||
|
{
|
||||||
|
while(ms > 0){
|
||||||
|
if(gotc())
|
||||||
|
return 1;
|
||||||
|
usleep(100000);
|
||||||
|
ms -= 100;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#define BOOTLINE ((char*)CONFADDR)
|
#define BOOTLINE ((char*)CONFADDR)
|
||||||
#define BOOTLINELEN 64
|
#define BOOTLINELEN 64
|
||||||
#define BOOTARGS ((char*)(CONFADDR+BOOTLINELEN))
|
#define BOOTARGS ((char*)(CONFADDR+BOOTLINELEN))
|
||||||
|
@ -176,17 +188,19 @@ Loop:
|
||||||
print(line); print(crnl);
|
print(line); print(crnl);
|
||||||
}
|
}
|
||||||
*confend = 0;
|
*confend = 0;
|
||||||
|
|
||||||
if(f){
|
if(f){
|
||||||
close(f);
|
close(f);
|
||||||
f = 0;
|
f = 0;
|
||||||
|
|
||||||
|
if(kern && timeout(500))
|
||||||
|
goto Loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!kern){
|
if(!kern){
|
||||||
print("no bootfile\r\n");
|
print("no bootfile\r\n");
|
||||||
goto Loop;
|
goto Loop;
|
||||||
}
|
}
|
||||||
for(n=0; n<10000; n++)
|
|
||||||
if(gotc())
|
|
||||||
goto Loop;
|
|
||||||
if(p = strrchr(kern, '!'))
|
if(p = strrchr(kern, '!'))
|
||||||
kern = p+1;
|
kern = p+1;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue