Rev 6 | Rev 40 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6 | Rev 15 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; SYSTEM CALL ENTRY ;; |
3 | ;; SYSTEM CALL ENTRY ;; |
4 | ;; ;; |
4 | ;; ;; |
5 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
5 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | uglobal |
- | |
7 | pushed_regs rd 1 |
- | |
8 | endg |
- | |
Line 9... | Line 6... | ||
9 | 6 | ||
10 | align 32 |
7 | align 32 |
- | 8 | i40: |
|
11 | i40: |
9 | push ds es |
Line 12... | Line -... | ||
12 | pushad |
- | |
13 | 10 | pushad |
|
14 | push ds |
11 | |
15 | mov ax,word os_data |
12 | mov ax,word os_data |
16 | mov ds,ax |
- | |
17 | mov es,ax |
- | |
18 | mov [pushed_regs],esp |
- | |
19 | add dword [pushed_regs],4 |
- | |
20 | cli |
- | |
21 | - | ||
22 | mov eax, [0x3000] |
- | |
23 | mov edi, eax |
- | |
Line 24... | Line 13... | ||
24 | shl edi, 8 |
13 | mov ds,ax |
25 | mov [edi+0x80000+0xB0],eax ; used i40 handler |
14 | mov es,ax |
Line 26... | Line -... | ||
26 | - | ||
27 | ; for syscall trace function |
- | |
28 | call save_registers |
15 | |
29 | - | ||
30 | mov esi,[pushed_regs] |
- | |
31 | - | ||
32 | ; load first 3 registers |
- | |
33 | mov eax,[esi+28] |
- | |
34 | mov ebx,[esi+16] |
- | |
35 | mov ecx,[esi+24] |
- | |
36 | - | ||
37 | ; save current registers |
- | |
38 | ; stack may be modified by a system function to return some value to caller! |
16 | ; for syscall trace function |
39 | pushad |
17 | call save_registers |
40 | 18 | ||
41 | ; load all registers from TSS of the application, in crossed order (why?) |
19 | ; load all registers in crossed order |
42 | mov edi,[esi+28] |
20 | mov edi,[esp+28] ; eax |
43 | mov eax,[esi+16] |
21 | mov eax,[esp+16] ; ebx |
Line 44... | Line 22... | ||
44 | mov ebx,[esi+24] |
22 | mov ebx,[esp+24] ; ecx |
45 | mov ecx,[esi+20] |
23 | mov ecx,[esp+20] ; edx |
46 | mov edx,[esi+4] |
- | |
47 | mov esi,[esi+0] |
24 | mov edx,[esp+4] ; esi |
48 | 25 | mov esi,[esp+0] ; edi |
|
49 | ; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler |
26 | |
50 | sti |
27 | ; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler |
51 | ; eax doesn't need to be saved, but... |
28 | sti |
Line 52... | Line -... | ||
52 | push eax |
- | |
53 | and edi,0xff |
- | |
54 | call dword [servetable+edi*4] |
- | |
55 | pop eax |
- | |
56 | cli |
- | |
57 | - | ||
58 | ; return saved and probably even changed regs |
- | |
59 | popad |
- | |
60 | - | ||
61 | ; modify 3 program's registers (in its TSS) |
- | |
62 | mov [esi+28],eax |
- | |
63 | mov [esi+16],ebx |
- | |
64 | mov [esi+24],ecx |
- | |
65 | - | ||
66 | xor eax, eax |
- | |
67 | mov edi, [0x3000] ; no syscall interrupt in use anymore |
- | |
68 | shl edi, 8 |
- | |
69 | mov [edi+0x80000+0xB0],eax |
29 | push eax |
- | 30 | and edi,0xff |
|
70 | 31 | call dword [servetable+edi*4] |
|
Line 71... | Line 32... | ||
71 | pop eax |
32 | pop eax |
72 | mov ds,ax |
33 | cli |
73 | mov es,ax |
34 | |
74 | 35 | popad |
|
75 | popad |
36 | pop es ds |
76 | iretd |
37 | iretd |
77 | 38 | ||
78 | align 4 |
39 | align 4 |
79 | save_registers: |
40 | save_registers: |
80 | mov esi, [0x3010] |
41 | mov esi, [0x3010] |