Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 443 → Rev 444

/shark/trunk/oslib/xlib/vm86.c
46,7 → 46,7
 
//#define __LL_DEBUG__
 
#define VM86_STACK_SIZE 1024
#define VM86_STACK_SIZE 8192
 
extern DWORD ll_irq_table[256];
 
63,7 → 63,6
struct registers *global_regs;
WORD VM86_ret_ctx;
 
 
#ifdef __DUMB_CODE__
static LIN_ADDR vm86_code;
static BYTE prova86[] = {
85,7 → 84,9
0};
#endif
 
static BYTE vm86_retAddr[] = {0xcd, 0x48}; /* int 48h */
static BYTE vm86_retAddr[] = {0xcd, 0x48, /* int 48h */
0xf4,
0};
 
TSS *vm86_get_tss(void)
{
114,9 → 115,6
{
int register i;
/* Init the DOS memory allocator */
DOS_mem_init();
 
/* First of all, we need to setup a GDT entries to
* allow vm86 task execution. We just need a free 386 TSS, which
* will be used to store the execution context of the virtual 8086
135,10 → 133,6
vm86_stack = DOS_alloc(VM86_STACK_SIZE*2);
vm86_stack += VM86_STACK_SIZE/2;
/* Create a location of DOS memory containing the
* opcode sequence which will generate a GPF
* We use the privileged instruction hlt to do it
*/
vm86_iretAddress = DOS_alloc(sizeof(vm86_retAddr));
memcpy(vm86_iretAddress,vm86_retAddr,sizeof(vm86_retAddr));
#ifdef __LL_DEBUG__
178,10 → 172,10
DWORD vm86_flags, vm86_cs,vm86_ip;
LIN_ADDR vm86_stackPtr;
DWORD *IRQTable_entry;
BYTE p1,p2;
BYTE p1,p2;
 
SYS_FLAGS f;
 
if (service < 0x10 || in == NULL) return -1;
f = ll_fsave();
195,7 → 189,7
vm86_tmpAddr = (DWORD)(vm86_iretAddress);
vm86_cs = (vm86_tmpAddr & 0xFF000) >> 4;
vm86_ip = (vm86_tmpAddr & 0xFFF);
vm86_flags = 0; /* CPU_FLAG_VM | CPU_FLAG_IOPL; */
vm86_flags = 0;
vm86_stackPtr = vm86_stack + VM86_STACK_SIZE;
lmempokew(vm86_stackPtr-6,vm86_ip);
lmempokew(vm86_stackPtr-4,vm86_cs);
218,18 → 212,16
(DWORD)vm86_TSS.t.cs,vm86_TSS.t.eip,&prova86);
message("(DUMB CODE) Go...\n");
#endif
vm86_TSS.t.back_link = ll_context_save();
VM86_ret_ctx = vm86_TSS.t.back_link;
 
p1 = inp(0x21);
p2 = inp(0xA1);
outp(0x21,0xFF);
outp(0xA1,0xFF);
sti();
 
vm86_TSS.t.back_link = ll_context_save();
VM86_ret_ctx = vm86_TSS.t.back_link
ll_context_load(X_VM86_TSS);
 
cli();
outp(0x21,p1);
outp(0xA1,p2);
 
265,19 → 257,16
#endif
/* Let's use the ll standard call... */
 
vm86_TSS.t.back_link = ll_context_save();
VM86_ret_ctx = vm86_TSS.t.back_link;
 
p1 = inp(0x21);
p2 = inp(0xA1);
outp(0x21,0xFF);
outp(0xA1,0xFF);
 
vm86_TSS.t.back_link = ll_context_save();
VM86_ret_ctx = vm86_TSS.t.back_link;
sti();
 
ll_context_load(X_VM86_TSS);
 
 
cli();
outp(0x21,p1);
outp(0xA1,p2);
 
308,7 → 297,8
}
#endif
 
ll_frestore(f);
ll_frestore(f);
 
return 1;
return 1;
 
}