OSDev.org
https://forum.osdev.org/

How to fetch data from TSS?
https://forum.osdev.org/viewtopic.php?f=1&t=23161
Page 1 of 1

Author:  leetow2003 [ Thu Feb 17, 2011 8:29 pm ]
Post subject:  How to fetch data from TSS?

I want to fetch data from TSS,
first I define TSS in GDT:
dseg segment use16
gdt label byte
dummy descriptor <>
demotss descriptor <104,,,89h,>
demotss_sel =demotss-gdt
....
dseg ends

then I define the TSS segment:
DEMOTSSSEG SEGMENT PARA USE16
DW ?,0
DD ?
DW ?,0
DD ?
DW ?,0
DD ?
DW ?,0
DD 0 ;CR3
DD ? ;EIP
DW ?,? ;eflag
DD ? ;eax
DD ? ;ecx
DD ? ;edx
DD ? ;ebx
DD ? ;esp
DD ? ;ebp
DD ? ;esi
DD ? ;edi
DW ?, 0 ;es
DW ?, 0 ;cs
DW ?, 0 ;ss
DW ?, 0 ;ds
DW ?, 0 ;fs
DW ?, 0 ;gs
DW ?, 0
DW 0
DW $ + 2
DB 0FFH
DEMOTSSSEG ENDS

and then I initialize it:
mov bx,16
mov ax,DEMOTSSSEG
mul bx
mov demotss.basel,ax
mov demotss.basem,dl
mov demotss.baseh,dh

at last in p-mode:
mov ax,demotss_sel
LTR ax
mov ax,demotss_sel
mov ds,ax ;===error
mov ax,[2]
but I find when I add the instruction:mov ds,ax
the PC always restart,why?How to correct it?

Author:  Hangin10 [ Thu Feb 17, 2011 10:40 pm ]
Post subject:  Re: How to fetch data from TSS?

Simple, the TSS is not a data segment. Put a label before the TSS data and use that.

Author:  leetow2003 [ Thu Feb 17, 2011 11:07 pm ]
Post subject:  Re: How to fetch data from TSS?

Hangin10 wrote:
Simple, the TSS is not a data segment. Put a label before the TSS data and use that.

Could you give an example?Thank you very much.

Author:  thepowersgang [ Thu Feb 17, 2011 11:14 pm ]
Post subject:  Re: How to fetch data from TSS?

no, we cannot give an example. If you do not know how to put a label at a location, you have bigger problems.

Also, please use code tags when posting source code to the forums.

Author:  leetow2003 [ Fri Feb 18, 2011 2:30 am ]
Post subject:  Re: How to fetch data from TSS?

thepowersgang wrote:
no, we cannot give an example. If you do not know how to put a label at a location, you have bigger problems.

Also, please use code tags when posting source code to the forums.

Code:
DEMOTSSSEG SEGMENT PARA USE16
var1 DW ?,0
var2 DD ?
etc
DEMOTSSSEG ENDS

but I don't how to use it,could you tell me?

Author:  rdos [ Fri Feb 18, 2011 2:43 am ]
Post subject:  Re: How to fetch data from TSS?

When I create a TSS selector, I also create an alias with the same base & size. When I need to access the TSS, I use the alias. Both the TSS and the alias are kept in the thread-control block. If you are using a flat memory model, you can just save the base of the TSS, and access it through the base instead.

Author:  leetow2003 [ Fri Feb 18, 2011 3:40 am ]
Post subject:  Re: How to fetch data from TSS?

rdos wrote:
When I create a TSS selector, I also create an alias with the same base & size. When I need to access the TSS, I use the alias. Both the TSS and the alias are kept in the thread-control block. If you are using a flat memory model, you can just save the base of the TSS, and access it through the base instead.

Could you describe in detail?How to create an alias?and how to access tss?
Could you write some codes?thanks

Author:  davidv1992 [ Fri Feb 18, 2011 7:30 am ]
Post subject:  Re: How to fetch data from TSS?

Please read the required knowledge page on the wiki.

Author:  Combuster [ Fri Feb 18, 2011 9:15 am ]
Post subject:  Re: How to fetch data from TSS?

Agreed. I've checked your posting history and it shows repeated lack of basic programming experience, and repeated ignorance of the other rules. Please come back after you have spent a few years learning to solve (simple) problems and you know to read documents. In your current state you won't be able to manage more than poking around existing code.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/