X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Fvm8086.c;fp=Kernel%2Farch%2Fx86%2Fvm8086.c;h=7181351002efccfbab540eb7e9dbb6218789a277;hb=9d85201216cb35e1b1e051b1d7cdc38eaa5befa4;hp=a1c75e2394fb8826d06f34bf9c590430fe27897f;hpb=635bc78017d8a4a16314a973e39c849b2afac795;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/vm8086.c b/Kernel/arch/x86/vm8086.c index a1c75e23..71813510 100644 --- a/Kernel/arch/x86/vm8086.c +++ b/Kernel/arch/x86/vm8086.c @@ -40,7 +40,7 @@ struct sVM8086_InternalData // === PROTOTYPES === int VM8086_Install(char **Arguments); void VM8086_GPF(tRegs *Regs); -tVM8086 *VM8086_Init(void); +//tVM8086 *VM8086_Init(void); // === GLOBALS === MODULE_DEFINE(0, 0x100, VM8086, VM8086_Install, NULL, NULL); @@ -83,7 +83,12 @@ int VM8086_Install(char **Arguments) MM_Map( i * 0x1000, i * 0x1000 ); MM_DerefPhys( i * 0x1000 ); } MM_Map( 0x9F000, 0x9F000 ); // Stack / EBDA - MM_Allocate( 0x100000 ); // System Stack / Stub + // System Stack / Stub + if( MM_Allocate( 0x100000 ) == 0 ) { + Log_Error("VM8086", "Unable to allocate memory for stack/stub"); + gVM8086_WorkerPID = 0; + Threads_Exit(0, 1); + } *(Uint8*)(0x100000) = VM8086_OP_IRET; *(Uint8*)(0x100001) = 0x07; // POP ES @@ -133,6 +138,11 @@ int VM8086_Install(char **Arguments) while( gpVM8086_State != NULL ) Threads_Yield(); // Yield to allow the child to initialise + // Worker killed itself + if( gVM8086_WorkerPID != pid ) { + return MODULE_ERR_MISC; + } + return MODULE_ERR_OK; }