Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struc TSS32
- {
- .PreviousTaskLink dw ?
- .Reserved0 dw ? ;--4
- .ESP0 dd ?
- .SS0 dw ?
- .Reserved1 dw ? ;--12
- .ESP1 dd ?
- .SS1 dw ?
- .Reserved2 dw ? ; 20
- .ESP2 dd ?
- .SS2 dw ?
- .Reserved3 dw ? ; 28
- .tsCR3 dd ?
- .tsEIP dd ? ; 36
- .tsEFLAGS dd ?
- .tsEAX dd ? ; 44
- .tsECX dd ?
- .tsEDX dd ? ; 52
- .tsEBX dd ?
- .tsESP dd ? ; 60
- .tsEBP dd ?
- .tsESI dd ?
- .tsEDI dd ? ; 72
- .tsES dw ?
- .Reserved4 dw ? ; 76
- .tsCS dw ?
- .Reserved5 dw ?
- .tsSS dw ?
- .Reserved6 dw ?
- .tsDS dw ?
- .Reserved7 dw ?
- .tsFS dw ?
- .Reserved8 dw ?
- .tsGS dw ?
- .Reserved9 dw ?
- .LDTSegmentSelector dw ?
- .Reserved10 dw ?
- .DebugByte db ?
- .Reserved11 db ?
- .IOMapBaseAddress dw ?
- }
- struc TSS {
- .limit dw 0x100
- .adrlow dw ?
- .adrcenter db ?
- .conffield1 db ?
- .conffield2 db ?
- .adrhigh db ?
- }
- TSS_ExitProcess TSS32
- mov edx,TSS_ExitProcess
- mov byte [Ext.conffield1],10001001b
- mov word [Ext.adrlow],dx
- shr edx,16
- mov byte [Ext.adrcenter],dl
- mov byte [Ext.conffield2],10000000b
- shr dx,8
- mov byte [Ext.adrhigh],dl
- GDT:
- rq 1
- KCSD db 0xff,0xff,0x00,0x00,0x00,10011010b,11001111b,0x00
- KDATD db 0xff,0xff,0x00,0x00,0x00,10010010b,11000000b,0x00
- UCSD db 0xff,0xff,0x00,0x00,0x00,11111010b,11001111b,0x00
- UDATD db 0xff,0xff,0x00,0x00,0x00,11110010b,11001111b,0x00
- kernel_manager TSS
- UPROCESS1 TSS
- UPROCESS2 TSS
- UPROCESS3 TSS
- VIDEO db 0xff,0xff,0x00,0x80,0x0b,10010010b,00001111b,0x00
- Ext TSS
- len_GDT equ $ - GDT
- IDT:
- rq 0x30
- timer db 0x00,0x00,0x28,0x00,0x00,10000101b,0x00,0x00 ; IRQ 30
- keyboard db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 31
- slave_PIC db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 32
- com24 db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 33
- com13 db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 34
- LPT2 db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 35
- controller_floppy db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 36
- LPT1 db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 37
- real_timer db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 38
- any_device db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 39
- any_device2 db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 3a
- any_device3 db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 3b
- any_device4 db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 3c
- error_fpu_operation db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 3d
- any_device5 db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 3e
- any_device6 db 0x00,0x00,0x08,0x00,0x00,10001110b,0x00,0x00 ; IRQ 3f
- Hgui db 0x00,0x00,0x08,0x00,0x00,11101110b,0x00,0x00 ; IRQ 40
- IExitProcess db 0x00,0x50,0x00,0x00,0x00,10000101b,0x00,0x00 ; IRQ 41
- IDTlen equ $ - IDT
- ExitProcess:
- mov dx,[ebx]
- movzx edx,dx
- add edx,GDT
- bts word [edi+6],12 ; .conffield2
- iretd
- jmp near ExitProcess
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement