os/kernelhwsrv/kernel/eka/include/nkern/x86/nk_plat.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32\include\nkern\x86\nk_plat.h
sl@0
    15
// 
sl@0
    16
// WARNING: This file contains some APIs which are internal and are subject
sl@0
    17
//          to change without notice. Such APIs should therefore not be used
sl@0
    18
//          outside the Kernel and Hardware Services package.
sl@0
    19
//
sl@0
    20
sl@0
    21
/**
sl@0
    22
 @file
sl@0
    23
 @internalComponent
sl@0
    24
*/
sl@0
    25
sl@0
    26
#ifndef __NK_X86_H__
sl@0
    27
#define __NK_X86_H__
sl@0
    28
#include <nk_cpu.h>
sl@0
    29
sl@0
    30
#define IRQ_STACK_SIZE	1024
sl@0
    31
sl@0
    32
//#define __SCHEDULER_MACHINE_CODED__
sl@0
    33
//#define __DFC_MACHINE_CODED__
sl@0
    34
//#define __MSTIM_MACHINE_CODED__
sl@0
    35
//#define __PRI_LIST_MACHINE_CODED__
sl@0
    36
//#define __FAST_SEM_MACHINE_CODED__
sl@0
    37
//#define __FAST_MUTEX_MACHINE_CODED__
sl@0
    38
sl@0
    39
// TScheduler member data
sl@0
    40
#define	i_ExcInfo			iExtras[15]		// pointer to exception info for crash debugger
sl@0
    41
sl@0
    42
class TX86RegSet;
sl@0
    43
class NThread : public NThreadBase
sl@0
    44
	{
sl@0
    45
public:
sl@0
    46
	TInt Create(SNThreadCreateInfo& anInfo, TBool aInitial);
sl@0
    47
	inline void Stillborn()
sl@0
    48
		{}
sl@0
    49
	void GetUserContext(TX86RegSet& aContext);
sl@0
    50
	void ModifyUsp(TLinAddr aUsp);
sl@0
    51
public:
sl@0
    52
	TUint32	i_NThread_Pad1;
sl@0
    53
	TUint64	iCoprocessorState[64];	// state of FPU, SSE, SSE2
sl@0
    54
	};
sl@0
    55
sl@0
    56
__ASSERT_COMPILE(!(_FOFF(NThread,iCoprocessorState)&7));
sl@0
    57
sl@0
    58
// Positions of registers on stack, relative to saved SP
sl@0
    59
struct SThreadStack
sl@0
    60
	{
sl@0
    61
	TUint32 iCR0;
sl@0
    62
	TUint32 iEbx;
sl@0
    63
	TUint32 iEsi;
sl@0
    64
	TUint32 iEdi;
sl@0
    65
	TUint32 iEbp;
sl@0
    66
	TUint32 iGs;
sl@0
    67
	TUint32 iFs;
sl@0
    68
	TUint32 iReschedFlag;
sl@0
    69
	TUint32 iEip;
sl@0
    70
	};
sl@0
    71
sl@0
    72
extern "C" {
sl@0
    73
GLREF_D TUint32 X86_IrqStack[IRQ_STACK_SIZE/4];
sl@0
    74
GLREF_D TLinAddr X86_IrqHandler;
sl@0
    75
GLREF_D TInt X86_IrqNestCount;
sl@0
    76
GLREF_D SCpuIdleHandler CpuIdleHandler;
sl@0
    77
GLREF_D TBool X86_UseGlobalPTEs;
sl@0
    78
GLREF_D TUint64 DefaultCoprocessorState[64];
sl@0
    79
}
sl@0
    80
sl@0
    81
sl@0
    82
/** Ensure the ordering of explicit memory writes
sl@0
    83
sl@0
    84
	On x86 this is a no-op
sl@0
    85
*/
sl@0
    86
#define	wmb()
sl@0
    87
#define smp_wmb()
sl@0
    88
sl@0
    89
/** Ensure the ordering of explicit memory accesses
sl@0
    90
sl@0
    91
	On x86 any instruction with the LOCK prefix does this
sl@0
    92
*/
sl@0
    93
#ifdef __GCC32__
sl@0
    94
#define	mb()	__asm__ __volatile__("lock add dword ptr [esp], 0" : : : "memory")
sl@0
    95
#else
sl@0
    96
#define	mb()	do { _asm lock add dword ptr [esp], 0 } while (0)
sl@0
    97
#endif
sl@0
    98
#define smp_mb()
sl@0
    99
sl@0
   100
// End of file
sl@0
   101
#endif