Page 1 of 1

using SS & DS in gcc

Posted: Sun Nov 30, 2003 12:08 pm
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?

Re:using SS & DS in gcc

Posted: Sun Nov 30, 2003 12:27 pm
by df
gcc creates flat code only. it cant handle segments.

Re:using SS & DS in gcc

Posted: Sun Nov 30, 2003 12:42 pm
by Neo
so there is no way of using a separate stack segment in gcc?

Re:using SS & DS in gcc

Posted: Sun Nov 30, 2003 1:00 pm
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.

Re:using SS & DS in gcc

Posted: Sun Nov 30, 2003 1:11 pm
by Neo
could you explain that for a newbie ;D

Re:using SS & DS in gcc

Posted: Sun Nov 30, 2003 3:05 pm
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.

Re:using SS & DS in gcc

Posted: Mon Dec 01, 2003 11:34 am
by Neo
i just wanted to know does GCC expect the same values for DS and CS also?

Re:using SS & DS in gcc

Posted: Mon Dec 01, 2003 1:50 pm
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.