using SS & DS in gcc

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

using SS & DS in gcc

Post by Neo »

If gcc expects to always have ds and ss addresses to be the same then is there no efficient way i can maintain a separate Stack segment? I mean other than copying data at every function call is there any other way around this?
Only Human
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:using SS & DS in gcc

Post by df »

gcc creates flat code only. it cant handle segments.
-- Stu --
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:using SS & DS in gcc

Post by Neo »

so there is no way of using a separate stack segment in gcc?
Only Human
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:using SS & DS in gcc

Post by df »

sure you can create a separate selector for SS, as long as it maps to the same address as DS, then you can have a non exec stack etc.
-- Stu --
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:using SS & DS in gcc

Post by Neo »

could you explain that for a newbie ;D
Only Human
jamesb

Re:using SS & DS in gcc

Post by jamesb »

Neo wrote: could you explain that for a newbie ;D
Go to the Intel developer's site and request copies of the Intel Architecuture processor manuals. The P4 version explains differences where applicable between processors from the 386 to the P4 and Xeon. Get volumes 1 - 3. They are free and they also post them to you free of charge.

Read the first volume to get a general overview of the processor, and then read volume 3 for the gory details you will need when writing a kernel.

http://developer.intel.com/design/Pentium4/manuals/

You can download them in PDF as well.
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:using SS & DS in gcc

Post by Neo »

i just wanted to know does GCC expect the same values for DS and CS also?
Only Human
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:using SS & DS in gcc

Post by df »

it doesnt matter WHAT ds/ss/cs is. as long as

DS:0x000000 = SS:0x00000.

if DS starts at 1mb mark, SS must start at 1mb mark.
gcc does not care that DS = 0x08 and SS = 0x58 as long as the memory the selectors point to map to the same memory addresses.
-- Stu --
Post Reply