Author: jcatena Date: Tue Jan 26 12:50:40 2010 New Revision: 45264
URL: http://svn.reactos.org/svn/reactos?rev=45264&view=rev Log: [REACTOS] added includes to improve compiler and platform portability check specally platf.h, and use its macros instead of specific compiler directives cpu.h and cpu_c.h contain defs, macros and inlines specific to the cpu_c there are different versions of these files in <arch> and <compiler> subdirectories, and the right subdirectories must be added to the search path according to compiler and architecture
Added: branches/jcatena-branch/include/reactos/gnuc/ (with props) branches/jcatena-branch/include/reactos/gnuc/i386/ (with props) branches/jcatena-branch/include/reactos/gnuc/i386/cpu_c.h (with props) branches/jcatena-branch/include/reactos/gnuc/i386/platf.h (with props) branches/jcatena-branch/include/reactos/i386/ (with props) branches/jcatena-branch/include/reactos/i386/cpu.h (with props) branches/jcatena-branch/include/reactos/i386/reactos_cfg.h (with props) branches/jcatena-branch/include/reactos/msc/ (with props) branches/jcatena-branch/include/reactos/msc/i386/ (with props) branches/jcatena-branch/include/reactos/msc/i386/cpu_c.h (with props) branches/jcatena-branch/include/reactos/msc/i386/msc.h (with props) branches/jcatena-branch/include/reactos/msc/i386/platf.h (with props) branches/jcatena-branch/include/reactos/osver.h (with props)
Propchange: branches/jcatena-branch/include/reactos/gnuc/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Jan 26 12:50:40 2010 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: branches/jcatena-branch/include/reactos/gnuc/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/jcatena-branch/include/reactos/gnuc/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/jcatena-branch/include/reactos/gnuc/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Propchange: branches/jcatena-branch/include/reactos/gnuc/i386/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Jan 26 12:50:40 2010 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: branches/jcatena-branch/include/reactos/gnuc/i386/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/jcatena-branch/include/reactos/gnuc/i386/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/jcatena-branch/include/reactos/gnuc/i386/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Added: branches/jcatena-branch/include/reactos/gnuc/i386/cpu_c.h URL: http://svn.reactos.org/svn/reactos/branches/jcatena-branch/include/reactos/g... ============================================================================== --- branches/jcatena-branch/include/reactos/gnuc/i386/cpu_c.h (added) +++ branches/jcatena-branch/include/reactos/gnuc/i386/cpu_c.h [iso-8859-1] Tue Jan 26 12:50:40 2010 @@ -1,0 +1,98 @@ +#ifndef _CASM_INC +#define _CASM_INC + +#define Ke386SetGlobalDescriptorTable(X) \ + __asm__("lgdt %0\n\t" \ + : /* no outputs */ \ + : "m" (*X)); + +#define Ke386GetGlobalDescriptorTable(X) \ + __asm__("sgdt %0\n\t" \ + : "=m" (*X) \ + : /* no input */ \ + : "memory"); + +FORCEINLINE +USHORT +Ke386GetLocalDescriptorTable() +{ + USHORT Ldt; + __asm__("sldt %0\n\t" + : "=m" (Ldt) + : /* no input */ + : "memory"); + return Ldt; +} + +#define Ke386SetLocalDescriptorTable(X) \ + __asm__("lldt %w0\n\t" \ + : /* no outputs */ \ + : "q" (X)); + +#define Ke386SetTr(X) __asm__ __volatile__("ltr %%ax" : :"a" (X)); + +FORCEINLINE +USHORT +Ke386GetTr(VOID) +{ + USHORT Tr; + __asm__("str %0\n\t" + : "=m" (Tr)); + return Tr; +} + +#define _Ke386GetSeg(N) ({ \ + unsigned int __d; \ + __asm__("movl %%" #N ",%0\n\t" :"=r" (__d)); \ + __d; \ + }) + +#define _Ke386SetSeg(N,X) __asm__ __volatile__("movl %0,%%" #N : :"r" (X)); + +#define Ke386FnInit() __asm__("fninit\n\t"); + +// +// CR Macros +// +#define Ke386SetCr2(X) __asm__ __volatile__("movl %0,%%cr2" : :"r" (X)); + +// +// Segment Macros +// +#define Ke386GetSs() _Ke386GetSeg(ss) +#define Ke386GetFs() _Ke386GetSeg(fs) +#define Ke386SetFs(X) _Ke386SetSeg(fs, X) +#define Ke386SetDs(X) _Ke386SetSeg(ds, X) +#define Ke386SetEs(X) _Ke386SetSeg(es, X) +#define Ke386SetSs(X) _Ke386SetSeg(ss, X) +#define Ke386SetGs(X) _Ke386SetSeg(gs, X) + +#define FPU_DOUBLE(var) double var; \ + __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : ) + +#define FPU_DOUBLES(var1,var2) double var1,var2; \ + __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \ + __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : ) + +// gcc bug workaround +#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 40300) || \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ == 40303) +#define DEFINE_WAIT_BLOCK(x) \ + struct _AlignHack \ + { \ + UCHAR Hack[15]; \ + EX_PUSH_LOCK_WAIT_BLOCK UnalignedBlock; \ + } WaitBlockBuffer; \ + PEX_PUSH_LOCK_WAIT_BLOCK x = (PEX_PUSH_LOCK_WAIT_BLOCK) \ + ((ULONG_PTR)&WaitBlockBuffer.UnalignedBlock &~ 0xF); +#else +// This is only for compatibility; the compiler will optimize the extra +// local variable (the actual pointer) away, so we don't take any perf hit +// by doing this. +#define DEFINE_WAIT_BLOCK(x) \ + EX_PUSH_LOCK_WAIT_BLOCK WaitBlockBuffer; \ + PEX_PUSH_LOCK_WAIT_BLOCK x = &WaitBlockBuffer; +#endif + + +#endif // #ifndef _CASM_INC
Propchange: branches/jcatena-branch/include/reactos/gnuc/i386/cpu_c.h ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/jcatena-branch/include/reactos/gnuc/i386/platf.h URL: http://svn.reactos.org/svn/reactos/branches/jcatena-branch/include/reactos/g... ============================================================================== --- branches/jcatena-branch/include/reactos/gnuc/i386/platf.h (added) +++ branches/jcatena-branch/include/reactos/gnuc/i386/platf.h [iso-8859-1] Tue Jan 26 12:50:40 2010 @@ -1,0 +1,201 @@ +#pragma once + +/* platf.h gnuc i32 +platform dependent basic types and macros +(c) Jose M. Catena Gomez, diwaves.com +*/ + +/* this must produce a compiler error */ +#define _ERR_UNSUPPORTED #error + +/* attribues */ +#define __declspec(x) __attribute__((x)) +#define _CDECL __declspec(cdecl) +#define _THISCALL +#define _STDCALL __declspec(stdcall) +#define _FASTCALL __declspec(regparm(3)) +#define _CLRCALL +#define _INLINE __inline__ +#define _INLINEF __inline__ __declspec(always_inline) +#define _NAKED +#define _INTERRUPT _ERR_UNSUPPORTED +#define _SAVEREGS _ERR_UNSUPPORTED +#define _LOADDS _ERR_UNSUPPORTED +#define _DLLEXPORT __declspec(dllexport) +#define _DLLIMPORT __declspec(dllimport) +#define _ALIGN(x) __declspec(aligned(x)) + +#define _PACK(x) __pragma(pack(push, x)) +#define _PACK_POP __pragma(pack(pop)) +#define _RESTRICT __restrict__ +#define _ONCE +#define _OPTIMIZE_DFT +#define _OPTIMIZE_OFF_ALL +#define _OPTIMIZE_OFF_GLOBAL +#define _OPTIMIZE_OFF_STKF +#define _INTRINSIC(x, subst) \ +#define x subst +#define _NOINTRINSIC(x) \ +#undef x +#define _NOWARN_PUSH +#define _NOWARN_POP +#define _NOWARN_MSC(x) +#define _NOWARN_GNUC(x) + +#define _SECTION(x) __declspec((section(sectn))) +#define _SECTION_FN(sectn, fn) __declspec((section(sectn))) +#define _SECTION_FND(sectn) __declspec((section(sectn))) +#define _SECTION_CODE(x) +#define _SECTION_CODE_END +#define _SECTION_DATA(x) +#define _SECTION_DATA_END +#define _SECTION_BSS(x) +#define _SECTION_BSS_END +#define _SECTION_CONST(x) +#define _SECTION_CONST_END + +#define _ASM_BEGIN __asm__ { +#define _ASM_END } +#define _ASM __asm__ + +#define IN +#define OUT + +/* ptr size */ +#define PTRSIZ 4 +#define PTRSIZMIN 4 +#define PTRSIZMAX 4 +#define _NEAR +#define _FAR +#define _FARH +#define _BASED +#define _BASED1 __based +#define _SEGMENT _UNSUPPORTED +#define _SEGNAME _UNSUPPORTED + +/************************************************************************* +basic types +*************************************************************************/ +typedef void *pvoid, _NEAR *npvoid, _FAR *lpvoid, _FARH *hpvoid; + +/* chars */ +#define CHRSIZMIN 1 +#define CHRSIZMAX 2 +#define CHRSIZ 1 +#define CHRWSIZ 2 +#define CHRXSIZ 2 +#define CHRSIGN 1 +#define CHRWSIGN 0 + +typedef char chr8, *pchr8p, _NEAR *npchr8, _FAR *lpchr8, _FARH *hpchr8; +typedef signed char chr8s, *pchr8s, _NEAR *npchr8s, _FAR *lpchr8s, _FARH *hpchr8s; +typedef unsigned char chr8u, *pchr8u, _NEAR *npchr8u, _FAR *lpchr8u, _FARH *hpchr8u; + +/* chars unicode 16 bits */ +#ifdef _NATIVE_WCHAR_T_DEFINED +typedef wchar_t chr16; +typedef signed short chr16s; +typedef unsigned short chr16u; +#else +typedef unsigned short chr16; +typedef signed short chr16s; +typedef unsigned short chr16u; +#endif + +typedef chr16 *pchr16, _NEAR *npchr16, _FAR *lpchr16, _FARH *hpchr16; +typedef chr16s *pchr16s, _NEAR *npchr16s, _FAR *lpchr16s, _FARH *hpchr16s; +typedef chr16u *pchr16u, _NEAR *npchr16u, _FAR *lpchr16u, _FARH *hpchr16u; + +#ifdef _UNICODE +typedef chr16 chr; +typedef chr16s chrs; +typedef chr16u chru; +#else +typedef chr8 chr; +typedef chr8s chrs; +typedef chr8u chru; +#endif + +typedef chr *pchr, _NEAR *npchr, _FAR *lpchr, _FARH hpchr; +typedef chrs *pchrs, _NEAR *npchrs, _FAR *lpchrs, _FARH hpchrs; +typedef chru *pchru, _NEAR *npchru, _FAR *lpchru, _FARH hpchru; + +// string literal macros +// double definitions here are necessary because preprocessor behavior +#define _T16(x) L ## x +#define T16(x) _T16(x) +#define _T8(x) x +#define T8(x) _T8(x) +#ifdef _UNICODE +#define TX(x) _T16(x) +#else +#define TX(x) _T8(x) +#endif +// stringfy +#define _sfy(x) #x +#define sfy(x) _sfy(x) + +/* integers */ +#define INTSIZMIN 1 +#define INTSIZMAX 8 +#define INTSIZ 4 +#define INTSMIN -2147483648 +#define INTSMAX 0x7FFFFFFF + +typedef int *pint, _NEAR *npint, _FAR *lpint, _FARH *hpint; +typedef signed int ints, *pints, _NEAR *npints, _FAR *lpints, _FARH *hpints; +typedef unsigned int intu, *pintu, _NEAR *npintu, _FAR *lpintu, _FARH *hpintu; + +typedef __int8 i8, *pi8, _NEAR *npi8, _FAR *lpi8, _FARH *hpi8; +typedef signed __int8 i8s, *pi8s, _NEAR *npi8s, _FAR *lpi8s, _FARH *hpi8s; +typedef unsigned __int8 i8u, *pi8u, _NEAR *npi8u, _FAR *lpi8u, _FARH *hpi8u; + +typedef short i16, *pi16, _NEAR *npi16, _FAR *lpi16, _FARH *hpi16; +typedef signed short i16s, *pi16s, _NEAR *npi16s, _FAR *lpi16s, _FARH *hpi16s; +typedef unsigned short i16u, *pi16u, _NEAR *npi16u, _FAR *lpi16u, _FARH *hpi16u; + +typedef long i32, *pi32, _NEAR *npi32, _FAR *lpi32, _FARH *hpi32; +typedef signed long i32s, *pi32s, _NEAR *npi32s, _FAR *lpi32s, _FARH *hpi32s; +typedef unsigned long i32u, *pi32u, _NEAR *npi32u, _FAR *lpi32u, _FARH *hpi32u; // = unsigned long DWORD + +typedef __int64 i64, *i64p, _NEAR *npi64, _FAR *lpi64, _FARH *hpi64; +typedef signed __int64 i64s, *pi64s, _NEAR *npi64s, _FAR *lpi64s, _FARH *hpi64s; +typedef unsigned __int64 i64u, *pi64u, _NEAR *npi64u, _FAR *lpi64u, _FARH *hpi64u; + +typedef union {i64 x; struct {i32u l; i32 h;}} i64x, *pi64x, _NEAR *npi64x, _FAR *lpi64x, _FARH *hpi64x; +typedef union {i64s x; struct {i32u l; i32s h;}} i64xs, *pi64xs, _NEAR *npi64xs, _FAR *lpi64xs, _FARH *hpi64xs; +typedef union {i64u x; struct {i32u l; i32u h;}} i64xu, *pi64xu, _NEAR *npi64xu, _FAR *lpi64xu, _FARH *hpi64xu; + +typedef struct {i64u l; i64 h;} i128, *pi128, _NEAR *npi128, _FAR *lpi128, _FARH *hpi128; +typedef struct {i64u l; i64s h;} i128s, *pi128s, _NEAR *npi128s, _FAR *lpi128s, _FARH *hpi128s; +typedef struct {i64u l; i64u h;} i128u, *pi128u, _NEAR *npi128u, _FAR *lpi128u, _FARH *hpi128u; + +// this int must be the same size of a pointer +typedef long iptr, *piptr, _NEAR *npiptr, _FAR *lpiptr, _FARH *hpiptr; +typedef signed long iptrs, *piptrs, _NEAR *npiptrs, _FAR *lpiptrs, _FARH *hpiptrs; +typedef unsigned long iptru, *piptru, _NEAR *npiptru, _FAR *lpiptru, _FARH *hpiptru; + +/* floats */ +typedef float f32, *pf32, _NEAR *npf32, _FAR *lpf32, _FARH *hpf32; +typedef double f64, *pf64p, _NEAR *npf64, _FAR *lpf64, _FARH *hpf64; +typedef struct {i64u l; i64u h;} f128, *pf128, _NEAR *npf128, _FAR *lpf128, _FARH *hpf128; + +/* size */ +#define SIZTSIZ 4 +#define SIZTMAX 0xFFFFFFFF +typedef i32u sizt, *psizt, _NEAR *npsizt, _FAR *npsizt, _FARH *hpsizt; + +/************************************************************************* + +*************************************************************************/ +// debug +#if _DEBUG +#define dbgref TX("(") TX(__FILE__) TX(":") TX(sfy(__LINE__)) TX(":") TX(__FUNCTION__) TX(")") +#else +#define dbgref 0 +#endif + +#define _ReturnAddress() (__builtin_return_address(0)) +#define ReturnAddress _ReturnAddress +#define _ReturnAddressn(x) (__builtin_return_address(x)) +#define ReturnAddressn(x) _ReturnAddressn(x)
Propchange: branches/jcatena-branch/include/reactos/gnuc/i386/platf.h ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: branches/jcatena-branch/include/reactos/i386/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Jan 26 12:50:40 2010 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: branches/jcatena-branch/include/reactos/i386/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/jcatena-branch/include/reactos/i386/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/jcatena-branch/include/reactos/i386/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Added: branches/jcatena-branch/include/reactos/i386/cpu.h URL: http://svn.reactos.org/svn/reactos/branches/jcatena-branch/include/reactos/i... ============================================================================== --- branches/jcatena-branch/include/reactos/i386/cpu.h (added) +++ branches/jcatena-branch/include/reactos/i386/cpu.h [iso-8859-1] Tue Jan 26 12:50:40 2010 @@ -1,0 +1,192 @@ +#pragma once + +/* cpu.h + definitions for intel ia-32 cpu and cpu.lib + (c) 2010 Jose M. Catena Gomez +*/ + +#include <cpu_c.h> // compiler specific + +#pragma pack(push, 1) + +// GDT Global Descriptor Table Entry +typedef struct +{ + i16u limit0; // 0 + i16u base0; // 2 + i8u base16; // 4 + i8u type:5; // 5.0 + i8u dpl:2; // 5.5 privilege + i8u p:1; // 5.7 47 present + i8u limit16:4; // 6.0 + i8u avl:1; // 6.4 available (ros sys) + i8u siz:2; // 6.5 default size: 0=16 bits, 2=32 bits, 1=64 bits + i8u g:1; // 6.7 granularity + i8u base24; // 7 +} CPU_GDTE; // 8 bytes + +// IDT Interrupt Descriptor Table Entry +typedef struct +{ + i16u offset0; // 0 + i16u sel; // 2 + i8u rsv20; // 4 + i8u type:2; // 5.0 type: 1=task, 2=interrupt, 3=trap + i8u rsv2a:1; // 5.2 1 + i8u siz:1; // 5.3 size: 0=16, 1=32 + i8u rsv2c:1; // 5.4 0 + i8u dpl:2; // 5.5 privilege + i8u p; // 5.7 present + i16u offset16; // 6 +} CPU_IDTE; // 8 bytes + +// descriptor table reg (gdtr / idtr) +typedef struct +{ + i16u rsv00; + i16u limit; + i32u base; +} CPUR_DT; + +// eflags +typedef struct +{ + union + { + i32u f; + struct + { + i32u c:1; // 0.0 carry + i32u rsv01:1; // 0.1 1 + i32u p:1; // 0.2 parity + i32u rsv03:1; // 0.3 0 + i32u a:1; // 0.4 aux + i32u rsv05:1; // 0.5 0 + i32u z:1; // 0.6 zero + i32u s:1; // 0.7 sign + i32u trap:1; // 1.0 trap + i32u ie:1; // 1.1 interrupt enable + i32u d:1; // 1.2 direction + i32u o:1; // 1.3 overflow + i32u iopl:2; // 1.4 io privilege + i32u nt:1; // 1.6 nested task + i32u rsv0f:1; // 1.7 0 + i32u r:1; // 2.0 resume + i32u vm:1; // 2.1 virtual 8086 mode + i32u ac:1; // 2.2 alignment check + i32u vif:1; // 2.3 virtual interrupt flag + i32u vip:1; // 2.4 virtual interrupt pending + i32u id:1; // 2.5 id + i32u rsv16:10; // 2.6 0 + }; + }; +} CPUR_F; + +typedef struct +{ + i32u eax; + i32u ecx; + i32u edx; + i32u ebx; + i32u esp; + i32u ebp; + i32u esi; + i32u edi; +} CPUR_GP; + +typedef struct +{ + i16u cs; + i16u ss; + i16u ds; + i16u es; + i16u fs; + i16u gs; +} CPUR_SEG; + +typedef struct +{ + i32u cr0; + i32u cr2; // page fault linear address + i32u cr3; // cr3 page directory + i32u cr4; + i32u cr8; + CPUR_DT gdtr; // global descriptor table + CPUR_DT idtr; // interrupt descriptor table + i16u ldtr; // local descriptor table + i16u tr; // task +} CPUR_C; + +typedef struct +{ + i32u dr0; + i32u dr1; + i32u dr2; + i32u dr3; + i32u dr4; + i32u dr5; + i32u dr6; + i32u dr7; + i32u dr8; +} CPUR_DBG; + +typedef struct +{ + CPUR_F f; + CPUR_GP gp; + CPUR_SEG seg; + CPUR_C c; +} CPUR_ALL; + +// task state segment +// must be aligned to 0x80, no page boundary allowed +typedef struct _ALIGN(0x80) +{ + i16u PrevTask; // 00 + i16u rsv02; // 02 + i32u esp0; // 04 + i16u ss0; // 08 + i16u rsv0a; // 0a + i32u esp1; // 0c + i16u ss1; // 10 + i16u rsv12; // 12 + i32u esp2; // 14 + i16u ss2; // 18 + i16u rsv1e; // 1a + i32u cr3; // 1c + i32u eip; // 20 + i32u eflags; // 24 + i32u eax; // 28 + i32u ecx; // 2c + i32u edx; // 30 + i32u ebx; // 34 + i32u esp; // 38 + i32u ebp; // 3c + i32u esi; // 40 + i32u edi; // 44 + i16u es; // 48 + i16u rsv4a; // 4a + i16u cs; // 4c + i16u rsv4e; // 4e + i16u ss; // 50 + i16u rsv52; // 52 + i16u ds; // 54 + i16u rsv56; // 56 + i16u fs; // 58 + i16u rsv5a; // 5a + i16u gs; // 5c + i16u rsv5e; // 5e + i16u ldtr; // 60 + i16u rsv62; // 62 + i16u DbgTrap; // 64 + i16u IoMap; // 66 +} CPU_TSS; // 68 + +#define CPUREGSAVE_GP 1 // always saved anyway +#define CPUREGSAVE_SEG 2 +#define CPUREGSAVE_C 4 +#define CPUREGSAVE_FPU 8 // unimplemented + +#pragma pack(pop) + +void _CDECL CpuRegSave(CPUR_ALL *p, i32 flags);
Propchange: branches/jcatena-branch/include/reactos/i386/cpu.h ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/jcatena-branch/include/reactos/i386/reactos_cfg.h URL: http://svn.reactos.org/svn/reactos/branches/jcatena-branch/include/reactos/i... ============================================================================== --- branches/jcatena-branch/include/reactos/i386/reactos_cfg.h (added) +++ branches/jcatena-branch/include/reactos/i386/reactos_cfg.h [iso-8859-1] Tue Jan 26 12:50:40 2010 @@ -1,0 +1,19 @@ +#pragma once + +#define DBG 1 +// #define DBG 1 +// #define KDBG +#define _WINKD_ +// #define AUTO_ENABLE_BOCHS +// #define CONFIG_SMP + +#define __REACTOS__ + +#if defined(_M_IX86) +#define KERNEL_STACK_SIZE 0x6000 +#define KERNEL_LARGE_STACK_SIZE 0xf000 +#define KERNEL_LARGE_STACK_COMMIT 0x6000 +#endif + +#include <osver.h> +#include <platf.h>
Propchange: branches/jcatena-branch/include/reactos/i386/reactos_cfg.h ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: branches/jcatena-branch/include/reactos/msc/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Jan 26 12:50:40 2010 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: branches/jcatena-branch/include/reactos/msc/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/jcatena-branch/include/reactos/msc/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/jcatena-branch/include/reactos/msc/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Propchange: branches/jcatena-branch/include/reactos/msc/i386/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Jan 26 12:50:40 2010 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: branches/jcatena-branch/include/reactos/msc/i386/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/jcatena-branch/include/reactos/msc/i386/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/jcatena-branch/include/reactos/msc/i386/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Added: branches/jcatena-branch/include/reactos/msc/i386/cpu_c.h URL: http://svn.reactos.org/svn/reactos/branches/jcatena-branch/include/reactos/m... ============================================================================== --- branches/jcatena-branch/include/reactos/msc/i386/cpu_c.h (added) +++ branches/jcatena-branch/include/reactos/msc/i386/cpu_c.h [iso-8859-1] Tue Jan 26 12:50:40 2010 @@ -1,0 +1,178 @@ +#pragma once + +// not recognized by inline assembler: +// mov eax, cr4 +#define mov_eax_cr4 _ASM _emit 0x0f _ASM _emit 0x20 _ASM _emit 0xe0 +// sysexit +#define sysexit _ASM _emit 0x0f _ASM _emit 0x35 + +#define CpuCld() __asm cld +#define CpuStd() __asm std + +void __wbinvd(void); +_INTRINSIC(__wbinvd, __wbinvd) +#define CpuWbinvd __wbinvd + +#define CpuGetGdt_m(x) _ASM sgdt x +_INLINEF void CpuGetGdt(pvoid Descriptor) {_ASM_BEGIN + mov eax, Descriptor + sgdt [eax] +_ASM_END} + +#define CpuSetGdt_m(x) _ASM lgdt x +_INLINEF void CpuSetGdt(pvoid Descriptor) {_ASM_BEGIN + mov eax, Descriptor + lgdt [eax] +_ASM_END} + +#if 1 // select implementation +void __sidt(void *x); // msc intrinsic +_INTRINSIC(__sidt, __sidt) +#define CpuGetIdt __sidt +#else +_INLINEF void CpuGetIdt(void *x) {_ASM_BEGIN + mov eax, x + sidt [eax] +_ASM_END} +#endif +#define CpuGetIdt_m(x) _ASM sidt x + +#if 1 // select implementation +void __lidt(void *x); // msc intrinic +_INTRINSIC(__lidt, __lidt) +#define CpuSetIdt __lidt +#else +_INLINEF void CpuSetIdt(void *x) {_ASM_BEGIN + mov eax, x + lidt [eax] +_ASM_END} +#endif +#define CpuSetIdt_m(x) _ASM lidt x + +_INLINEF i16u CpuGetLdt(void) {_ASM_BEGIN + sldt ax +_ASM_END} + +_INLINEF void CpuSetLdt(IN i16u x) {_ASM_BEGIN + lldt x +_ASM_END} + +_INLINEF i16u CpuGetTr(void) {_ASM_BEGIN + str ax +_ASM_END} + +_INLINEF void CpuSetTr(IN i16u x) {_ASM_BEGIN + ltr x +_ASM_END} + +_INLINEF void CpuSetCr2(i32u x) {_ASM_BEGIN + mov eax, x + mov cr2, eax +_ASM_END} + +_INLINEF i16u CpuGetSs(void) {_ASM_BEGIN + mov ax, ss +_ASM_END} + +_INLINEF void CpuSetSs(i16u x) {_ASM_BEGIN + mov ax, x + mov ss, ax +_ASM_END} + +_INLINEF i16u CpuGetFs(void) {_ASM_BEGIN + mov ax, fs +_ASM_END} + +_INLINEF void CpuSetFs(i16u x) {_ASM_BEGIN + mov ax, x + mov fs, ax +_ASM_END} + +_INLINEF i16u CpuGetDs(void) {_ASM_BEGIN + mov ax, ds +_ASM_END} + +_INLINEF void CpuSetDs(i16u x) {_ASM_BEGIN + mov ax, x + mov ds, ax +_ASM_END} + +_INLINEF i16u CpuGetEs(void) {_ASM_BEGIN + mov ax, es; +_ASM_END} + +_INLINEF void CpuSetEs(i16u x) {_ASM_BEGIN + mov ax, x + mov es, ax +_ASM_END} + +_INLINEF i16u CpuGetGs(void) {_ASM_BEGIN + mov ax, gs +_ASM_END} + +_INLINEF void CpuSetGs(i16u x) {_ASM_BEGIN + mov ax, x + mov gs, ax +_ASM_END} + +_INLINEF void CpuGetEbp(void) {_ASM_BEGIN + mov eax, ebp +_ASM_END} +#define CpuGetEbp_m(x) _ASM mov x, ebp + +_INLINEF void CpuSetEbp(i32 x) {_ASM_BEGIN + mov ebp, x +_ASM_END} + +#define CpuIret() _ASM iret + +_INLINEF void CpuTrapReturn(IN iptru Stack) {_ASM_BEGIN + mov esp, Stack + popa + ret +_ASM_END} + +// FPU +#define CpuFinit() _ASM finit +#define CpuFninit() _ASM fninit +#define CpuFnclex() _ASM fnclex +_INLINEF void CpuFstcw(void *x) {_ASM_BEGIN + mov eax, x + fstcw [eax] +_ASM_END} +#define CpuFstcw_m(x) _ASM fstcw x +_INLINEF void CpuFSetCw(i32 x) {_ASM_BEGIN + fldcw x +_ASM_END} +_INLINEF void CpuFnsave(void *x) {_ASM_BEGIN + mov eax, x + fnsave [eax] +_ASM_END} +#define CpuFnsave_m(x) _ASM fnsave x +_INLINEF void CpuFrstor(void *x) {_ASM_BEGIN + mov eax, x + frstor [eax] +_ASM_END} +#define CpuFrstor_m(x) _ASM frstor x +_INLINEF void CpuFxsave(void *x) {_ASM_BEGIN + mov eax, x + fxsave [eax] +_ASM_END} +#define CpuFxsave_m(x) _ASM fxsave x +_INLINEF void CpuFxrstor(void *x) {_ASM_BEGIN + mov eax, x + fxrstor [eax] +_ASM_END} +#define CpuFxrstor(x) _ASM fxrstor x + +#define FPU_DOUBLE(var) \ + double var; \ + _ASM fstp var \ + _ASM fwait +#define FPU_DOUBLES(var1,var2) \ + double var1,var2; \ + _ASM fstp var1 \ + _ASM fwait \ + _ASM fstp var2 \ + _ASM fwait +
Propchange: branches/jcatena-branch/include/reactos/msc/i386/cpu_c.h ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/jcatena-branch/include/reactos/msc/i386/msc.h URL: http://svn.reactos.org/svn/reactos/branches/jcatena-branch/include/reactos/m... ============================================================================== --- branches/jcatena-branch/include/reactos/msc/i386/msc.h (added) +++ branches/jcatena-branch/include/reactos/msc/i386/msc.h [iso-8859-1] Tue Jan 26 12:50:40 2010 @@ -1,0 +1,20 @@ +#pragma once + +/* msc.h + portability definitions for msc (microsof c or vc compilers) + 20091216 jcatena + This shouldn't be necessary if code uses plaf.h macros instead of hardwired compiler specific directives +*/ + +#if defined(_MSC_VER) +#if 1 +#if !defined(__cplusplus) +#define inline _INLINE +#endif + +#define __inline__ _INLINE +#define FORCEINLINE _INLINEF +#define __attribute__(packed) + +#endif +#endif // #if defined(_MSC_VER)
Propchange: branches/jcatena-branch/include/reactos/msc/i386/msc.h ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/jcatena-branch/include/reactos/msc/i386/platf.h URL: http://svn.reactos.org/svn/reactos/branches/jcatena-branch/include/reactos/m... ============================================================================== --- branches/jcatena-branch/include/reactos/msc/i386/platf.h (added) +++ branches/jcatena-branch/include/reactos/msc/i386/platf.h [iso-8859-1] Tue Jan 26 12:50:40 2010 @@ -1,0 +1,203 @@ +#pragma once + +/* platf.h msvc i32 +platform dependent basic types and macros +(c) Jose M. Catena Gomez, diwaves.com +*/ + +/* this must produce a compiler error */ +#define _ERR_UNSUPPORTED #error + +/* attribues */ +#define _CDECL __cdecl +#define _THISCALL __thiscall +#define _STDCALL __stdcall +#define _FASTCALL __fastcall +#define _CLRCALL __clrcall +#define _INLINE __inline +#define _INLINEF __forceinline +#define _NAKED __declspec(naked) +#define _INTERRUPT _ERR_UNSUPPORTED +#define _SAVEREGS _ERR_UNSUPPORTED +#define _LOADDS _ERR_UNSUPPORTED +#define _DLLEXPORT __declspec(dllexport) +#define _DLLIMPORT __declspec(dllimport) +#define _ALIGN(x) __declspec(align(x)) + +#define _PACKN(x) __pragma(pack(push, x)) +#define _PACK_POP __pragma(pack(pop)) +#define _RESTRICT __restrict +#define _ONCE __pragma(once) +#define _OPTIMIZE_DFT __pragma(optimize("", on)) +#define _OPTIMIZE_OFF_ALL __pragma(optimize("", off)) +#define _OPTIMIZE_OFF_GLOBAL __pragma(optimize("g", off)) +#define _OPTIMIZE_OFF_STKF __pragma(optimize("y", off)) +#define _INTRINSIC(x, subst) __pragma(intrinsic(x)) +#define _NOINTRINSIC(x) __pragma(function(x)) +#define _NOWARN_PUSH __pragma(warning(push)) +#define _NOWARN_POP __pragma(warning(pop)) +#define _NOWARN_MSC(x) __pragma(warning(disable: x)) +#define _NOWARN_GNUC(x) + +#define _SECTION(x) __declspec(allocate(x)) +#define _SECTION_FN(sectn, fn) __pragma(alloc_text(sectn, fn)) +#define _SECTION_FND(sectn) +#define _SECTION_CODE(x) __pragma(code_seg(push, x)) +#define _SECTION_CODE_END __pragma(code_seg(pop)) +#define _SECTION_DATA(x) __pragma(data_seg(push, x)) +#define _SECTION_DATA_END __pragma(data_seg(pop)) +#define _SECTION_BSS(x) __pragma(bss_seg(push, x)) +#define _SECTION_BSS_END __pragma(bss_seg(pop)) +#define _SECTION_CONST(x) __pragma(const_seg(push, x)) +#define _SECTION_CONST_END __pragma(const_seg(pop)) + +#define _ASM_BEGIN __asm { +#define _ASM_END } +#define _ASM __asm + +#define IN +#define OUT + +/* ptr size */ +#define PTRSIZ 4 +#define PTRSIZMIN 4 +#define PTRSIZMAX 4 +#define _NEAR +#define _FAR +#define _FARH +#define _BASED +#define _BASED1 __based +#define _SEGMENT _UNSUPPORTED +#define _SEGNAME _UNSUPPORTED + +/************************************************************************* +basic types +*************************************************************************/ +typedef void *pvoid, _NEAR *npvoid, _FAR *lpvoid, _FARH *hpvoid; + +/* chars */ +#define CHRSIZMIN 1 +#define CHRSIZMAX 2 +#define CHRSIZ 1 +#define CHRWSIZ 2 +#define CHRXSIZ 2 +#define CHRSIGN 1 +#define CHRWSIGN 0 + +typedef char chr8, *pchr8p, _NEAR *npchr8, _FAR *lpchr8, _FARH *hpchr8; +typedef signed char chr8s, *pchr8s, _NEAR *npchr8s, _FAR *lpchr8s, _FARH *hpchr8s; +typedef unsigned char chr8u, *pchr8u, _NEAR *npchr8u, _FAR *lpchr8u, _FARH *hpchr8u; + +/* chars unicode 16 bits */ +#ifdef _NATIVE_WCHAR_T_DEFINED +typedef wchar_t chr16; +typedef signed short chr16s; +typedef unsigned short chr16u; +#else +typedef unsigned short chr16; +typedef signed short chr16s; +typedef unsigned short chr16u; +#endif + +typedef chr16 *pchr16, _NEAR *npchr16, _FAR *lpchr16, _FARH *hpchr16; +typedef chr16s *pchr16s, _NEAR *npchr16s, _FAR *lpchr16s, _FARH *hpchr16s; +typedef chr16u *pchr16u, _NEAR *npchr16u, _FAR *lpchr16u, _FARH *hpchr16u; + +#ifdef _UNICODE +typedef chr16 chr; +typedef chr16s chrs; +typedef chr16u chru; +#else +typedef chr8 chr; +typedef chr8s chrs; +typedef chr8u chru; +#endif + +typedef chr *pchr, _NEAR *npchr, _FAR *lpchr, _FARH hpchr; +typedef chrs *pchrs, _NEAR *npchrs, _FAR *lpchrs, _FARH hpchrs; +typedef chru *pchru, _NEAR *npchru, _FAR *lpchru, _FARH hpchru; + +// string literal macros +// double definitions here are necessary because preprocessor behavior +#define _T16(x) L ## x +#define T16(x) _T16(x) +#define _T8(x) x +#define T8(x) _T8(x) +#ifdef _UNICODE +#define TX(x) _T16(x) +#else +#define TX(x) _T8(x) +#endif +// stringfy +#define _sfy(x) #x +#define sfy(x) _sfy(x) + +/* integers */ +#define INTSIZMIN 1 +#define INTSIZMAX 8 +#define INTSIZ 4 +#define INTSMIN -2147483648 +#define INTSMAX 0x7FFFFFFF + +typedef int *pint, _NEAR *npint, _FAR *lpint, _FARH *hpint; +typedef signed int ints, *pints, _NEAR *npints, _FAR *lpints, _FARH *hpints; +typedef unsigned int intu, *pintu, _NEAR *npintu, _FAR *lpintu, _FARH *hpintu; + +typedef __int8 i8, *pi8, _NEAR *npi8, _FAR *lpi8, _FARH *hpi8; +typedef signed __int8 i8s, *pi8s, _NEAR *npi8s, _FAR *lpi8s, _FARH *hpi8s; +typedef unsigned __int8 i8u, *pi8u, _NEAR *npi8u, _FAR *lpi8u, _FARH *hpi8u; + +typedef short i16, *pi16, _NEAR *npi16, _FAR *lpi16, _FARH *hpi16; +typedef signed short i16s, *pi16s, _NEAR *npi16s, _FAR *lpi16s, _FARH *hpi16s; +typedef unsigned short i16u, *pi16u, _NEAR *npi16u, _FAR *lpi16u, _FARH *hpi16u; + +typedef long i32, *pi32, _NEAR *npi32, _FAR *lpi32, _FARH *hpi32; +typedef signed long i32s, *pi32s, _NEAR *npi32s, _FAR *lpi32s, _FARH *hpi32s; +typedef unsigned long i32u, *pi32u, _NEAR *npi32u, _FAR *lpi32u, _FARH *hpi32u; // = unsigned long DWORD + +typedef __int64 i64, *i64p, _NEAR *npi64, _FAR *lpi64, _FARH *hpi64; +typedef signed __int64 i64s, *pi64s, _NEAR *npi64s, _FAR *lpi64s, _FARH *hpi64s; +typedef unsigned __int64 i64u, *pi64u, _NEAR *npi64u, _FAR *lpi64u, _FARH *hpi64u; + +typedef union {i64 x; struct {i32u l; i32 h;};} i64x, *pi64x, _NEAR *npi64x, _FAR *lpi64x, _FARH *hpi64x; +typedef union {i64s x; struct {i32u l; i32s h;};} i64xs, *pi64xs, _NEAR *npi64xs, _FAR *lpi64xs, _FARH *hpi64xs; +typedef union {i64u x; struct {i32u l; i32u h;};} i64xu, *pi64xu, _NEAR *npi64xu, _FAR *lpi64xu, _FARH *hpi64xu; + +typedef struct {i64u l; i64 h;} i128, *pi128, _NEAR *npi128, _FAR *lpi128, _FARH *hpi128; +typedef struct {i64u l; i64s h;} i128s, *pi128s, _NEAR *npi128s, _FAR *lpi128s, _FARH *hpi128s; +typedef struct {i64u l; i64u h;} i128u, *pi128u, _NEAR *npi128u, _FAR *lpi128u, _FARH *hpi128u; + +// this int must be the same size of a pointer +typedef long iptr, *piptr, _NEAR *npiptr, _FAR *lpiptr, _FARH *hpiptr; +typedef signed long iptrs, *piptrs, _NEAR *npiptrs, _FAR *lpiptrs, _FARH *hpiptrs; +typedef unsigned long iptru, *piptru, _NEAR *npiptru, _FAR *lpiptru, _FARH *hpiptru; + +/* floats */ +typedef float f32, *pf32, _NEAR *npf32, _FAR *lpf32, _FARH *hpf32; +typedef double f64, *pf64p, _NEAR *npf64, _FAR *lpf64, _FARH *hpf64; +typedef struct {i64u l; i64u h;} f128, *pf128, _NEAR *npf128, _FAR *lpf128, _FARH *hpf128; + +/* size */ +#define SIZTSIZ 4 +#define SIZTMAX 0xFFFFFFFF +typedef i32u sizt, *psizt, _NEAR *npsizt, _FAR *lpsizt, _FARH *hpsizt; + +/************************************************************************* + +*************************************************************************/ +// debug +#if _DEBUG +#define dbgref TX("(") TX(__FILE__) TX(":") TX(sfy(__LINE__)) TX(":") TX(__FUNCTION__) TX(")") +#else +#define dbgref 0 +#endif + +pvoid _ReturnAddress(void); +#pragma intrinsic(_ReturnAddress) +#define ReturnAddress _ReturnAddress +#define _ReturnAddressn(x) _ReturnAddress() +#define ReturnAddressn _ReturnAddressn +#define __builtin_expect(x, v) (x) + +#include <msc.h> // additional compatibility defs that would not be needed if code uses macros defined here instead of compiler specific directives +
Propchange: branches/jcatena-branch/include/reactos/msc/i386/platf.h ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/jcatena-branch/include/reactos/osver.h URL: http://svn.reactos.org/svn/reactos/branches/jcatena-branch/include/reactos/o... ============================================================================== --- branches/jcatena-branch/include/reactos/osver.h (added) +++ branches/jcatena-branch/include/reactos/osver.h [iso-8859-1] Tue Jan 26 12:50:40 2010 @@ -1,0 +1,26 @@ +#pragma once + +// minimum supported platforms +// see sdkddkver.h + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0502 +#endif + +// wdk +// LATEST_NTDDI_VERSION +#ifndef NTDDI_VERSION +#define NTDDI_VERSION 0x05020000 +#endif + +#ifndef _WIN32_IE +#define _WIN32_IE 0x600 +#endif + +#ifndef WINVER +#define WINVER _WIN32_WINNT +#endif + +#ifndef _WIN32_WINDOWS +#define _WIN32_WINDOWS _WIN32_WINNT +#endif
Propchange: branches/jcatena-branch/include/reactos/osver.h ------------------------------------------------------------------------------ svn:eol-style = native