Rev 712 | Rev 750 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 712 | Rev 724 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | ; First is main page directory for V86 mode. |
45 | ; First is main page directory for V86 mode. |
46 | ; Second page: |
46 | ; Second page: |
47 | ; first half (0x800 bytes) is page table for addresses 0 - 0x100000, |
47 | ; first half (0x800 bytes) is page table for addresses 0 - 0x100000, |
48 | ; second half is for V86-to-linear translation. |
48 | ; second half is for V86-to-linear translation. |
49 | ; Third and fourth are for I/O permission map. |
49 | ; Third and fourth are for I/O permission map. |
50 | push 8000h ;page block less 8Kb are discontinuous |
50 | push 8000h ; blocks less than 8 pages are discontinuous |
51 | call kernel_alloc |
51 | call kernel_alloc |
52 | test eax, eax |
52 | test eax, eax |
53 | jz .fail2 |
53 | jz .fail2 |
54 | mov [ebx+V86_machine.pagedir], eax |
54 | mov [ebx+V86_machine.pagedir], eax |
55 | push edi eax |
55 | push edi eax |
Line 168... | Line 168... | ||
168 | ; Allocate memory in V86 machine |
168 | ; Allocate memory in V86 machine |
169 | ; in: eax=size (in bytes) |
169 | ; in: eax=size (in bytes) |
170 | ; esi=handle |
170 | ; esi=handle |
171 | ; out: eax=V86 address, para-aligned (0x10 multiple) |
171 | ; out: eax=V86 address, para-aligned (0x10 multiple) |
172 | ; destroys: nothing |
172 | ; destroys: nothing |
173 | ; ᠭ!!! |
173 | ; ¥¤®¯¨á !!! |
174 | ;v86_alloc: |
174 | ;v86_alloc: |
175 | ; push ebx ecx edx edi |
175 | ; push ebx ecx edx edi |
176 | ; lea ebx, [esi+V86_machine.mutex] |
176 | ; lea ebx, [esi+V86_machine.mutex] |
177 | ; call wait_mutex |
177 | ; call wait_mutex |
178 | ; add eax, 0x1F |
178 | ; add eax, 0x1F |
Line 388... | Line 388... | ||
388 | ; If faulted EIP exceeds 0xFFFF, we have #GP and it is an error |
388 | ; If faulted EIP exceeds 0xFFFF, we have #GP and it is an error |
389 | cmp word [esp+v86_regs.eip+2], 0 |
389 | cmp word [esp+v86_regs.eip+2], 0 |
390 | jnz .nogp |
390 | jnz .nogp |
391 | ; Otherwise we can safely access byte at CS:IP |
391 | ; Otherwise we can safely access byte at CS:IP |
392 | ; (because it is #GP, not #PF handler) |
392 | ; (because it is #GP, not #PF handler) |
393 | ; 嫮 ᪫祭 ⮫쪮 - ⥭ ⮢ , |
393 | ; ᫨ ¡ë ¬ë ¬®£«¨ áå«®¯®â âì ¨áª«î票¥ ⮫쪮 ¨§-§ çâ¥¨ï ¡ ©â®¢ ª®¤ , |
394 | ; 㦥 嫮⠫ 뫮 #GP |
394 | ; ¬ë ¡ë ¥£® 㦥 áå«®¯®â «¨ ¨ íâ® ¡ë«® ¡ë ¥ #GP |
395 | movzx esi, word [esp+v86_regs.cs] |
395 | movzx esi, word [esp+v86_regs.cs] |
396 | shl esi, 4 |
396 | shl esi, 4 |
397 | add esi, [esp+v86_regs.eip] |
397 | add esi, [esp+v86_regs.eip] |
398 | lodsb |
398 | lodsb |
399 | cmp al, 0xCD ; int xx command = CD xx |
399 | cmp al, 0xCD ; int xx command = CD xx |
Line 796... | Line 796... | ||
796 | cmp [SLOT_BASE+ecx+APPDATA.dir_table], eax |
796 | cmp [SLOT_BASE+ecx+APPDATA.dir_table], eax |
797 | jnz .notcurrent |
797 | jnz .notcurrent |
798 | lea eax, [edi+8] |
798 | lea eax, [edi+8] |
799 | cmp al, 10h |
799 | cmp al, 10h |
800 | jb @f |
800 | jb @f |
801 | add al, 70h-8 |
801 | add al, 60h |
802 | @@: |
802 | @@: |
803 | jmp v86_exc_c.simulate_int |
803 | jmp v86_exc_c.simulate_int |
804 | .notcurrent: |
804 | .notcurrent: |
805 | mov ebx, SLOT_BASE + 0x100 |
805 | mov ebx, SLOT_BASE + 0x100 |
806 | mov ecx, [TASK_COUNT] |
806 | mov ecx, [TASK_COUNT] |
Line 852... | Line 852... | ||
852 | mov ecx, [esi-v86_regs.size+v86_regs.eflags] |
852 | mov ecx, [esi-v86_regs.size+v86_regs.eflags] |
853 | mov word [edx+4], cx |
853 | mov word [edx+4], cx |
854 | lea eax, [edi+8] |
854 | lea eax, [edi+8] |
855 | cmp al, 10h |
855 | cmp al, 10h |
856 | jb @f |
856 | jb @f |
857 | add al, 70h-8 |
857 | add al, 60h |
858 | @@: |
858 | @@: |
859 | mov cx, [eax*4] |
859 | mov cx, [eax*4] |
860 | mov word [esi-v86_regs.size+v86_regs.eip], cx |
860 | mov word [esi-v86_regs.size+v86_regs.eip], cx |
861 | mov cx, [eax*4+2] |
861 | mov cx, [eax*4+2] |
862 | mov word [esi-v86_regs.size+v86_regs.cs], cx |
862 | mov word [esi-v86_regs.size+v86_regs.cs], cx |