# HG changeset patch # User Pascal Bellard # Date 1484902525 -3600 # Node ID 76087975885fa6274ffe795432f3ebd202e6696c # Parent faf865f8822c3fc83c21df7c99963c32b33cade6 linld: check asm instructions again processor type diff -r faf865f8822c -r 76087975885f linld/stuff/src/A20.ASM --- a/linld/stuff/src/A20.ASM Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/A20.ASM Fri Jan 20 09:55:25 2017 +0100 @@ -5,7 +5,7 @@ %crefref %noincl %nomacs - p386 + p8086 group DGROUP _TEXT,_DATA assume cs:DGROUP,ds:DGROUP diff -r faf865f8822c -r 76087975885f linld/stuff/src/CRTL.ASM --- a/linld/stuff/src/CRTL.ASM Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/CRTL.ASM Fri Jan 20 09:55:25 2017 +0100 @@ -5,7 +5,11 @@ %crefref %noincl %nomacs + ifdef NO386 + p8086 + else p386 + endif group DGROUP _TEXT,_DATA,_BSS assume cs:DGROUP,ds:DGROUP @@ -400,6 +404,72 @@ fd2close dw ? ;30 u16 fd2close; ends ;}; +;*************************************************************** +;void next_chunk(struct image_himem *di); +;*************************************************************** + proc next_chunk near + + push si + mov bx,[(image_himem di).fd] + call close + ifndef NO386 + xor eax,eax + else + xor ax,ax + endif + cwd + mov [(image_himem di).fd],ax + mov bx,[(image_himem di).state] + cmp al,[bx] ; "" + jz @@end + mov si,bx +@@scan: + lodsb + mov cx,si + cmp al,',' + jz @@eos + cmp al,0 + jnz @@scan + dec cx +@@eos: + mov [(image_himem di).state],cx + dec si + push [word si] + mov [byte si],dl ; set temp eos + call open + pop [word si] ; restore string + jc @@die + mov [(image_himem di).fd],ax + mov [(image_himem di).fd2close],ax + xchg ax,bx + mov ax,4202h ; SEEK_END + call lseek0 +@@die: + mov bx,[(image_himem di).errmsg] + jc die + mov bx,[(image_himem di).fd] + ifndef NO386 + push eax + call rewind + pop eax +@@end: + mov [(image_himem di).chunk_size],eax + else + push ax + push dx + call rewind + pop dx + pop ax +@@end: + mov [word (image_himem di).chunk_size],ax + mov [word ((image_himem di).chunk_size)+2],dx + endif + pop si + ret + + endp next_chunk + + ifdef LARGE_IMAGES struc data_himem ;struct data_himem { first dd ? ; 0 u32 first; @@ -416,6 +486,7 @@ global _malloc_bufv_or_die:near proc _malloc_bufv_or_die near + p386 pop bx ;caller return address pop ax push ax @@ -526,6 +597,9 @@ endif pop si ret + ifdef NO386 + p8086 + endif endp _malloc_bufv_or_die @@ -577,10 +651,14 @@ ifdef LARGE_IMAGES jmp @@memcpy memcpy_imagez: + p386 push ecx push eax push 0 push edx + ifdef NO386 + p8086 + endif endif endif @@memcpy: @@ -631,6 +709,7 @@ ifdef LARGE_IMAGES + p386 ;*************************************************************** ;void reset_bufv(u32 *p); ;*************************************************************** @@ -702,78 +781,15 @@ @@notfirst2: pop si ret + ifdef NO386 + p8086 + endif endp _prev_bufv endif ;*************************************************************** -;void next_chunk(struct image_himem *di); -;*************************************************************** - proc next_chunk near - - push si - mov bx,[(image_himem di).fd] - call close - ifndef NO386 - xor eax,eax - else - xor ax,ax - endif - cwd - mov [(image_himem di).fd],ax - mov bx,[(image_himem di).state] - cmp al,[bx] ; "" - jz @@end - mov si,bx -@@scan: - lodsb - mov cx,si - cmp al,',' - jz @@eos - cmp al,0 - jnz @@scan - dec cx -@@eos: - mov [(image_himem di).state],cx - dec si - push [word si] - mov [byte si],dl ; set temp eos - call open - pop [word si] ; restore string - jc @@die - mov [(image_himem di).fd],ax - mov [(image_himem di).fd2close],ax - xchg ax,bx - mov ax,4202h ; SEEK_END - call lseek0 -@@die: - mov bx,[(image_himem di).errmsg] - jc die - mov bx,[(image_himem di).fd] - ifndef NO386 - push eax - call rewind - pop eax -@@end: - mov [(image_himem di).chunk_size],eax - else - push ax - push dx - call rewind - pop dx - pop ax -@@end: - mov [word (image_himem di).chunk_size],ax - mov [word ((image_himem di).chunk_size)+2],dx - endif - pop si - ret - - endp next_chunk - - -;*************************************************************** ;void open_image(const char *name, struct image_himem *m); ;*************************************************************** global _open_image:near diff -r faf865f8822c -r 76087975885f linld/stuff/src/CRTL.H --- a/linld/stuff/src/CRTL.H Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/CRTL.H Fri Jan 20 09:55:25 2017 +0100 @@ -9,16 +9,16 @@ const unsigned MIN_STACK = 0x400; const unsigned MAX_MALLOC = 0xF000; -const A_RDONLY = 1; // for fileattr() -const A_HIDDEN = 2; -const A_SYSTEM = 4; -const A_LABEL = 8; -const A_DIRECTORY = 16; -const A_ARCHIVE = 32; +const char A_RDONLY = 1; // for fileattr() +const char A_HIDDEN = 2; +const char A_SYSTEM = 4; +const char A_LABEL = 8; +const char A_DIRECTORY = 16; +const char A_ARCHIVE = 32; -const O_RDONLY = 0; // for open() -const O_BINARY = 0; +const char O_RDONLY = 0; // for open() +const char O_BINARY = 0; extern char text_start; extern char text_end; extern char data_start; extern char data_end; @@ -42,7 +42,7 @@ extern "C" int write(int fd, const void* data, int sz); extern "C" long lseekset(int fd, long sz); extern "C" void* malloc(unsigned sz); -extern "C" void puts(const char* s); +extern "C" int puts(const char* s); extern "C" unsigned long strtol(const char *s); // Extensions diff -r faf865f8822c -r 76087975885f linld/stuff/src/CRTLX.ASM --- a/linld/stuff/src/CRTLX.ASM Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/CRTLX.ASM Fri Jan 20 09:55:25 2017 +0100 @@ -5,7 +5,7 @@ %crefref %noincl %nomacs - p386 + p8086 group DGROUP _TEXT,_DATA,_BSS assume cs:DGROUP,ds:DGROUP @@ -108,6 +108,7 @@ add dh,bh ; NS=386+, NC=286 clc js @@bad ;it is a 86/186/286, not a 386+ + p386 pushfd pushfd pop ebx @@ -125,6 +126,7 @@ db 0Fh,0A2h ; cpuid shr edx,1+29 ; LM feature bit ? @@bad: + p8086 sbb ax,ax ret diff -r faf865f8822c -r 76087975885f linld/stuff/src/HIMEM.CPP --- a/linld/stuff/src/HIMEM.CPP Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/HIMEM.CPP Fri Jan 20 09:55:25 2017 +0100 @@ -30,8 +30,8 @@ #endif } struct image_himem *m = ± + if(((u16 *)&m->fallback)[1] >= 0x10) m->fallback = _1m; // >= _1m ? vm2rm(); - if(((u16 *)&m->fallback)[1] >= 0x10) m->fallback = _1m; // >= _1m ? if(m->bufv==0) { // Move kernel memcpy_image(m); diff -r faf865f8822c -r 76087975885f linld/stuff/src/ISO9660.CPP --- a/linld/stuff/src/ISO9660.CPP Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/ISO9660.CPP Fri Jan 20 09:55:25 2017 +0100 @@ -19,10 +19,10 @@ int get, n; struct isostate *x=&isostate; - if (size > x->filesize) - size = x->filesize; if (isolseek(x->fileofs) == -1) return -1; + if (size < x->filesize) + size = x->filesize; for (get = size; get; get -= n, data += n) { n = read(x->fd,data,get); if (n < 0) @@ -54,16 +54,17 @@ int isoreaddir(int restart) { static char dots[] = ".."; - int size, n; + int size; + char *p; #ifdef __ROCKRIDGE char *endname; #endif struct isostate *x=&isostate; if (restart) { + x->curpos = SECTORSZ; x->curdirofs = x->dirofs; x->curdirsize = x->dirsize; - x->curpos = SECTORSZ; } if (x->curpos >= SECTORSZ || * (short *) (buffer + x->curpos) == 0) { if (x->curdirsize < SECTORSZ) return -1; @@ -72,36 +73,39 @@ x->curdirsize -= SECTORSZ; x->curpos = 0; } - size = * (short *) (buffer + x->curpos); + p = buffer + x->curpos; + size = * (short *) p; if (size == 0) return -1; - x->fileofs = (* (unsigned long *) (buffer + x->curpos + 2)) << SECTORBITS; - x->filesize = * (unsigned long *) (buffer + x->curpos + 10); - x->filemod = (buffer[x->curpos + 25] & 2) ? 0040755 : 0100755; + x->fileofs = (* (unsigned long *) (p + 2)) << SECTORBITS; + x->filesize = * (unsigned long *) (p + 10); + x->filemod = (p[25] & 2) ? 0040755 : 0100755; #ifdef __ROCKRIDGE endname = NULL; - n = (buffer[x->curpos + 32] + x->curpos + 34) & -2; + // p += 34 + (p[32] & -2); ? + p = buffer + 34 + ((p[32] + x->curpos) & -2); do { - int len = buffer[n + 2]; - switch (* (short *) (buffer + n)) { + int len = p[2]; + switch (* (short *) p) { case 0x4D4E: // NM - x->filename = buffer + n + 5; - endname = buffer + n + len; + x->filename = p + 5; + endname = p + len; break; case 0x5850: // PX - x->filemod = * (short *) (buffer + n + 4); + x->filemod = * (short *) (p + 4); break; } - n += len; + p += len; } - while (n + 2 < x->curpos + size); + while (buffer + x->curpos + size > p + 2); if (endname) *endname = 0; else #endif { - x->filename = buffer + x->curpos + 33; - switch (* (short *) (x->filename - 1)) { + p = x->filename = buffer + x->curpos + 33; + p--; + switch (* (short *) p) { case 0x0101: x->filename = dots; break; @@ -109,11 +113,12 @@ x->filename = dots + 1; break; default: - n = x->filename[-1]; - if (* (short *) (x->filename + n - 2) == 0x313B) - n -= 2; // remove ;1 - if (x->filename[n - 1] == '.') n--; - x->filename[n] = 0; + p += *p; p--; + if (* (short *) (p) != 0x313B) { + p++; p++; // no ;1 to remove + } + if (p[-1] == '.') p--; + *p = 0; } } x->curpos += size; @@ -124,7 +129,7 @@ int isoopen(char *filename) { int restart; - char *name, *s, c; + char *name, *s; int _64bits = cpuhaslm(); struct isostate *x=&isostate; @@ -136,16 +141,16 @@ } s = name; while (1) { + char c; while (*s && *s != '/') s++; c = *s; *s = 0; for (restart = 1; isoreaddir(restart) == 0; restart = 0) { - char *n = name, *i = x->filename; + const char *n = name, *i = x->filename; if (_64bits) { - int len = strlen(name); if (strhead(x->filename, name)) continue; n = "64"; - i += len; + i += strlen(name); } if (strcmp(n, i)) continue; if (IS_DIR(x->filemod)) { diff -r faf865f8822c -r 76087975885f linld/stuff/src/ISO9660.H --- a/linld/stuff/src/ISO9660.H Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/ISO9660.H Fri Jan 20 09:55:25 2017 +0100 @@ -8,14 +8,15 @@ char *filename; //private unsigned long dirofs, dirsize; - unsigned long curdirofs, curdirsize, curpos; + unsigned long curdirofs, curdirsize; + unsigned curpos; } isostate; #define isofd isostate.fd #define isofileofs isostate.fileofs #define isofilesize isostate.filesize #define isofilemod isostate.filemod #define isofilename isostate.filename -extern "C" int unsigned long isolseek(unsigned long offset); +extern "C" unsigned long isolseek(unsigned long offset); extern int isoreset(char *name); extern int isoopen(char *name); extern int isoreaddir(int restart); diff -r faf865f8822c -r 76087975885f linld/stuff/src/JUMP.ASM --- a/linld/stuff/src/JUMP.ASM Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/JUMP.ASM Fri Jan 20 09:55:25 2017 +0100 @@ -5,14 +5,17 @@ %crefref %noincl %nomacs + ifdef NO386 + p8086 + else p386 + endif group DGROUP _TEXT,_BSS assume cs:DGROUP,ds:DGROUP segment _BSS byte public use16 'BSS' - global _pm_high:byte global _pm:dword ends _BSS @@ -29,7 +32,7 @@ extrn dos_shutdown:near - pop ax ;caller return address + pop ax ; caller return address ifdef NO386 extrn _topseg:near call near _topseg @@ -40,15 +43,18 @@ endif pop cx ; ip pop dx ; cs + cli ; we start doing destructive things to DOS push es pop ss mov sp,0A000h push dx cx - extrn _rm_buf:word - mov si,[_rm_buf] + extrn _rm_size:word + mov si,offset _rm_size ; _rm_size, _pm_high, _rm_buf + lodsw + xchg ax,cx ; _rm_size + lodsb ; _pm_high + mov si,[si] ; _rm_buf xor di,di - extrn _rm_size:word - mov cx,[_rm_size] ;cld rep movsb @@ -58,7 +64,7 @@ mov ch,10h ; 4k rep movsb - cmp [_pm_high],cl ; load high ? + cmp al,cl ; load high ? jne isbzimage ; finish loading extrn @last_ditch$qv:near @@ -67,8 +73,13 @@ mov ax,[word _pm+2+2] ; get pm->fallback high word ; self move ;cld + ifdef NO386 + mov cx,9900h + push cx + else push 9900h ; 4096 bytes for cmdline ;push 9820h ; 512 bytes for cmdline + endif pop es ; min 2048 bytes for stack xor si,si ; A000 -9000 -0800(>movedend) xor di,di ; set ZF @@ -102,7 +113,13 @@ push bx ; src ofs= pm.fallback push dx push dx ; srcseg=0 - push 1 ; dst + ifdef NO386 + inc dx + push dx ; dst + dec dx + else + push 1 ; dst + endif push dx ; ofs=64k extrn _memcpy32:near call _memcpy32 @@ -119,7 +136,15 @@ cmp [word 1E8h],'SK' endif jne notelks + ifdef NO386 + mov cx,120h + push cx + mov cl,0h + push cx + else + push 120h push 100h + endif pop es xor si,si xor di,di @@ -128,8 +153,7 @@ movsw push es pop ss - push 120h - push 0 + push cx notelks: endif @@ -138,10 +162,12 @@ pop ds ;push ss ;pop es + ifndef NO386 push ss pop fs push ss pop gs + endif assume nothing assume cs:DGROUP diff -r faf865f8822c -r 76087975885f linld/stuff/src/LOAD.CPP --- a/linld/stuff/src/LOAD.CPP Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/LOAD.CPP Fri Jan 20 09:55:25 2017 +0100 @@ -91,8 +91,9 @@ u16 ext_mem_size; // 0002 extended memory size in Kb (from int 0x15 fn 0x88) u8 pad00[0x20-4]; // old-style cmdline (not used in LINLD (yet?)) - u16 cl_magic; // 0020 commandline magic number (=0xA33F) - u16 cl_ofs; // 0022 commandline offset + u32 cl_magic_ofs; + //u16 cl_magic; // 0020 commandline magic number (=0xA33F) + //u16 cl_ofs; // 0022 commandline offset u8 pad10[0x80-0x24]; // these two set by rm setup: u8 hd0_disk_par[16]; // 0080 hd0-disk-parameter from intvector 0x41 @@ -110,9 +111,9 @@ const u32 HdrS = 'H' + ('d'<<8) + (u32('r')<<16) + (u32('S')<<24); -u8* rm_buf; u16 rm_size; -u8 pm_high; +u8 pm_high; // @ = @rm_size + 2, see JUMP.ASM +u8* rm_buf; // @ = @rm_size + 3, see JUMP.ASM u32 base_himem = _1m+_64k; extern struct image_himem pm, initrd; @@ -128,24 +129,25 @@ static const char kernel_file_error[] = "Can't use kernel file"; char* load_kernel() { + struct image_himem *m = ± #ifdef NO386 - csip=((u32)(topseg()+0x20)<<16); + *((u16 *)&csip+1)=topseg()+0x20; #endif // Open kernel, read first kb, check it - pm.errmsg = kernel_file_error; - open_image(kernel_name, &pm); + m->errmsg = kernel_file_error; + open_image(kernel_name, m); char *version_string; { struct first1k_t *first1k; struct kernelparams_t *kernelparams; - first1k = (first1k_t*) (rm_buf = malloc_or_die(_32k)); - kernelparams = &first1k->params; + kernelparams = &(((first1k_t*) (rm_buf = malloc_or_die(_32k)))->params); +#define first1k ((first1k_t*)((u8 *)kernelparams-0x1F1)) { u16 rm_seek; // Do not use malloc below until heap_top adjustment (see <*>) - if (read(pm.fd, rm_buf, rm_seek=0x400) != 0x400) { + if (read(m->fd, rm_buf, rm_seek=0x400) != 0x400) { readfail: die(kernel_file_error); } @@ -154,22 +156,22 @@ #if 1 if(* (int *) &first1k->pad10[0x3F-0x24] == 0x3AE8) { lseekset(pm.fd,rm_seek=0x200); - csip=((u32)topseg()<<16)+0x0042; + csip+=0xFFE00042; } else #endif kernelparams->setup_sects=4; } - rm_size = 0x200*(kernelparams->setup_sects+1); // 0th sector is not counted there - if(rm_size>_32k || kernelparams->boot_flag != 0xAA55) + if((kernelparams->setup_sects)>=(_32k/512) || // 0th sector not counted + kernelparams->boot_flag != 0xAA55) die("It's not a kernel"); - heap_top = rm_buf+rm_size; // <*> + heap_top = rm_buf+(rm_size=0x200*(kernelparams->setup_sects+1)); // <*> // Read remaining rm loader { u16 cnt = rm_size-rm_seek; - if (read(pm.fd, rm_buf+rm_seek, cnt) != cnt) goto readfail; + if (read(m->fd, rm_buf+rm_seek, cnt) != cnt) goto readfail; } } @@ -215,8 +217,7 @@ goto cmd_line_ok; } } - first1k->cl_magic = 0xA33F; - first1k->cl_ofs = 0x8000; + first1k->cl_magic_ofs = 0x8000A33F; } cmd_line_ok: @@ -232,7 +233,7 @@ m->fallback = (u32((u16(_CS)+0x1FFF)&0xF000)<<4); m->size -= rm_size; m->chunk_size -= rm_size; - if(m->fallback+m->size > (((u32)topseg())<<4) || pm_high) { + if((u16)((m->fallback+m->size)>>4) > topseg() || pm_high) { m->fallback = base_himem; } @@ -245,20 +246,16 @@ void load_initrd() { struct image_himem *m = &initrd; + m->errmsg = "Can't use initrd file"; if (!initrd_name && !m->fd) return; - m->errmsg = "Can't use initrd file"; - if (!pm.errmsg) { -noinitrd: + + open_image(initrd_name, m); + + if ((m->fallback=(memtop()-m->size)&(~PAGE_MASK)) < pm.fallback+pm.size) { + close(m->fd); puts(m->errmsg); return; } - open_image(initrd_name, m); - - m->fallback = (memtop()-m->size) & (~PAGE_MASK); - if (m->fallback < pm.fallback + pm.size) { - close(m->fd); - goto noinitrd; - } load_image(m); struct kernelparams_t *kernelparams = &(((first1k_t*) rm_buf)->params); @@ -280,8 +277,6 @@ die("Loaded too close to 9000:0"); } - cli(); // we start doing destructive things to DOS - // Move rm loader & commandline to 0x90000, Jump to kernel rm code set_sregs_jump_seg_ofs(csip); } diff -r faf865f8822c -r 76087975885f linld/stuff/src/MEMCPY32.ASM --- a/linld/stuff/src/MEMCPY32.ASM Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/MEMCPY32.ASM Fri Jan 20 09:55:25 2017 +0100 @@ -5,7 +5,11 @@ %crefref %noincl %nomacs + ifdef NO386 + p8086 + else p386 + endif group DGROUP _TEXT,_DATA assume cs:DGROUP,ds:DGROUP @@ -50,7 +54,7 @@ inc ah ; set TF push ax popf - jmp small [dword bx+4*19h] + jmp [dword bx+4*19h] doiret: iret sssp: @@ -201,6 +205,7 @@ @@pmcopy: pop si js @@done16 + p386 pushad mov esi,[srcofs] mov edi,[dstofs] @@ -267,10 +272,12 @@ lgdt [oldGDTR] @@done: popad + p8086 @@done16: pop es ds popf ifndef NO386 + p386 leave else mov sp,bp diff -r faf865f8822c -r 76087975885f linld/stuff/src/MEMTOP.ASM --- a/linld/stuff/src/MEMTOP.ASM Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/MEMTOP.ASM Fri Jan 20 09:55:25 2017 +0100 @@ -5,7 +5,11 @@ %crefref %noincl %nomacs + ifdef NO386 + p8086 + else p386 + endif group DGROUP _TEXT,_DATA,_BSS assume cs:DGROUP,ds:DGROUP diff -r faf865f8822c -r 76087975885f linld/stuff/src/TAZBOOT.CPP --- a/linld/stuff/src/TAZBOOT.CPP Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/TAZBOOT.CPP Fri Jan 20 09:55:25 2017 +0100 @@ -16,10 +16,11 @@ static void next_chunk(struct image_himem *m) { + struct initrd_state *p = &initrd_state; m->chunk_size = 0; - if (m->state >= initrd_state.cnt) return; - lseekset(m->fd,initrd_state.ofs[m->state]); - m->chunk_size = initrd_state.size[m->state]; + if (m->state >= p->cnt) return; + lseekset(m->fd,p->ofs[m->state]); + m->chunk_size = p->size[m->state]; m->state++; } diff -r faf865f8822c -r 76087975885f linld/stuff/src/XMM.ASM --- a/linld/stuff/src/XMM.ASM Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/XMM.ASM Fri Jan 20 09:55:25 2017 +0100 @@ -5,7 +5,11 @@ %crefref %noincl %nomacs + ifdef NO386 + p8086 + else p386 + endif group DGROUP _TEXT,_BSS assume cs:DGROUP,ds:DGROUP @@ -39,7 +43,12 @@ global xmm_driver:near proc xmm_driver near + ifndef NO386 cmp [xmm_handler],0 + else + mov ax,[word xmm_handler] + or ax,[word xmm_handler+2] + endif jne @@gotit xchg ax,cx ; save cmd diff -r faf865f8822c -r 76087975885f linld/stuff/src/_BEG.ASM --- a/linld/stuff/src/_BEG.ASM Tue Jan 17 17:38:43 2017 +0200 +++ b/linld/stuff/src/_BEG.ASM Fri Jan 20 09:55:25 2017 +0100 @@ -5,7 +5,7 @@ %crefref %noincl %nomacs - p386 + p8086 group DGROUP _TEXT,_DATA,_BSS assume cs:DGROUP,ds:DGROUP @@ -31,8 +31,8 @@ ;*************************************************************** ; Check for oldies + pushf mov bh, 0F0h - pushf push bx ; < 286 : flags[12..15] are forced 1 popf ; = 286 : flags[12..15] are forced 0 pushf ; > 286 : only flags[15] is forced 0 @@ -45,6 +45,7 @@ else js endcpu endif + p386 ; Check for vm smsw ax ;SMSW cannot be trapped! :-) and al,1 ;MSW_PE @@ -102,6 +103,7 @@ mov bx,offset msg_badmapping jz endcpu no_vcpi: + p8086 ;;pop dx ;$ handle ;;mov ax,4500h ; DEALLOCATE PAGES ;;int 67h @@ -110,10 +112,12 @@ jmp near die check_rm_paging: ; It's a 386 in real mode, chk for paging (crazy but possible) + p386 mov edx,cr0 shl edx,1 ;CR0_PG to CF jc no_vcpi endcpu: + p8086 ;*************************************************************** ; build argv & argc