Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

Developing portable (across CPU architecture) OS

34 Aufrufe
Direkt zur ersten ungelesenen Nachricht

आशू

ungelesen,
17.07.2006, 02:49:5517.07.06
an
Hi,
I'm trying to do develop a portable OS (a multiboot kernel for IA32 and
AMD64 architectures). And I'm using FreeBSD (as host OS), and GCC 4.2
(as compiler). Now I need to define multiboot structures here. I want
to know how to define these portably. I'm expecting something like
following:

-- begin code for "C" language --
#ifdef AMD64
typedef unsigned int u32;
typedef unsigned long u64;
#elif defined(IA32)
typedef unsigned long u32;
typedef unsigned long long u64;
#else
#error Unsupported architecture
#endif

u32 stuff32;
u64 stuff64;
-- end code --

So, my question is what are the architecture specific "preprocessor
defines" in GCC ? I've already seen its manual.

Thanks in advance,
Ashish Shukla

Maurizio Loreti

ungelesen,
17.07.2006, 02:54:0217.07.06
an
⋾)؉㘉䈢‼睡桪慶慀杭慩氮捯派⁷物瑥猺ਊ㸠䤧洠瑲祩湧⁴漠摯⁤敶敬潰⁡⁰潲瑡扬攠体
愠浵汴楢潯琠步牮敬⁦潲⁉䄳㈠慮搊㸠䅍䐶㐠慲捨楴散瑵牥猩⸠䅮搠䤧洠畳楮朠䙲敥䉓䐠⡡猠桯獴⁏匩Ⱐ慮搠䝃䌠㐮㈊㸠⡡猠捯浰楬敲⤮ਊ䉥楮朠杣挠㐮ㄮㄠ瑨攠捵牲敮琠牥汥慳攬⁹潵⁨慶攠瑯⁷慩琠愠晥眠睥敫献ਊⴭ 䵡畲楺楯⁌潲整椠††††††††††††桴瑰㨯⽷睷⹰搮楮普⹩琯繬潲整椯浬漮桴浬੄数琮映偨祳楣猬⁕湩瘮映偡摯癡Ⱐ䥴慬礠††††††⁒佔ㄳ㨠祢敲杶䁣焮癡獡⹶朊

Maurizio Loreti

ungelesen,
17.07.2006, 02:55:3217.07.06
an
⋾)؉㘉䈢‼睡桪慶慀杭慩氮捯派⁷物瑥猺ਊ㸠ⴭ⁢敧楮⁣潤攠景爠≃∠污湧畡来‭ⴊ㸠⍩晤敦⁁䵄㘴ਾ⁴祰敤敦⁵湳楧湥搠楮琠申㈻ਾ⁴祰敤敦⁵湳楧湥搠汯湧⁵㘴㬊ਖ਼潵慹⁷慮琠瑯⁲敡搠瑨攠捵牲敮琠䌠却慮摡牤Ⱐ慮搠畳攠楮瑥来爠瑹灥猊汩步⁵楮琳㉟琮ਊⴭ 䵡畲楺楯⁌潲整椠††††††††††††桴瑰㨯⽷睷⹰搮楮普⹩琯繬潲整椯浬漮桴浬੄数琮映偨祳楣猬⁕湩瘮映偡摯癡Ⱐ䥴慬礠††††††⁒佔ㄳ㨠祢敲杶䁣焮癡獡⹶朊

आशू

ungelesen,
17.07.2006, 03:45:0417.07.06
an
Hi,

Thanks for replying.

Maurizio Loreti wrote:


> "þÿ 6 B" <wah...@gmail.com> writes:
>
> > -- begin code for "C" language --
> > #ifdef AMD64
> > typedef unsigned int u32;
> > typedef unsigned long u64;
>

> You may want to read the current C Standard, and use integer types
> like uint32_t.

But I'm not using standard C libraries or headers here. And I'm
interested in knowing is there any way, in which GCC informs source
code about the target CPU architecture. The "AMD64" and "IA32"
preprocessor defines, above are fictious.

I'm expecting something similar to "__cplusplus" (which is defined by
compiler if it is a C++ compiler). So I want to know if CPU
architecture information is available in a similar manner.

>
> --
> Maurizio Loreti http://www.pd.infn.it/~loreti/mlo.html
> Dept. of Physics, Univ. of Padova, Italy ROT13: ybe...@cq.vasa.vg

Thanks,
Ashish Shukla
--
http://wahjava.wordpress.com/

Maurizio Loreti

ungelesen,
17.07.2006, 05:42:0717.07.06
an
"� 6 B" <wah...@gmail.com> writes:

> I'm expecting something similar to "__cplusplus" (which is defined by
> compiler if it is a C++ compiler). So I want to know if CPU
> architecture information is available in a similar manner.

Yes; you can obtain the list of preprocessor defined symbols asking
for them when processing an empty file --- e.g., with ther command

echo | gcc -E -dM -

आशू

ungelesen,
17.07.2006, 07:13:5117.07.06
an
Hi,

Maurizio Loreti wrote:
>
> echo | gcc -E -dM -
>

Thanks it worked

0 neue Nachrichten