Rev 1304 | Rev 1310 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1304 | Rev 1306 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | ;; |
55 | ;; |
56 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
56 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 57... | Line 57... | ||
57 | 57 | ||
Line 58... | Line 58... | ||
58 | include 'macros.inc' |
58 | include 'macros.inc' |
Line 59... | Line 59... | ||
59 | 59 | ||
Line 60... | Line 60... | ||
60 | $Revision: 1304 $ |
60 | $Revision: 1306 $ |
Line 4013... | Line 4013... | ||
4013 | mov [esp+32], edx ; eax |
4013 | mov [esp+32], edx ; eax |
4014 | ret |
4014 | ret |
Line 4015... | Line 4015... | ||
4015 | 4015 | ||
4016 | - | ||
4017 | set_io_access_rights: |
4016 | |
4018 | - | ||
4019 | pushad |
4017 | set_io_access_rights: |
4020 | - | ||
4021 | mov edi, tss._io_map_0 |
4018 | push edi eax |
4022 | 4019 | mov edi, tss._io_map_0 |
|
4023 | ; mov ecx,eax |
- | |
4024 | ; and ecx,7 ; offset in byte |
4020 | ; mov ecx,eax |
4025 | 4021 | ; and ecx,7 ; offset in byte |
|
4026 | ; shr eax,3 ; number of byte |
- | |
4027 | ; add edi,eax |
4022 | ; shr eax,3 ; number of byte |
4028 | 4023 | ; add edi,eax |
|
4029 | ; mov ebx,1 |
- | |
4030 | ; shl ebx,cl |
4024 | ; mov ebx,1 |
4031 | 4025 | ; shl ebx,cl |
|
4032 | test ebp,ebp |
4026 | test ebp,ebp |
4033 | ; cmp ebp,0 ; enable access - ebp = 0 |
- | |
4034 | jnz siar1 |
4027 | ; cmp ebp,0 ; enable access - ebp = 0 |
4035 | 4028 | jnz siar1 |
|
4036 | ; not ebx |
4029 | ; not ebx |
4037 | ; and [edi],byte bl |
- | |
4038 | btr [edi], eax |
4030 | ; and [edi],byte bl |
4039 | - | ||
4040 | popad |
4031 | btr [edi], eax |
4041 | - | ||
4042 | ret |
4032 | pop eax edi |
4043 | - | ||
4044 | siar1: |
4033 | ret |
4045 | 4034 | siar1: |
|
4046 | bts [edi], eax |
- | |
4047 | ; or [edi],byte bl ; disable access - ebp = 1 |
4035 | bts [edi], eax |
4048 | - | ||
4049 | popad |
4036 | ; or [edi],byte bl ; disable access - ebp = 1 |
- | 4037 | pop eax edi |
|
- | 4038 | ret |
|
- | 4039 | ;reserve/free group of ports |
|
- | 4040 | ; * eax = 46 - number function |
|
- | 4041 | ; * ebx = 0 - reserve, 1 - free |
|
4050 | 4042 | ; * ecx = number start arrea of ports |
|
- | 4043 | ; * edx = number end arrea of ports (include last number of port) |
|
- | 4044 | ;Return value: |
|
- | 4045 | ; * eax = 0 - succesful |
|
- | 4046 | ; * eax = 1 - error |
|
- | 4047 | ; * The system has reserve this ports: |
|
4051 | ret |
4048 | ; 0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (include last number of port). |
Line 4052... | Line 4049... | ||
4052 | 4049 | ;destroys eax,ebx, ebp |
|
4053 | r_f_port_area: |
4050 | r_f_port_area: |
4054 | 4051 | ||
4055 | test eax, eax |
4052 | test ebx, ebx |
Line 4056... | Line 4053... | ||
4056 | jnz free_port_area |
4053 | jnz free_port_area |
Line 4057... | Line 4054... | ||
4057 | ; je r_port_area |
4054 | ; je r_port_area |
Line 4058... | Line 4055... | ||
4058 | ; jmp free_port_area |
4055 | ; jmp free_port_area |
4059 | 4056 | ||
4060 | ; r_port_area: |
4057 | ; r_port_area: |
4061 | 4058 | ||
4062 | pushad |
4059 | ; pushad |
4063 | 4060 | ||
4064 | cmp ebx,ecx ; beginning > end ? |
4061 | cmp ecx,edx ; beginning > end ? |
4065 | ja rpal1 |
4062 | ja rpal1 |
4066 | cmp ecx,65536 |
4063 | cmp edx,65536 |
4067 | jae rpal1 |
4064 | jae rpal1 |
4068 | mov esi,[RESERVED_PORTS] |
4065 | mov eax,[RESERVED_PORTS] |
4069 | test esi,esi ; no reserved areas ? |
4066 | test eax,eax ; no reserved areas ? |
4070 | je rpal2 |
4067 | je rpal2 |
4071 | cmp esi,255 ; max reserved |
4068 | cmp eax,255 ; max reserved |
4072 | jae rpal1 |
4069 | jae rpal1 |
4073 | rpal3: |
4070 | rpal3: |
4074 | mov edi,esi |
4071 | mov ebx,eax |
4075 | shl edi,4 |
4072 | shl ebx,4 |
4076 | add edi,RESERVED_PORTS |
4073 | add ebx,RESERVED_PORTS |
4077 | cmp ebx,[edi+8] |
4074 | cmp ecx,[ebx+8] |
4078 | ja rpal4 |
- | |
4079 | cmp ecx,[edi+4] |
4075 | ja rpal4 |
4080 | jae rpal1 |
4076 | cmp edx,[ebx+4] |
4081 | ; jb rpal4 |
4077 | jae rpal1 |
4082 | ; jmp rpal1 |
4078 | ; jb rpal4 |
4083 | rpal4: |
4079 | ; jmp rpal1 |
4084 | 4080 | rpal4: |
|
- | 4081 | dec eax |
|
- | 4082 | jnz rpal3 |
|
4085 | dec esi |
4083 | jmp rpal2 |
4086 | jnz rpal3 |
- | |
4087 | jmp rpal2 |
4084 | rpal1: |
4088 | rpal1: |
4085 | ; popad |
4089 | popad |
- | |
4090 | mov eax,1 |
- | |
4091 | ret |
4086 | ; mov eax,1 |
4092 | 4087 | xor eax,eax |
|
4093 | rpal2: |
4088 | inc eax |
Line 4094... | Line 4089... | ||
4094 | popad |
4089 | ret |
4095 | 4090 | rpal2: |
|
4096 | - | ||
4097 | ; enable port access at port IO map |
4091 | ; popad |
4098 | cli |
- | |
4099 | pushad ; start enable io map |
- | |
4100 | - | ||
4101 | cmp ecx,65536 ;16384 |
4092 | ; enable port access at port IO map |
4102 | jae no_unmask_io ; jge |
- | |
4103 | 4093 | cli |
|
- | 4094 | pushad ; start enable io map |
|
- | 4095 | ||
4104 | mov eax,ebx |
4096 | cmp edx,65536 ;16384 |
4105 | - | ||
4106 | new_port_access: |
4097 | jae no_unmask_io ; jge |
4107 | - | ||
4108 | pushad |
4098 | mov eax,ecx |
4109 | 4099 | ; push ebp |
|
4110 | xor ebp,ebp ; enable - eax = port |
4100 | xor ebp,ebp ; enable - eax = port |
4111 | call set_io_access_rights |
4101 | new_port_access: |
4112 | 4102 | ; pushad |
|
4113 | popad |
- | |
4114 | 4103 | call set_io_access_rights |
|
4115 | inc eax |
4104 | ; popad |
Line 4116... | Line 4105... | ||
4116 | cmp eax,ecx |
4105 | inc eax |
4117 | jbe new_port_access |
4106 | cmp eax,edx |
4118 | 4107 | jbe new_port_access |
|
4119 | no_unmask_io: |
4108 | ; pop ebp |
4120 | 4109 | no_unmask_io: |
|
4121 | popad ; end enable io map |
4110 | popad ; end enable io map |
4122 | sti |
4111 | sti |
4123 | 4112 | ||
4124 | mov edi,[RESERVED_PORTS] |
4113 | mov eax,[RESERVED_PORTS] |
4125 | add edi,1 |
4114 | add eax,1 |
Line 4126... | Line 4115... | ||
4126 | mov [RESERVED_PORTS],edi |
4115 | mov [RESERVED_PORTS],eax |
4127 | shl edi,4 |
4116 | shl eax,4 |
Line 4128... | Line 4117... | ||
4128 | add edi,RESERVED_PORTS |
4117 | add eax,RESERVED_PORTS |
Line 4129... | Line 4118... | ||
4129 | mov esi,[TASK_BASE] |
4118 | mov ebx,[TASK_BASE] |
4130 | mov esi,[esi+TASKDATA.pid] |
- | |
4131 | mov [edi],esi |
4119 | mov ebx,[ebx+TASKDATA.pid] |
4132 | mov [edi+4],ebx |
4120 | mov [eax],ebx |
4133 | mov [edi+8],ecx |
4121 | mov [eax+4],ecx |
4134 | 4122 | mov [eax+8],edx |
|
4135 | xor eax, eax |
4123 | |
4136 | ret |
4124 | xor eax, eax |
4137 | 4125 | ret |
|
4138 | free_port_area: |
4126 | |
4139 | 4127 | free_port_area: |
|
4140 | pushad |
4128 | |
4141 | 4129 | ; pushad |
|
4142 | mov esi,[RESERVED_PORTS] ; no reserved areas ? |
4130 | mov eax,[RESERVED_PORTS] ; no reserved areas ? |
4143 | test esi,esi |
4131 | test eax,eax |
4144 | je frpal2 |
4132 | jz frpal2 |
4145 | mov edx,[TASK_BASE] |
4133 | mov ebx,[TASK_BASE] |
4146 | mov edx,[edx+TASKDATA.pid] |
4134 | mov ebx,[ebx+TASKDATA.pid] |
4147 | frpal3: |
4135 | frpal3: |
4148 | mov edi,esi |
4136 | mov edi,eax |
4149 | shl edi,4 |
4137 | shl edi,4 |
4150 | add edi,RESERVED_PORTS |
4138 | add edi,RESERVED_PORTS |
4151 | cmp edx,[edi] |
4139 | cmp ebx,[edi] |
4152 | jne frpal4 |
4140 | jne frpal4 |
4153 | cmp ebx,[edi+4] |
4141 | cmp ecx,[edi+4] |
4154 | jne frpal4 |
4142 | jne frpal4 |
- | 4143 | cmp edx,[edi+8] |
|
4155 | cmp ecx,[edi+8] |
4144 | jne frpal4 |
4156 | jne frpal4 |
4145 | jmp frpal1 |
4157 | jmp frpal1 |
4146 | frpal4: |
4158 | frpal4: |
4147 | dec eax |
4159 | dec esi |
4148 | jnz frpal3 |
4160 | jnz frpal3 |
4149 | frpal2: |
4161 | frpal2: |
4150 | ; popad |
Line 4162... | Line 4151... | ||
4162 | popad |
4151 | inc eax |
4163 | mov eax,1 |
- | |
4164 | ret |
4152 | ret |
4165 | frpal1: |
- | |
4166 | mov ecx,256 |
- | |
4167 | sub ecx,esi |
4153 | frpal1: |
Line 4168... | Line 4154... | ||
4168 | shl ecx,4 |
4154 | push ecx |
4169 | mov esi,edi |
- | |
- | 4155 | mov ecx,256 |
|
4170 | add esi,16 |
4156 | sub ecx,eax |
4171 | cld |
4157 | shl ecx,4 |
Line 4172... | Line 4158... | ||
4172 | rep movsb |
4158 | mov esi,edi |
- | 4159 | add esi,16 |
|
4173 | 4160 | cld |
|
4174 | dec dword [RESERVED_PORTS] |
4161 | rep movsb |
4175 | - | ||
4176 | popad |
4162 | |
4177 | - | ||
4178 | 4163 | dec dword [RESERVED_PORTS] |
|
4179 | ; disable port access at port IO map |
4164 | ;popad |
4180 | - | ||
4181 | pushad ; start disable io map |
4165 | ;disable port access at port IO map |
4182 | - | ||
4183 | cmp ecx,65536 ;16384 |
4166 | |
4184 | jge no_mask_io |
4167 | ; pushad ; start disable io map |
4185 | 4168 | pop eax ;start port |
|
4186 | mov eax,ebx |
- | |
4187 | 4169 | cmp edx,65536 ;16384 |
|
4188 | new_port_access_disable: |
- | |
4189 | 4170 | jge no_mask_io |
|
4190 | pushad |
- | |
4191 | 4171 | ||
4192 | mov ebp,1 ; disable - eax = port |
4172 | ; mov eax,ecx |
Line 4193... | Line 4173... | ||
4193 | call set_io_access_rights |
4173 | xor ebp,ebp |
Line 5379... | Line 5359... | ||
5379 | align 4 |
5359 | align 4 |
Line 5380... | Line 5360... | ||
5380 | 5360 | ||
Line 5381... | Line 5361... | ||
5381 | syscall_reserveportarea: ; ReservePortArea and FreePortArea |
5361 | syscall_reserveportarea: ; ReservePortArea and FreePortArea |
5382 | 5362 | ||
5383 | call r_f_port_area |
5363 | call r_f_port_area |
Line 5384... | Line 5364... | ||
5384 | mov [esp+36],eax |
5364 | mov [esp+32],eax |
Line 5385... | Line 5365... | ||
5385 | ret |
5365 | ret |