OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 1:08 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: How to fetch data from TSS?
PostPosted: Thu Feb 17, 2011 8:29 pm 
Offline
Member
Member

Joined: Fri Nov 19, 2010 6:54 pm
Posts: 70
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?


Top
 Profile  
 
 Post subject: Re: How to fetch data from TSS?
PostPosted: Thu Feb 17, 2011 10:40 pm 
Offline
Member
Member

Joined: Wed Feb 27, 2008 12:40 am
Posts: 162
Simple, the TSS is not a data segment. Put a label before the TSS data and use that.


Top
 Profile  
 
 Post subject: Re: How to fetch data from TSS?
PostPosted: Thu Feb 17, 2011 11:07 pm 
Offline
Member
Member

Joined: Fri Nov 19, 2010 6:54 pm
Posts: 70
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.


Top
 Profile  
 
 Post subject: Re: How to fetch data from TSS?
PostPosted: Thu Feb 17, 2011 11:14 pm 
Offline
Member
Member
User avatar

Joined: Tue Dec 25, 2007 6:03 am
Posts: 734
Location: Perth, Western Australia
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.

_________________
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc


Top
 Profile  
 
 Post subject: Re: How to fetch data from TSS?
PostPosted: Fri Feb 18, 2011 2:30 am 
Offline
Member
Member

Joined: Fri Nov 19, 2010 6:54 pm
Posts: 70
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?


Top
 Profile  
 
 Post subject: Re: How to fetch data from TSS?
PostPosted: Fri Feb 18, 2011 2:43 am 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 3191
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.


Top
 Profile  
 
 Post subject: Re: How to fetch data from TSS?
PostPosted: Fri Feb 18, 2011 3:40 am 
Offline
Member
Member

Joined: Fri Nov 19, 2010 6:54 pm
Posts: 70
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


Top
 Profile  
 
 Post subject: Re: How to fetch data from TSS?
PostPosted: Fri Feb 18, 2011 7:30 am 
Offline
Member
Member

Joined: Thu Jul 05, 2007 8:58 am
Posts: 223
Please read the required knowledge page on the wiki.


Top
 Profile  
 
 Post subject: Re: How to fetch data from TSS?
PostPosted: Fri Feb 18, 2011 9:15 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
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.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], FrankRay78 and 54 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group