Rev 709 | Rev 724 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 709 | Rev 712 | ||
---|---|---|---|
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 4000h |
50 | push 8000h ;page block less 8Kb 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 77... | Line 77... | ||
77 | add edi, (OS_BASE shr 20) - 4 |
77 | add edi, (OS_BASE shr 20) - 4 |
78 | push esi |
78 | push esi |
79 | mov esi, (OS_BASE shr 20) + sys_pgdir |
79 | mov esi, (OS_BASE shr 20) + sys_pgdir |
80 | mov ecx, 0x80000000 shr 22 |
80 | mov ecx, 0x80000000 shr 22 |
81 | rep movsd |
81 | rep movsd |
- | 82 | ||
- | 83 | mov eax, [ebx+V86_machine.pagedir] ;root dir also is |
|
- | 84 | call get_pg_addr ;used as page table |
|
- | 85 | or al, PG_SW |
|
- | 86 | mov [edi-4096+(page_tabs shr 20)], eax |
|
- | 87 | ||
82 | pop esi |
88 | pop esi |
83 | ; now V86 specific: initialize known addresses in first Mb |
89 | ; now V86 specific: initialize known addresses in first Mb |
84 | pop eax edi |
90 | pop eax edi |
85 | ; first page - BIOS data (shared between all machines!) |
91 | ; first page - BIOS data (shared between all machines!) |
86 | ; physical address = 0x2f0000 |
92 | ; physical address = 0x2f0000 |
Line 162... | Line 168... | ||
162 | ; Allocate memory in V86 machine |
168 | ; Allocate memory in V86 machine |
163 | ; in: eax=size (in bytes) |
169 | ; in: eax=size (in bytes) |
164 | ; esi=handle |
170 | ; esi=handle |
165 | ; out: eax=V86 address, para-aligned (0x10 multiple) |
171 | ; out: eax=V86 address, para-aligned (0x10 multiple) |
166 | ; destroys: nothing |
172 | ; destroys: nothing |
167 | ; ¥¤®¯¨á !!! |
173 | ; ᠭ!!! |
168 | ;v86_alloc: |
174 | ;v86_alloc: |
169 | ; push ebx ecx edx edi |
175 | ; push ebx ecx edx edi |
170 | ; lea ebx, [esi+V86_machine.mutex] |
176 | ; lea ebx, [esi+V86_machine.mutex] |
171 | ; call wait_mutex |
177 | ; call wait_mutex |
172 | ; add eax, 0x1F |
178 | ; add eax, 0x1F |
Line 382... | Line 388... | ||
382 | ; 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 |
383 | cmp word [esp+v86_regs.eip+2], 0 |
389 | cmp word [esp+v86_regs.eip+2], 0 |
384 | jnz .nogp |
390 | jnz .nogp |
385 | ; Otherwise we can safely access byte at CS:IP |
391 | ; Otherwise we can safely access byte at CS:IP |
386 | ; (because it is #GP, not #PF handler) |
392 | ; (because it is #GP, not #PF handler) |
387 | ; ᫨ ¡ë ¬ë ¬®£«¨ áå«®¯®â âì ¨áª«î票¥ ⮫쪮 ¨§-§ çâ¥¨ï ¡ ©â®¢ ª®¤ , |
393 | ; 嫮 ᪫祭 ⮫쪮 - ⥭ ⮢ , |
388 | ; ¬ë ¡ë ¥£® 㦥 áå«®¯®â «¨ ¨ íâ® ¡ë«® ¡ë ¥ #GP |
394 | ; 㦥 嫮⠫ 뫮 #GP |
389 | movzx esi, word [esp+v86_regs.cs] |
395 | movzx esi, word [esp+v86_regs.cs] |
390 | shl esi, 4 |
396 | shl esi, 4 |
391 | add esi, [esp+v86_regs.eip] |
397 | add esi, [esp+v86_regs.eip] |
392 | lodsb |
398 | lodsb |
393 | cmp al, 0xCD ; int xx command = CD xx |
399 | cmp al, 0xCD ; int xx command = CD xx |