tamlin's work on compiling the kernel with another compiler than GCC. Patch by Mike Nordell.

svn path=/trunk/; revision=7460
This commit is contained in:
Thomas Bluemel 2004-01-05 14:28:21 +00:00
parent 16da2140a1
commit 583de66b3e
47 changed files with 517 additions and 462 deletions

View file

@ -7,6 +7,9 @@
#ifndef __AFD_SHARED_H
#define __AFD_SHARED_H
#include <pshpack1.h>
#define AfdSocket "AfdSocket"
#define AFD_SOCKET_LENGTH (sizeof(AfdSocket) - 1)
@ -19,7 +22,7 @@ typedef struct _AFD_SOCKET_INFORMATION {
DWORD NotificationEvents;
UNICODE_STRING TdiDeviceName;
SOCKADDR Name;
} __attribute__((packed)) AFD_SOCKET_INFORMATION, *PAFD_SOCKET_INFORMATION;
} AFD_SOCKET_INFORMATION, *PAFD_SOCKET_INFORMATION;
/* AFD IOCTL code definitions */
@ -65,21 +68,21 @@ typedef struct _AFD_SOCKET_INFORMATION {
typedef struct _FILE_REQUEST_BIND {
SOCKADDR Name;
} __attribute__((packed)) FILE_REQUEST_BIND, *PFILE_REQUEST_BIND;
} FILE_REQUEST_BIND, *PFILE_REQUEST_BIND;
typedef struct _FILE_REPLY_BIND {
INT Status;
HANDLE TdiAddressObjectHandle;
HANDLE TdiConnectionObjectHandle;
} __attribute__((packed)) FILE_REPLY_BIND, *PFILE_REPLY_BIND;
} FILE_REPLY_BIND, *PFILE_REPLY_BIND;
typedef struct _FILE_REQUEST_LISTEN {
INT Backlog;
} __attribute__((packed)) FILE_REQUEST_LISTEN, *PFILE_REQUEST_LISTEN;
} FILE_REQUEST_LISTEN, *PFILE_REQUEST_LISTEN;
typedef struct _FILE_REPLY_LISTEN {
INT Status;
} __attribute__((packed)) FILE_REPLY_LISTEN, *PFILE_REPLY_LISTEN;
} FILE_REPLY_LISTEN, *PFILE_REPLY_LISTEN;
typedef struct _FILE_REQUEST_SENDTO {
@ -88,12 +91,12 @@ typedef struct _FILE_REQUEST_SENDTO {
DWORD Flags;
SOCKADDR To;
INT ToLen;
} __attribute__((packed)) FILE_REQUEST_SENDTO, *PFILE_REQUEST_SENDTO;
} FILE_REQUEST_SENDTO, *PFILE_REQUEST_SENDTO;
typedef struct _FILE_REPLY_SENDTO {
INT Status;
DWORD NumberOfBytesSent;
} __attribute__((packed)) FILE_REPLY_SENDTO, *PFILE_REPLY_SENDTO;
} FILE_REPLY_SENDTO, *PFILE_REPLY_SENDTO;
typedef struct _FILE_REQUEST_RECVFROM {
@ -102,12 +105,12 @@ typedef struct _FILE_REQUEST_RECVFROM {
LPDWORD Flags;
LPSOCKADDR From;
LPINT FromLen;
} __attribute__((packed)) FILE_REQUEST_RECVFROM, *PFILE_REQUEST_RECVFROM;
} FILE_REQUEST_RECVFROM, *PFILE_REQUEST_RECVFROM;
typedef struct _FILE_REPLY_RECVFROM {
INT Status;
DWORD NumberOfBytesRecvd;
} __attribute__((packed)) FILE_REPLY_RECVFROM, *PFILE_REPLY_RECVFROM;
} FILE_REPLY_RECVFROM, *PFILE_REPLY_RECVFROM;
typedef struct _FILE_REQUEST_SELECT {
@ -115,56 +118,56 @@ typedef struct _FILE_REQUEST_SELECT {
LPFD_SET WriteFDSet;
LPFD_SET ExceptFDSet;
TIMEVAL Timeout;
} __attribute__((packed)) FILE_REQUEST_SELECT, *PFILE_REQUEST_SELECT;
} FILE_REQUEST_SELECT, *PFILE_REQUEST_SELECT;
typedef struct _FILE_REPLY_SELECT {
INT Status;
DWORD SocketCount;
} __attribute__((packed)) FILE_REPLY_SELECT, *PFILE_REPLY_SELECT;
} FILE_REPLY_SELECT, *PFILE_REPLY_SELECT;
typedef struct _FILE_REQUEST_EVENTSELECT {
WSAEVENT hEventObject;
LONG lNetworkEvents;
} __attribute__((packed)) FILE_REQUEST_EVENTSELECT, *PFILE_REQUEST_EVENTSELECT;
} FILE_REQUEST_EVENTSELECT, *PFILE_REQUEST_EVENTSELECT;
typedef struct _FILE_REPLY_EVENTSELECT {
INT Status;
} __attribute__((packed)) FILE_REPLY_EVENTSELECT, *PFILE_REPLY_EVENTSELECT;
} FILE_REPLY_EVENTSELECT, *PFILE_REPLY_EVENTSELECT;
typedef struct _FILE_REQUEST_ENUMNETWORKEVENTS {
WSAEVENT hEventObject;
} __attribute__((packed)) FILE_REQUEST_ENUMNETWORKEVENTS, *PFILE_REQUEST_ENUMNETWORKEVENTS;
} FILE_REQUEST_ENUMNETWORKEVENTS, *PFILE_REQUEST_ENUMNETWORKEVENTS;
typedef struct _FILE_REPLY_ENUMNETWORKEVENTS {
INT Status;
WSANETWORKEVENTS NetworkEvents;
} __attribute__((packed)) FILE_REPLY_ENUMNETWORKEVENTS, *PFILE_REPLY_ENUMNETWORKEVENTS;
} FILE_REPLY_ENUMNETWORKEVENTS, *PFILE_REPLY_ENUMNETWORKEVENTS;
typedef struct _FILE_REQUEST_RECV {
LPWSABUF Buffers;
DWORD BufferCount;
LPDWORD Flags;
} __attribute__((packed)) FILE_REQUEST_RECV, *PFILE_REQUEST_RECV;
} FILE_REQUEST_RECV, *PFILE_REQUEST_RECV;
typedef struct _FILE_REPLY_RECV {
INT Status;
DWORD NumberOfBytesRecvd;
} __attribute__((packed)) FILE_REPLY_RECV, *PFILE_REPLY_RECV;
} FILE_REPLY_RECV, *PFILE_REPLY_RECV;
typedef struct _FILE_REQUEST_SEND {
LPWSABUF Buffers;
DWORD BufferCount;
DWORD Flags;
} __attribute__((packed)) FILE_REQUEST_SEND, *PFILE_REQUEST_SEND;
} FILE_REQUEST_SEND, *PFILE_REQUEST_SEND;
typedef struct _FILE_REPLY_SEND {
INT Status;
DWORD NumberOfBytesSent;
} __attribute__((packed)) FILE_REPLY_SEND, *PFILE_REPLY_SEND;
} FILE_REPLY_SEND, *PFILE_REPLY_SEND;
typedef struct _FILE_REQUEST_ACCEPT {
@ -172,13 +175,13 @@ typedef struct _FILE_REQUEST_ACCEPT {
INT addrlen;
LPCONDITIONPROC lpfnCondition;
DWORD dwCallbackData;
} __attribute__((packed)) FILE_REQUEST_ACCEPT, *PFILE_REQUEST_ACCEPT;
} FILE_REQUEST_ACCEPT, *PFILE_REQUEST_ACCEPT;
typedef struct _FILE_REPLY_ACCEPT {
INT Status;
INT addrlen;
SOCKET Socket;
} __attribute__((packed)) FILE_REPLY_ACCEPT, *PFILE_REPLY_ACCEPT;
} FILE_REPLY_ACCEPT, *PFILE_REPLY_ACCEPT;
typedef struct _FILE_REQUEST_CONNECT {
@ -188,11 +191,13 @@ typedef struct _FILE_REQUEST_CONNECT {
LPWSABUF lpCalleeData;
LPQOS lpSQOS;
LPQOS lpGQOS;
} __attribute__((packed)) FILE_REQUEST_CONNECT, *PFILE_REQUEST_CONNECT;
} FILE_REQUEST_CONNECT, *PFILE_REQUEST_CONNECT;
typedef struct _FILE_REPLY_CONNECT {
INT Status;
} __attribute__((packed)) FILE_REPLY_CONNECT, *PFILE_REPLY_CONNECT;
} FILE_REPLY_CONNECT, *PFILE_REPLY_CONNECT;
#include <poppack.h>
#endif /*__AFD_SHARED_H */

View file

@ -122,6 +122,8 @@ struct external_scnhdr {
#define STYP_DATA (0x0040) /* section contains data only */
#define STYP_BSS (0x0080) /* section contains bss only */
#include <pshpack1.h>
/********************** LINE NUMBERS **********************/
/* 1 line number entry for every "breakpointable" source line in a section.
@ -131,8 +133,8 @@ struct external_scnhdr {
*/
struct external_lineno {
union {
unsigned long l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */
unsigned long l_paddr __attribute__((packed)); /* (physical) address of line number */
unsigned long l_symndx; /* function name symbol index, iff l_lnno == 0 */
unsigned long l_paddr; /* (physical) address of line number */
} l_addr;
unsigned short l_lnno; /* line number */
};
@ -153,11 +155,11 @@ struct external_syment
union {
char e_name[E_SYMNMLEN];
struct {
unsigned long e_zeroes __attribute__((packed));
unsigned long e_offset __attribute__((packed));
unsigned long e_zeroes;
unsigned long e_offset;
} e;
} e;
unsigned long e_value __attribute__((packed));
unsigned long e_value;
short e_scnum;
unsigned short e_type;
unsigned char e_sclass;
@ -171,18 +173,18 @@ struct external_syment
union external_auxent {
struct {
unsigned long x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */
unsigned long x_tagndx; /* str, un, or enum tag indx */
union {
struct {
unsigned short x_lnno; /* declaration line number */
unsigned short x_size; /* str/union/array size */
} x_lnsz;
unsigned long x_fsize __attribute__((packed)); /* size of function */
unsigned long x_fsize; /* size of function */
} x_misc;
union {
struct { /* if ISFCN, tag, or .bb */
unsigned long x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */
unsigned long x_endndx __attribute__((packed)); /* entry ndx past block end */
unsigned long x_lnnoptr; /* ptr to fcn line # */
unsigned long x_endndx; /* entry ndx past block end */
} x_fcn;
struct { /* if ISARY, up to 4 dimen. */
unsigned short x_dimen[E_DIMNUM];
@ -194,19 +196,19 @@ union external_auxent {
union {
char x_fname[E_FILNMLEN];
struct {
unsigned long x_zeroes __attribute__((packed));
unsigned long x_offset __attribute__((packed));
unsigned long x_zeroes;
unsigned long x_offset;
} x_n;
} x_file;
struct {
unsigned long x_scnlen __attribute__((packed)); /* section length */
unsigned long x_scnlen; /* section length */
unsigned short x_nreloc; /* # relocation entries */
unsigned short x_nlinno; /* # line numbers */
} x_scn;
struct {
unsigned long x_tvfill __attribute__((packed)); /* tv fill value */
unsigned long x_tvfill; /* tv fill value */
unsigned short x_tvlen; /* length of .tv */
unsigned short x_tvran[2]; /* tv range */
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
@ -307,11 +309,13 @@ union external_auxent {
struct external_reloc {
unsigned long r_vaddr __attribute__((packed));
unsigned long r_symndx __attribute__((packed));
unsigned long r_vaddr;
unsigned long r_symndx;
unsigned short r_type;
};
#include <poppack.h>
#define RELOC struct external_reloc
#define RELSZ sizeof(RELOC)

View file

@ -1,4 +1,4 @@
/* $Id: iotypes.h,v 1.61 2003/12/30 18:34:58 fireball Exp $
/* $Id: iotypes.h,v 1.62 2004/01/05 14:28:19 weiden Exp $
*
*/
@ -9,7 +9,7 @@
#include <ntos/disk.h>
#include <ntos/file.h>
#pragma pack(push,4)
#include <pshpack4.h>
/* from winddk.h */
#define POINTER_ALIGNMENT
@ -215,6 +215,8 @@ typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
} CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
#include <pshpack1.h>
typedef struct
{
UCHAR Type;
@ -226,32 +228,32 @@ typedef struct
{
PHYSICAL_ADDRESS Start;
ULONG Length;
} __attribute__((packed)) Port;
} Port;
struct
{
ULONG Level;
ULONG Vector;
ULONG Affinity;
} __attribute__((packed))Interrupt;
} Interrupt;
struct
{
PHYSICAL_ADDRESS Start;
ULONG Length;
} __attribute__((packed))Memory;
} Memory;
struct
{
ULONG Channel;
ULONG Port;
ULONG Reserved1;
} __attribute__((packed))Dma;
} Dma;
struct
{
ULONG DataSize;
ULONG Reserved1;
ULONG Reserved2;
} __attribute__((packed))DeviceSpecificData;
} __attribute__((packed)) u;
} __attribute__((packed)) CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
} DeviceSpecificData;
} u;
} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
typedef struct
{
@ -259,14 +261,14 @@ typedef struct
USHORT Revision;
ULONG Count;
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
} __attribute__((packed))CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
typedef struct
{
INTERFACE_TYPE InterfaceType;
ULONG BusNumber;
CM_PARTIAL_RESOURCE_LIST PartialResourceList;
} __attribute__((packed)) CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
typedef struct
{
@ -274,13 +276,15 @@ typedef struct
CM_FULL_RESOURCE_DESCRIPTOR List[1];
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
#include <poppack.h>
/*
* PURPOSE: IRP stack location
*/
/*
typedef struct __attribute__((packed)) _IO_STACK_LOCATION
typedef struct _IO_STACK_LOCATION
{
UCHAR MajorFunction;
UCHAR MinorFunction;
@ -479,7 +483,7 @@ typedef struct __attribute__((packed)) _IO_STACK_LOCATION
PIO_COMPLETION_ROUTINE CompletionRoutine;
PVOID CompletionContext;
} __attribute__((packed)) IO_STACK_LOCATION, *PIO_STACK_LOCATION;*/
} IO_STACK_LOCATION, *PIO_STACK_LOCATION;*/
typedef struct _IO_STACK_LOCATION {
UCHAR MajorFunction;
@ -1316,6 +1320,6 @@ typedef struct _BUS_INTERFACE_STANDARD {
PGET_SET_DEVICE_DATA GetBusData;
} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
#pragma pack(pop)
#include <poppack.h>
#endif /* __INCLUDE_DDK_IOTYPES_H */

View file

@ -49,6 +49,8 @@ typedef struct _KWAIT_BLOCK
USHORT WaitType;
} KWAIT_BLOCK, *PKWAIT_BLOCK;
#include <pshpack1.h>
typedef struct _DISPATCHER_HEADER
{
UCHAR Type;
@ -57,8 +59,9 @@ typedef struct _DISPATCHER_HEADER
UCHAR Inserted;
LONG SignalState;
LIST_ENTRY WaitListHead;
} __attribute__((packed)) DISPATCHER_HEADER, *PDISPATCHER_HEADER;
} DISPATCHER_HEADER, *PDISPATCHER_HEADER;
#include <poppack.h>
typedef struct _KQUEUE
{
@ -92,6 +95,8 @@ typedef struct _KDEVICE_QUEUE
} KDEVICE_QUEUE, *PKDEVICE_QUEUE;
#include <pshpack1.h>
typedef struct _KAPC
{
CSHORT Type;
@ -108,7 +113,9 @@ typedef struct _KAPC
CCHAR ApcStateIndex;
KPROCESSOR_MODE ApcMode;
USHORT Inserted;
} __attribute__((packed)) KAPC, *PKAPC;
} KAPC, *PKAPC;
#include <poppack.h>
typedef struct _KBUGCHECK_CALLBACK_RECORD
{
@ -130,11 +137,15 @@ typedef struct _KMUTEX
UCHAR ApcDisable;
} KMUTEX, *PKMUTEX, KMUTANT, *PKMUTANT;
#include <pshpack1.h>
typedef struct _KSEMAPHORE
{
DISPATCHER_HEADER Header;
LONG Limit;
} __attribute__((packed)) KSEMAPHORE, *PKSEMAPHORE;
} KSEMAPHORE, *PKSEMAPHORE;
#include <poppack.h>
typedef struct _KEVENT
{
@ -169,6 +180,8 @@ typedef VOID STDCALL_FUNC
/*
* PURPOSE: Defines a delayed procedure call object
*/
#include <pshpack1.h>
typedef struct _KDPC
{
SHORT Type;
@ -180,8 +193,9 @@ typedef struct _KDPC
PVOID SystemArgument1;
PVOID SystemArgument2;
PULONG Lock;
} __attribute__((packed)) KDPC, *PKDPC;
} KDPC, *PKDPC;
#include <poppack.h>
typedef struct _KDEVICE_QUEUE_ENTRY

View file

@ -38,7 +38,7 @@ extern "C" {
#endif /* __cplusplus */
typedef
DWORD CALLBACK (*PPROGRESS_ROUTINE)(
DWORD (CALLBACK *PPROGRESS_ROUTINE)(
LARGE_INTEGER TotalFileSize,
LARGE_INTEGER TotalBytesTransferred,
LARGE_INTEGER StreamSize,
@ -1710,7 +1710,7 @@ RtlSetCriticalSectionSpinCount(
typedef
VOID
CALLBACK (*POVERLAPPED_COMPLETION_ROUTINE)(
(CALLBACK *POVERLAPPED_COMPLETION_ROUTINE)(
DWORD dwErrorCode,
DWORD dwNumberOfBytesTransfered,
LPOVERLAPPED lpOverlapped

View file

@ -1,6 +1,8 @@
#ifndef __INCLUDE_NAPI_WIN32_H
#define __INCLUDE_NAPI_WIN32_H
#include <pshpack1.h>
typedef struct _W32THREAD
{
PVOID MessageQueue;
@ -9,7 +11,10 @@ typedef struct _W32THREAD
struct _KBDTABLES* KeyboardLayout;
struct _DESKTOP_OBJECT* Desktop;
DWORD MessagePumpHookValue;
} __attribute__((packed)) W32THREAD, *PW32THREAD;
} W32THREAD, *PW32THREAD;
#include <poppack.h>
typedef struct _W32PROCESS
{

View file

@ -965,21 +965,21 @@ typedef enum _NET_DEVICE_POWER_STATE {
/* Call Manager */
typedef NDIS_STATUS STDCALL (*CO_CREATE_VC_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*CO_CREATE_VC_HANDLER)(
IN NDIS_HANDLE ProtocolAfContext,
IN NDIS_HANDLE NdisVcHandle,
OUT PNDIS_HANDLE ProtocolVcContext);
typedef NDIS_STATUS STDCALL (*CO_DELETE_VC_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*CO_DELETE_VC_HANDLER)(
IN NDIS_HANDLE ProtocolVcContext);
typedef NDIS_STATUS STDCALL (*CO_REQUEST_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*CO_REQUEST_HANDLER)(
IN NDIS_HANDLE ProtocolAfContext,
IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
IN OUT PNDIS_REQUEST NdisRequest);
typedef VOID STDCALL (*CO_REQUEST_COMPLETE_HANDLER)(
typedef VOID STDCALL_FUNC (*CO_REQUEST_COMPLETE_HANDLER)(
IN NDIS_STATUS Status,
IN NDIS_HANDLE ProtocolAfContext OPTIONAL,
IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
@ -987,7 +987,7 @@ typedef VOID STDCALL (*CO_REQUEST_COMPLETE_HANDLER)(
IN PNDIS_REQUEST NdisRequest);
typedef NDIS_STATUS STDCALL (*CM_OPEN_AF_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*CM_OPEN_AF_HANDLER)(
IN NDIS_HANDLE CallMgrBindingContext,
IN PCO_ADDRESS_FAMILY AddressFamily,
IN NDIS_HANDLE NdisAfHandle,
@ -1043,7 +1043,7 @@ STDCALL
typedef
NDIS_STATUS
STDCALL (*CM_ADD_PARTY_HANDLER)(
STDCALL_FUNC (*CM_ADD_PARTY_HANDLER)(
IN NDIS_HANDLE CallMgrVcContext,
IN OUT PCO_CALL_PARAMETERS CallParameters,
IN NDIS_HANDLE NdisPartyHandle,
@ -1052,7 +1052,7 @@ STDCALL (*CM_ADD_PARTY_HANDLER)(
typedef
NDIS_STATUS
STDCALL (*CM_DROP_PARTY_HANDLER)(
STDCALL_FUNC (*CM_DROP_PARTY_HANDLER)(
IN NDIS_HANDLE CallMgrPartyContext,
IN PVOID CloseData OPTIONAL,
IN UINT Size OPTIONAL
@ -1060,7 +1060,7 @@ STDCALL (*CM_DROP_PARTY_HANDLER)(
typedef
VOID
STDCALL (*CM_ACTIVATE_VC_COMPLETE_HANDLER)(
STDCALL_FUNC (*CM_ACTIVATE_VC_COMPLETE_HANDLER)(
IN NDIS_STATUS Status,
IN NDIS_HANDLE CallMgrVcContext,
IN PCO_CALL_PARAMETERS CallParameters
@ -1068,7 +1068,7 @@ STDCALL (*CM_ACTIVATE_VC_COMPLETE_HANDLER)(
typedef
VOID
STDCALL (*CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
STDCALL_FUNC (*CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
IN NDIS_STATUS Status,
IN NDIS_HANDLE CallMgrVcContext
);
@ -1107,7 +1107,7 @@ typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS {
/* Call Manager clients */
typedef VOID STDCALL (*CL_OPEN_AF_COMPLETE_HANDLER)(
typedef VOID STDCALL_FUNC (*CL_OPEN_AF_COMPLETE_HANDLER)(
IN NDIS_STATUS Status,
IN NDIS_HANDLE ProtocolAfContext,
IN NDIS_HANDLE NdisAfHandle);
@ -4211,7 +4211,7 @@ typedef struct _NDIS_ADAPTER_INFORMATION
/* Prototypes for NDIS_MAC_CHARACTERISTICS */
typedef NDIS_STATUS STDCALL (*OPEN_ADAPTER_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*OPEN_ADAPTER_HANDLER)(
OUT PNDIS_STATUS OpenErrorStatus,
OUT NDIS_HANDLE * MacBindingHandle,
OUT PUINT SelectedMediumIndex,
@ -4222,25 +4222,25 @@ typedef NDIS_STATUS STDCALL (*OPEN_ADAPTER_HANDLER)(
IN UINT OpenOptions,
IN PSTRING AddressingInformation OPTIONAL);
typedef NDIS_STATUS STDCALL (*CLOSE_ADAPTER_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*CLOSE_ADAPTER_HANDLER)(
IN NDIS_HANDLE MacBindingHandle);
typedef NDIS_STATUS STDCALL (*WAN_TRANSFER_DATA_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*WAN_TRANSFER_DATA_HANDLER)(
VOID);
typedef NDIS_STATUS STDCALL (*QUERY_GLOBAL_STATISTICS_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*QUERY_GLOBAL_STATISTICS_HANDLER)(
IN NDIS_HANDLE MacAdapterContext,
IN PNDIS_REQUEST NdisRequest);
typedef VOID STDCALL (*UNLOAD_MAC_HANDLER)(
typedef VOID STDCALL_FUNC (*UNLOAD_MAC_HANDLER)(
IN NDIS_HANDLE MacMacContext);
typedef NDIS_STATUS STDCALL (*ADD_ADAPTER_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*ADD_ADAPTER_HANDLER)(
IN NDIS_HANDLE MacMacContext,
IN NDIS_HANDLE WrapperConfigurationContext,
IN PNDIS_STRING AdapterName);
typedef VOID STDCALL (*REMOVE_ADAPTER_HANDLER)(
typedef VOID STDCALL_FUNC (*REMOVE_ADAPTER_HANDLER)(
IN NDIS_HANDLE MacAdapterContext);
typedef struct _NDIS_MAC_CHARACTERISTICS
@ -4538,21 +4538,21 @@ typedef NDIS_STATUS (FASTCALL *NDIS_M_QUEUE_WORK_ITEM)(
IN NDIS_WORK_ITEM_TYPE WorkItemType,
IN PVOID WorkItemContext);
typedef VOID STDCALL (*NDIS_M_REQ_COMPLETE_HANDLER)(
typedef VOID STDCALL_FUNC (*NDIS_M_REQ_COMPLETE_HANDLER)(
IN NDIS_HANDLE MiniportAdapterHandle,
IN NDIS_STATUS Status);
typedef VOID STDCALL (*NDIS_M_RESET_COMPLETE_HANDLER)(
typedef VOID STDCALL_FUNC (*NDIS_M_RESET_COMPLETE_HANDLER)(
IN NDIS_HANDLE MiniportAdapterHandle,
IN NDIS_STATUS Status,
IN BOOLEAN AddressingReset);
typedef VOID STDCALL (*NDIS_M_SEND_COMPLETE_HANDLER)(
typedef VOID STDCALL_FUNC (*NDIS_M_SEND_COMPLETE_HANDLER)(
IN NDIS_HANDLE MiniportAdapterHandle,
IN PNDIS_PACKET Packet,
IN NDIS_STATUS Status);
typedef VOID STDCALL (*NDIS_M_SEND_RESOURCES_HANDLER)(
typedef VOID STDCALL_FUNC (*NDIS_M_SEND_RESOURCES_HANDLER)(
IN NDIS_HANDLE MiniportAdapterHandle);
typedef BOOLEAN (FASTCALL *NDIS_M_START_SENDS)(
@ -4820,14 +4820,14 @@ struct _NDIS_MINIPORT_BLOCK {
/* Handler prototypes for NDIS_OPEN_BLOCK */
typedef NDIS_STATUS STDCALL (*WAN_SEND_HANDLER)(
typedef NDIS_STATUS STDCALL_FUNC (*WAN_SEND_HANDLER)(
IN NDIS_HANDLE MacBindingHandle,
IN NDIS_HANDLE LinkHandle,
IN PVOID Packet);
/* NDIS 4.0 extension */
typedef VOID STDCALL (*SEND_PACKETS_HANDLER)(
typedef VOID STDCALL_FUNC (*SEND_PACKETS_HANDLER)(
IN NDIS_HANDLE MiniportAdapterContext,
IN PPNDIS_PACKET PacketArray,
IN UINT NumberOfPackets);

View file

@ -83,6 +83,8 @@
#define FOCUS_EVENT (16)
#include <pshpack1.h>
typedef struct _KEY_EVENT_RECORD
{
BOOL bKeyDown;
@ -95,7 +97,10 @@ typedef struct _KEY_EVENT_RECORD
CHAR AsciiChar;
} uChar;
DWORD dwControlKeyState;
} PACKED KEY_EVENT_RECORD;
} KEY_EVENT_RECORD;
#include <poppack.h>
typedef struct _MOUSE_EVENT_RECORD
{

View file

@ -15,8 +15,6 @@
#ifndef __USE_W32API
#define PACKED __attribute__((packed))
#define ANYSIZE_ARRAY (1)
#define DELETE (0x00010000L)

View file

@ -1,4 +1,4 @@
/* $Id: rtltypes.h,v 1.10 2003/08/25 01:37:47 sedwards Exp $
/* $Id: rtltypes.h,v 1.11 2004/01/05 14:28:19 weiden Exp $
*
*/
@ -180,6 +180,9 @@ typedef struct _NLSTABLEINFO
PUSHORT LowerCaseTable;
} NLSTABLEINFO, *PNLSTABLEINFO;
#include <pshpack1.h>
typedef struct _NLS_FILE_HEADER
{
USHORT HeaderSize;
@ -191,7 +194,9 @@ typedef struct _NLS_FILE_HEADER
USHORT TransUniDefaultChar;
USHORT DBCSCodePage;
UCHAR LeadByte[MAXIMUM_LEADBYTES];
} PACKED NLS_FILE_HEADER, *PNLS_FILE_HEADER;
} NLS_FILE_HEADER, *PNLS_FILE_HEADER;
#include <poppack.h>
typedef struct _RTL_GENERIC_TABLE

View file

@ -10,6 +10,8 @@
#ifndef __ASM__
#include <pshpack1.h>
typedef struct _KTSSNOIOPM
{
USHORT PreviousTask;
@ -52,7 +54,8 @@ typedef struct _KTSSNOIOPM
USHORT IoMapBase;
/* no interrupt redirection map */
UCHAR IoBitmap[1];
} PACKED KTSSNOIOPM;
} KTSSNOIOPM;
typedef struct _KTSS
{
@ -96,7 +99,9 @@ typedef struct _KTSS
USHORT IoMapBase;
/* no interrupt redirection map */
UCHAR IoBitmap[8193];
} PACKED KTSS;
} KTSS;
#include <poppack.h>
#endif /* not __ASM__ */

View file

@ -220,13 +220,17 @@ typedef struct _BITMAPCOREINFO {
RGBTRIPLE bmciColors[1];
} BITMAPCOREINFO, *PBITMAPCOREINFO, *LPBITMAPCOREINFO;
#include <pshpack1.h>
typedef struct tagBITMAPFILEHEADER {
WORD bfType;
DWORD bfSize;
WORD bfReserved1;
WORD bfReserved2;
DWORD bfOffBits;
} PACKED BITMAPFILEHEADER;
} BITMAPFILEHEADER;
#include <poppack.h>
typedef struct tagBITMAPINFOHEADER {
DWORD biSize;
@ -510,7 +514,7 @@ typedef struct _RTL_RANGE {
typedef
BOOLEAN
CALLBACK (*PRTL_CONFLICT_RANGE_CALLBACK) (
(CALLBACK *PRTL_CONFLICT_RANGE_CALLBACK) (
PVOID Context,
PRTL_RANGE Range
);
@ -1406,6 +1410,9 @@ typedef struct _DISK_PERFORMANCE {
DWORD QueueDepth;
} DISK_PERFORMANCE ;
#include <pshpack1.h>
typedef struct {
DWORD style;
DWORD dwExtendedStyle;
@ -1414,7 +1421,7 @@ typedef struct {
short cx;
short cy;
WORD id;
} PACKED DLGITEMTEMPLATE;
} DLGITEMTEMPLATE;
typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATE;
typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATE;
@ -1427,7 +1434,10 @@ typedef struct {
short y;
short cx;
short cy;
} PACKED DLGTEMPLATE;
} DLGTEMPLATE;
#include <poppack.h>
typedef DLGTEMPLATE *LPDLGTEMPLATE;
typedef const DLGTEMPLATE *LPCDLGTEMPLATE;
@ -3254,6 +3264,9 @@ typedef struct tagMETAFILEPICT {
HMETAFILE hMF;
} METAFILEPICT, *PMETAFILEPICT, *LPMETAFILEPICT;
#include <pshpack1.h>
typedef struct tagMETAHEADER {
WORD mtType;
WORD mtHeaderSize;
@ -3262,7 +3275,10 @@ typedef struct tagMETAHEADER {
WORD mtNoObjects;
DWORD mtMaxRecord;
WORD mtNoParameters;
} PACKED METAHEADER;
} METAHEADER;
#include <poppack.h>
typedef struct tagMETARECORD {
DWORD rdSize;
@ -4299,6 +4315,9 @@ typedef struct _PREVENT_MEDIA_REMOVAL {
BOOLEAN PreventMediaRemoval;
} PREVENT_MEDIA_REMOVAL ;
#include <pshpack1.h>
typedef struct tagPDA {
DWORD lStructSize;
HWND hwndOwner;
@ -4319,7 +4338,7 @@ typedef struct tagPDA {
LPCSTR lpSetupTemplateName;
HANDLE hPrintTemplate;
HANDLE hSetupTemplate;
} PACKED PRINTDLGA, *LPPRINTDLGA;
} PRINTDLGA, *LPPRINTDLGA;
typedef struct tagPDW {
DWORD lStructSize;
@ -4341,7 +4360,10 @@ typedef struct tagPDW {
LPCWSTR lpSetupTemplateName;
HANDLE hPrintTemplate;
HANDLE hSetupTemplate;
} PACKED PRINTDLGW, *LPPRINTDLGW;
} PRINTDLGW, *LPPRINTDLGW;
#include <poppack.h>
typedef_tident(PRINTDLG)
typedef_tident(LPPRINTDLG)

View file

@ -5,6 +5,8 @@
#include <win32k/dc.h>
#include <win32k/gdiobj.h>
#include <pshpack1.h>
/* Structures for reading icon/cursor files and resources */
// Structures for reading icon files and resources
typedef struct _ICONIMAGE
@ -13,7 +15,7 @@ typedef struct _ICONIMAGE
RGBQUAD icColors[1]; // Color table
BYTE icXOR[1]; // DIB bits for XOR mask
BYTE icAND[1]; // DIB bits for AND mask
} PACKED ICONIMAGE, *LPICONIMAGE;
} ICONIMAGE, *LPICONIMAGE;
typedef struct _CURSORIMAGE
{
@ -21,7 +23,7 @@ typedef struct _CURSORIMAGE
RGBQUAD icColors[1]; // Color table
BYTE icXOR[1]; // DIB bits for XOR mask
BYTE icAND[1]; // DIB bits for AND mask
} PACKED CURSORIMAGE, *LPCURSORIMAGE;
} CURSORIMAGE, *LPCURSORIMAGE;
typedef struct
{
@ -29,25 +31,25 @@ typedef struct
BYTE bHeight;
BYTE bColorCount;
BYTE bReserved;
} PACKED ICONRESDIR;
} ICONRESDIR;
typedef struct
{
WORD wWidth;
WORD wHeight;
} PACKED CURSORRESDIR;
} CURSORRESDIR;
typedef struct
{
WORD wPlanes; // Number of Color Planes in the XOR image
WORD wBitCount; // Bits per pixel in the XOR image
} PACKED ICONDIR;
} ICONDIR;
typedef struct
{
WORD wXHotspot; // Number of Color Planes in the XOR image
WORD wYHotspot; // Bits per pixel in the XOR image
} PACKED CURSORDIR;
} CURSORDIR;
typedef struct
{
@ -61,15 +63,15 @@ typedef struct
} Info;
DWORD dwBytesInRes; // How many bytes in this resource?
DWORD dwImageOffset; // Where in the file is this image?
} PACKED CURSORICONDIRENTRY;
} CURSORICONDIRENTRY;
typedef struct
{
WORD idReserved; // Reserved (must be 0)
WORD idType; // Resource Type (1 for icons, 0 for cursors)
WORD idCount; // How many images?
CURSORICONDIRENTRY idEntries[1] __attribute__((packed)); // An entry for idCount number of images
} PACKED CURSORICONDIR;
CURSORICONDIRENTRY idEntries[1]; // An entry for idCount number of images
} CURSORICONDIR;
typedef struct
{
@ -81,14 +83,16 @@ typedef struct
WORD wBitCount; // Bits per pixel
DWORD dwBytesInRes; // how many bytes in this resource?
WORD nID; // the ID
} PACKED GRPCURSORICONDIRENTRY;
} GRPCURSORICONDIRENTRY;
typedef struct
{
WORD idReserved; // Reserved (must be 0)
WORD idType; // Resource type (1 for icons)
WORD idCount; // How many images?
GRPCURSORICONDIRENTRY idEntries[1] PACKED; // The entries for each image
} PACKED GRPCURSORICONDIR;
GRPCURSORICONDIRENTRY idEntries[1]; // The entries for each image
} GRPCURSORICONDIR;
#include <poppack.h>
#endif

View file

@ -4,8 +4,8 @@
#include <ddk/winddi.h>
typedef BOOL STDCALL (*PGD_ENABLEDRIVER)(ULONG, ULONG, PDRVENABLEDATA);
typedef DHPDEV STDCALL (*PGD_ENABLEPDEV)(DEVMODEW *,
typedef BOOL STDCALL_FUNC (*PGD_ENABLEDRIVER)(ULONG, ULONG, PDRVENABLEDATA);
typedef DHPDEV STDCALL_FUNC (*PGD_ENABLEPDEV)(DEVMODEW *,
LPWSTR,
ULONG,
HSURF *,
@ -16,84 +16,84 @@ typedef DHPDEV STDCALL (*PGD_ENABLEPDEV)(DEVMODEW *,
LPWSTR,
LPWSTR,
HANDLE);
typedef VOID STDCALL (*PGD_COMPLETEPDEV)(DHPDEV, HDEV);
typedef VOID STDCALL (*PGD_DISABLEPDEV)(DHPDEV);
typedef HSURF STDCALL (*PGD_ENABLESURFACE)(DHPDEV);
typedef VOID STDCALL (*PGD_DISABLESURFACE)(DHPDEV);
typedef BOOL STDCALL (*PGD_ASSERTMODE)(DHPDEV, BOOL);
typedef BOOL STDCALL (*PGD_RESETPDEV)(DHPDEV, DHPDEV);
typedef HBITMAP STDCALL (*PGD_CREATEDEVICEBITMAP)(DHPDEV, SIZEL, ULONG);
typedef VOID STDCALL (*PGD_DELETEDEVICEBITMAP)(DHSURF);
typedef BOOL STDCALL (*PGD_REALIZEBRUSH)(BRUSHOBJ*, SURFOBJ*, SURFOBJ*, SURFOBJ*,
typedef VOID STDCALL_FUNC (*PGD_COMPLETEPDEV)(DHPDEV, HDEV);
typedef VOID STDCALL_FUNC (*PGD_DISABLEPDEV)(DHPDEV);
typedef HSURF STDCALL_FUNC (*PGD_ENABLESURFACE)(DHPDEV);
typedef VOID STDCALL_FUNC (*PGD_DISABLESURFACE)(DHPDEV);
typedef BOOL STDCALL_FUNC (*PGD_ASSERTMODE)(DHPDEV, BOOL);
typedef BOOL STDCALL_FUNC (*PGD_RESETPDEV)(DHPDEV, DHPDEV);
typedef HBITMAP STDCALL_FUNC (*PGD_CREATEDEVICEBITMAP)(DHPDEV, SIZEL, ULONG);
typedef VOID STDCALL_FUNC (*PGD_DELETEDEVICEBITMAP)(DHSURF);
typedef BOOL STDCALL_FUNC (*PGD_REALIZEBRUSH)(BRUSHOBJ*, SURFOBJ*, SURFOBJ*, SURFOBJ*,
XLATEOBJ*, ULONG);
typedef ULONG STDCALL (*PGD_DITHERCOLOR)(DHPDEV, ULONG, ULONG, PULONG);
typedef BOOL STDCALL (*PGD_STROKEPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*, XFORMOBJ*,
typedef ULONG STDCALL_FUNC (*PGD_DITHERCOLOR)(DHPDEV, ULONG, ULONG, PULONG);
typedef BOOL STDCALL_FUNC (*PGD_STROKEPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*, XFORMOBJ*,
BRUSHOBJ*, POINTL*, PLINEATTRS, MIX);
typedef BOOL STDCALL (*PGD_FILLPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*, BRUSHOBJ*,
typedef BOOL STDCALL_FUNC (*PGD_FILLPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*, BRUSHOBJ*,
POINTL*, MIX, ULONG);
typedef BOOL STDCALL (*PGD_STROKEANDFILLPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*,
typedef BOOL STDCALL_FUNC (*PGD_STROKEANDFILLPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*,
XFORMOBJ*, BRUSHOBJ*, PLINEATTRS,
BRUSHOBJ*, POINTL*, MIX, ULONG);
typedef BOOL STDCALL (*PGD_PAINT)(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, POINTL*, MIX);
typedef BOOL STDCALL (*PGD_BITBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*,
typedef BOOL STDCALL_FUNC (*PGD_PAINT)(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, POINTL*, MIX);
typedef BOOL STDCALL_FUNC (*PGD_BITBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*,
XLATEOBJ*, RECTL*, POINTL*, POINTL*, BRUSHOBJ*,
POINTL*, ROP4);
typedef BOOL STDCALL (*PGD_TRANSPARENTBLT)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, RECTL*, ULONG, ULONG);
typedef BOOL STDCALL (*PGD_COPYBITS)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*,
typedef BOOL STDCALL_FUNC (*PGD_TRANSPARENTBLT)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, RECTL*, ULONG, ULONG);
typedef BOOL STDCALL_FUNC (*PGD_COPYBITS)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*,
RECTL*, POINTL*);
typedef BOOL STDCALL (*PGD_STRETCHBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*,
typedef BOOL STDCALL_FUNC (*PGD_STRETCHBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*,
XLATEOBJ*, COLORADJUSTMENT*, POINTL*,
RECTL*, RECTL*, POINTL*, ULONG);
typedef BOOL STDCALL (*PGD_SETPALETTE)(DHPDEV, PALOBJ*, ULONG, ULONG, ULONG);
typedef BOOL STDCALL (*PGD_TEXTOUT)(SURFOBJ*, STROBJ*, FONTOBJ*, CLIPOBJ*, RECTL*,
typedef BOOL STDCALL_FUNC (*PGD_SETPALETTE)(DHPDEV, PALOBJ*, ULONG, ULONG, ULONG);
typedef BOOL STDCALL_FUNC (*PGD_TEXTOUT)(SURFOBJ*, STROBJ*, FONTOBJ*, CLIPOBJ*, RECTL*,
RECTL*, BRUSHOBJ*, BRUSHOBJ*, POINTL*, MIX);
typedef ULONG STDCALL (*PGD_ESCAPE)(SURFOBJ*, ULONG, ULONG, PVOID *, ULONG, PVOID *);
typedef ULONG STDCALL (*PGD_DRAWESCAPE)(SURFOBJ*, ULONG, CLIPOBJ*, RECTL*, ULONG,
typedef ULONG STDCALL_FUNC (*PGD_ESCAPE)(SURFOBJ*, ULONG, ULONG, PVOID *, ULONG, PVOID *);
typedef ULONG STDCALL_FUNC (*PGD_DRAWESCAPE)(SURFOBJ*, ULONG, CLIPOBJ*, RECTL*, ULONG,
PVOID *);
typedef PIFIMETRICS STDCALL (*PGD_QUERYFONT)(DHPDEV, ULONG, ULONG, PULONG);
typedef PVOID STDCALL (*PGD_QUERYFONTTREE)(DHPDEV, ULONG, ULONG, ULONG, PULONG);
typedef LONG STDCALL (*PGD_QUERYFONTDATA)(DHPDEV, FONTOBJ*, ULONG, HGLYPH, GLYPHDATA*,
typedef PIFIMETRICS STDCALL_FUNC (*PGD_QUERYFONT)(DHPDEV, ULONG, ULONG, PULONG);
typedef PVOID STDCALL_FUNC (*PGD_QUERYFONTTREE)(DHPDEV, ULONG, ULONG, ULONG, PULONG);
typedef LONG STDCALL_FUNC (*PGD_QUERYFONTDATA)(DHPDEV, FONTOBJ*, ULONG, HGLYPH, GLYPHDATA*,
PVOID, ULONG);
typedef ULONG STDCALL (*PGD_SETPOINTERSHAPE)(SURFOBJ*, SURFOBJ*, SURFOBJ*, XLATEOBJ*,
typedef ULONG STDCALL_FUNC (*PGD_SETPOINTERSHAPE)(SURFOBJ*, SURFOBJ*, SURFOBJ*, XLATEOBJ*,
LONG, LONG, LONG, LONG, RECTL*, ULONG);
typedef VOID STDCALL (*PGD_MOVEPOINTER)(SURFOBJ*, LONG, LONG, RECTL*);
typedef BOOL STDCALL (*PGD_LINETO)(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, LONG, LONG, LONG,
typedef VOID STDCALL_FUNC (*PGD_MOVEPOINTER)(SURFOBJ*, LONG, LONG, RECTL*);
typedef BOOL STDCALL_FUNC (*PGD_LINETO)(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, LONG, LONG, LONG,
LONG, RECTL*, MIX);
typedef BOOL STDCALL (*PGD_SENDPAGE)(SURFOBJ*);
typedef BOOL STDCALL (*PGD_STARTPAGE)(SURFOBJ*);
typedef BOOL STDCALL (*PGD_ENDDOC)(SURFOBJ*, ULONG);
typedef BOOL STDCALL (*PGD_STARTDOC)(SURFOBJ*, PWSTR, DWORD);
typedef ULONG STDCALL (*PGD_GETGLYPHMODE)(DHPDEV, FONTOBJ*);
typedef VOID STDCALL (*PGD_SYNCHRONIZE)(DHPDEV, RECTL*);
typedef ULONG STDCALL (*PGD_SAVESCREENBITS)(SURFOBJ*, ULONG, ULONG, RECTL*);
typedef ULONG STDCALL (*PGD_GETMODES)(HANDLE, ULONG, PDEVMODEW);
typedef VOID STDCALL (*PGD_FREE)(PVOID, ULONG);
typedef VOID STDCALL (*PGD_DESTROYFONT)(FONTOBJ*);
typedef LONG STDCALL (*PGD_QUERYFONTCAPS)(ULONG, PULONG);
typedef ULONG STDCALL (*PGD_LOADFONTFILE)(ULONG, PVOID, ULONG, ULONG);
typedef BOOL STDCALL (*PGD_UNLOADFONTFILE)(ULONG);
typedef ULONG STDCALL (*PGD_FONTMANAGEMENT)(SURFOBJ*, FONTOBJ*, ULONG, ULONG, PVOID,
typedef BOOL STDCALL_FUNC (*PGD_SENDPAGE)(SURFOBJ*);
typedef BOOL STDCALL_FUNC (*PGD_STARTPAGE)(SURFOBJ*);
typedef BOOL STDCALL_FUNC (*PGD_ENDDOC)(SURFOBJ*, ULONG);
typedef BOOL STDCALL_FUNC (*PGD_STARTDOC)(SURFOBJ*, PWSTR, DWORD);
typedef ULONG STDCALL_FUNC (*PGD_GETGLYPHMODE)(DHPDEV, FONTOBJ*);
typedef VOID STDCALL_FUNC (*PGD_SYNCHRONIZE)(DHPDEV, RECTL*);
typedef ULONG STDCALL_FUNC (*PGD_SAVESCREENBITS)(SURFOBJ*, ULONG, ULONG, RECTL*);
typedef ULONG STDCALL_FUNC (*PGD_GETMODES)(HANDLE, ULONG, PDEVMODEW);
typedef VOID STDCALL_FUNC (*PGD_FREE)(PVOID, ULONG);
typedef VOID STDCALL_FUNC (*PGD_DESTROYFONT)(FONTOBJ*);
typedef LONG STDCALL_FUNC (*PGD_QUERYFONTCAPS)(ULONG, PULONG);
typedef ULONG STDCALL_FUNC (*PGD_LOADFONTFILE)(ULONG, PVOID, ULONG, ULONG);
typedef BOOL STDCALL_FUNC (*PGD_UNLOADFONTFILE)(ULONG);
typedef ULONG STDCALL_FUNC (*PGD_FONTMANAGEMENT)(SURFOBJ*, FONTOBJ*, ULONG, ULONG, PVOID,
ULONG, PVOID);
typedef LONG STDCALL (*PGD_QUERYTRUETYPETABLE)(ULONG, ULONG, ULONG, PTRDIFF, ULONG,
typedef LONG STDCALL_FUNC (*PGD_QUERYTRUETYPETABLE)(ULONG, ULONG, ULONG, PTRDIFF, ULONG,
PBYTE);
typedef LONG STDCALL (*PGD_QUERYTRUETYPEOUTLINE)(DHPDEV, FONTOBJ*, HGLYPH, BOOL,
typedef LONG STDCALL_FUNC (*PGD_QUERYTRUETYPEOUTLINE)(DHPDEV, FONTOBJ*, HGLYPH, BOOL,
GLYPHDATA*, ULONG, TTPOLYGONHEADER*);
typedef PVOID STDCALL (*PGD_GETTRUETYPEFILE)(ULONG, PULONG);
typedef LONG STDCALL (*PGD_QUERYFONTFILE)(ULONG, ULONG, ULONG, PULONG);
typedef BOOL STDCALL (*PGD_QUERYADVANCEWIDTHS)(DHPDEV, FONTOBJ*, ULONG, HGLYPH *,
typedef PVOID STDCALL_FUNC (*PGD_GETTRUETYPEFILE)(ULONG, PULONG);
typedef LONG STDCALL_FUNC (*PGD_QUERYFONTFILE)(ULONG, ULONG, ULONG, PULONG);
typedef BOOL STDCALL_FUNC (*PGD_QUERYADVANCEWIDTHS)(DHPDEV, FONTOBJ*, ULONG, HGLYPH *,
PVOID *, ULONG);
typedef BOOL STDCALL (*PGD_SETPIXELFORMAT)(SURFOBJ*, LONG, ULONG);
typedef LONG STDCALL (*PGD_DESCRIBEPIXELFORMAT)(DHPDEV, LONG, ULONG,
typedef BOOL STDCALL_FUNC (*PGD_SETPIXELFORMAT)(SURFOBJ*, LONG, ULONG);
typedef LONG STDCALL_FUNC (*PGD_DESCRIBEPIXELFORMAT)(DHPDEV, LONG, ULONG,
PPIXELFORMATDESCRIPTOR);
typedef BOOL STDCALL (*PGD_SWAPBUFFERS)(SURFOBJ*, PWNDOBJ);
typedef BOOL STDCALL (*PGD_STARTBANDING)(SURFOBJ*, POINTL*);
typedef BOOL STDCALL (*PGD_NEXTBAND)(SURFOBJ*, POINTL*);
typedef BOOL STDCALL_FUNC (*PGD_SWAPBUFFERS)(SURFOBJ*, PWNDOBJ);
typedef BOOL STDCALL_FUNC (*PGD_STARTBANDING)(SURFOBJ*, POINTL*);
typedef BOOL STDCALL_FUNC (*PGD_NEXTBAND)(SURFOBJ*, POINTL*);
typedef BOOL STDCALL (*PGD_GETDIRECTDRAWINFO)(DHPDEV, PDD_HALINFO, PDWORD, VIDEOMEMORY*, PDWORD, PDWORD);
typedef BOOL STDCALL (*PGD_ENABLEDIRECTDRAW)(DHPDEV, PDD_CALLBACKS, PDD_SURFACECALLBACKS, PDD_PALETTECALLBACKS);
typedef VOID STDCALL (*PGD_DISABLEDIRECTDRAW)(DHPDEV);
typedef BOOL STDCALL_FUNC (*PGD_GETDIRECTDRAWINFO)(DHPDEV, PDD_HALINFO, PDWORD, VIDEOMEMORY*, PDWORD, PDWORD);
typedef BOOL STDCALL_FUNC (*PGD_ENABLEDIRECTDRAW)(DHPDEV, PDD_CALLBACKS, PDD_SURFACECALLBACKS, PDD_PALETTECALLBACKS);
typedef VOID STDCALL_FUNC (*PGD_DISABLEDIRECTDRAW)(DHPDEV);
typedef LONG STDCALL (*PGD_QUERYSPOOLTYPE)(DHPDEV, LPWSTR);
typedef LONG STDCALL_FUNC (*PGD_QUERYSPOOLTYPE)(DHPDEV, LPWSTR);
typedef struct _DRIVER_FUNCTIONS

View file

@ -39,6 +39,7 @@ static inline struct _TEB * NtCurrentTeb(void)
{
struct _TEB * pTeb;
#if defined(__GNUC__)
/* FIXME: instead of hardcoded offsets, use offsetof() - if possible */
__asm__ __volatile__
(
@ -46,6 +47,12 @@ static inline struct _TEB * NtCurrentTeb(void)
: "=r" (pTeb) /* can't have two memory operands */
: /* no inputs */
);
#elif defined(_MSC_VER)
__asm mov eax, fs:0x18
__asm mov pTeb, eax
#else
#error Unknown compiler for inline assembler
#endif
return pTeb;
}

View file

@ -52,7 +52,11 @@
// BLOCK_OFFSET = offset in file after header block
typedef ULONG BLOCK_OFFSET, *PBLOCK_OFFSET;
#include <pshpack1.h>
/* header for registry hive file : */
typedef struct _HIVE_HEADER
{
/* Hive identifier "regf" (0x66676572) */
@ -97,7 +101,8 @@ typedef struct _HIVE_HEADER
/* Checksum of first 0x200 bytes */
ULONG Checksum;
} __attribute__((packed)) HIVE_HEADER, *PHIVE_HEADER;
} HIVE_HEADER, *PHIVE_HEADER;
typedef struct _HBIN
{
@ -118,13 +123,15 @@ typedef struct _HBIN
/* ? */
ULONG Unused2;
} __attribute__((packed)) HBIN, *PHBIN;
} HBIN, *PHBIN;
typedef struct _CELL_HEADER
{
/* <0 if used, >0 if free */
LONG CellSize;
} __attribute__((packed)) CELL_HEADER, *PCELL_HEADER;
} CELL_HEADER, *PCELL_HEADER;
typedef struct _KEY_CELL
{
@ -180,8 +187,9 @@ typedef struct _KEY_CELL
USHORT ClassSize;
/* Name of key (not zero terminated) */
UCHAR Name[0];
} __attribute__((packed)) KEY_CELL, *PKEY_CELL;
UCHAR Name[1];
} KEY_CELL, *PKEY_CELL;
/* KEY_CELL.Flags constants */
#define REG_KEY_ROOT_CELL 0x0C
@ -199,7 +207,7 @@ typedef struct _HASH_RECORD
{
BLOCK_OFFSET KeyOffset;
ULONG HashValue;
} __attribute__((packed)) HASH_RECORD, *PHASH_RECORD;
} HASH_RECORD, *PHASH_RECORD;
typedef struct _HASH_TABLE_CELL
{
@ -207,14 +215,14 @@ typedef struct _HASH_TABLE_CELL
USHORT Id;
USHORT HashTableSize;
HASH_RECORD Table[0];
} __attribute__((packed)) HASH_TABLE_CELL, *PHASH_TABLE_CELL;
} HASH_TABLE_CELL, *PHASH_TABLE_CELL;
typedef struct _VALUE_LIST_CELL
{
LONG CellSize;
BLOCK_OFFSET ValueOffset[0];
} __attribute__((packed)) VALUE_LIST_CELL, *PVALUE_LIST_CELL;
} VALUE_LIST_CELL, *PVALUE_LIST_CELL;
typedef struct _VALUE_CELL
{
@ -227,7 +235,7 @@ typedef struct _VALUE_CELL
USHORT Flags;
USHORT Unused1;
UCHAR Name[0]; /* warning : not zero terminated */
} __attribute__((packed)) VALUE_CELL, *PVALUE_CELL;
} VALUE_CELL, *PVALUE_CELL;
/* VALUE_CELL.Flags constants */
#define REG_VALUE_NAME_PACKED 0x0001
@ -241,7 +249,10 @@ typedef struct _DATA_CELL
{
LONG CellSize;
UCHAR Data[0];
} __attribute__((packed)) DATA_CELL, *PDATA_CELL;
} DATA_CELL, *PDATA_CELL;
#include <poppack.h>
typedef struct _REGISTRY_HIVE
{

View file

@ -1,4 +1,4 @@
/* $Id: import.c,v 1.26 2003/12/14 17:58:00 hbirr Exp $
/* $Id: import.c,v 1.27 2004/01/05 14:28:19 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -105,7 +105,7 @@ CmImportBinaryHive (PCHAR ChunkBase,
ExFreePool (Hive->BlockList);
ExFreePool (Hive->HiveHeader);
ExFreePool (Hive);
return Status;
return (BOOLEAN)Status;
}
/* Initialize the free cell list */
@ -118,7 +118,7 @@ CmImportBinaryHive (PCHAR ChunkBase,
ExFreePool (Hive->HiveHeader);
ExFreePool (Hive);
return Status;
return (BOOLEAN)Status;
}
if (!(Hive->Flags & HIVE_NO_FILE))
@ -134,7 +134,7 @@ CmImportBinaryHive (PCHAR ChunkBase,
ExFreePool (Hive->HiveHeader);
ExFreePool (Hive);
return Status;
return (BOOLEAN)Status;
}
}

View file

@ -2251,7 +2251,7 @@ CmiGetMaxValueDataLength(PREGISTRY_HIVE RegistryHive,
CurValueCell = CmiGetCell (RegistryHive,
ValueListCell->ValueOffset[i],NULL);
if ((CurValueCell != NULL) &&
(MaxValueData < (CurValueCell->DataSize & REG_DATA_SIZE_MASK)))
(MaxValueData < (LONG)(CurValueCell->DataSize & REG_DATA_SIZE_MASK)))
{
MaxValueData = CurValueCell->DataSize & REG_DATA_SIZE_MASK;
}
@ -2752,7 +2752,7 @@ CmiScanKeyForValue(IN PREGISTRY_HIVE RegistryHive,
CmiComparePackedNames(ValueName,
CurValueCell->Name,
CurValueCell->NameSize,
CurValueCell->Flags & REG_VALUE_NAME_PACKED))
(BOOLEAN)((CurValueCell->Flags & REG_VALUE_NAME_PACKED) ? TRUE : FALSE)))
{
*ValueCell = CurValueCell;
if (VBOffset)
@ -2929,7 +2929,7 @@ CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
CmiComparePackedNames(ValueName,
CurValueCell->Name,
CurValueCell->NameSize,
CurValueCell->Flags & REG_VALUE_NAME_PACKED))
(BOOLEAN)((CurValueCell->Flags & REG_VALUE_NAME_PACKED) ? TRUE : FALSE)))
{
CmiDestroyValueCell(RegistryHive, CurValueCell, ValueListCell->ValueOffset[i]);
@ -2993,8 +2993,9 @@ CmiAllocateHashTableCell (IN PREGISTRY_HIVE RegistryHive,
}
else
{
assert(SubKeyCount <= 0xffff); /* should really be USHORT_MAX or similar */
NewHashBlock->Id = REG_HASH_TABLE_CELL_ID;
NewHashBlock->HashTableSize = SubKeyCount;
NewHashBlock->HashTableSize = (USHORT)SubKeyCount;
*HashBlock = NewHashBlock;
}
@ -3107,8 +3108,9 @@ CmiAllocateValueCell(PREGISTRY_HIVE RegistryHive,
}
else
{
assert(NameSize <= 0xffff); /* should really be USHORT_MAX or similar */
NewValueCell->Id = REG_VALUE_CELL_ID;
NewValueCell->NameSize = NameSize;
NewValueCell->NameSize = (USHORT)NameSize;
if (Packable)
{
/* Pack the value name */

View file

@ -53,13 +53,14 @@ NtShutdownSystem(IN SHUTDOWN_ACTION Action)
#else
PopSetSystemPowerState(PowerSystemShutdown);
#ifdef __GNUC__
__asm__("cli\n");
#if defined(__GNUC__)
__asm__("cli\n");
#elif defined(_MSC_VER)
__asm cli
__asm cli
#else
#error Unknown compiler for inline assembler
#endif
while (TRUE)
{
;

View file

@ -68,8 +68,8 @@ extern inline PULONG get_page_directory(void)
*/
#define PAGE_TABLE_SIZE (4*1024*1024)
#define PAGE_MASK(x) (x&(~0xfff))
#define VADDR_TO_PT_OFFSET(x) (((x/1024)%4096))
#define PAGE_MASK(x) ((x)&(~0xfff))
#define VADDR_TO_PT_OFFSET(x) ((((x)/1024)%4096))
#define VADDR_TO_PD_OFFSET(x) ((x)/(4*1024*1024))
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_MM_H */

View file

@ -21,6 +21,7 @@
#define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk")
#define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo")
#include <pshpack1.h>
/*
* Defines a descriptor as it appears in the processor tables
*/
@ -28,7 +29,9 @@ typedef struct _DESCRIPTOR
{
ULONG a;
ULONG b;
} __attribute__ ((packed)) IDT_DESCRIPTOR, GDT_DESCRIPTOR;
} IDT_DESCRIPTOR, GDT_DESCRIPTOR;
#include <poppack.h>
extern IDT_DESCRIPTOR KiIdt[256];
//extern GDT_DESCRIPTOR KiGdt[256];

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: ps.h,v 1.56 2003/12/30 00:12:47 hyperion Exp $
/* $Id: ps.h,v 1.57 2004/01/05 14:28:20 weiden Exp $
*
* FILE: ntoskrnl/ke/kthread.c
* PURPOSE: Process manager definitions
@ -54,6 +54,8 @@ extern LCID PsDefaultSystemLocaleId;
#ifndef __USE_W32API
#include <pshpack1.h>
typedef struct _KAPC_STATE
{
LIST_ENTRY ApcListHead[2];
@ -61,10 +63,14 @@ typedef struct _KAPC_STATE
UCHAR KernelApcInProgress;
UCHAR KernelApcPending;
USHORT UserApcPending;
} __attribute__((packed)) KAPC_STATE, *PKAPC_STATE;
} KAPC_STATE, *PKAPC_STATE;
#include <poppack.h>
#endif /* __USE_W32API */
#include <pshpack1.h>
typedef struct _KTHREAD
{
/* For waiting on thread exit */
@ -152,7 +158,9 @@ typedef struct _KTHREAD
/* Added by Phillip Susi for list of threads in a process */
LIST_ENTRY ProcessThreadListEntry; /* 1B0 */
} __attribute__((packed)) KTHREAD;
} KTHREAD;
#include <poppack.h>
/* Top level irp definitions. */
#define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
@ -176,6 +184,8 @@ typedef struct
SECURITY_IMPERSONATION_LEVEL Level; // 0x8
} PS_IMPERSONATION_INFO, *PPS_IMPERSONATION_INFO;
#include <pshpack1.h>
typedef struct _ETHREAD
{
KTHREAD Tcb; /* 000 */
@ -226,7 +236,10 @@ typedef struct _ETHREAD
struct _W32THREAD* Win32Thread;
} __attribute__((packed)) ETHREAD;
} ETHREAD;
#include <poppack.h>
#ifndef __USE_W32API

View file

@ -1,4 +1,4 @@
/* $Id: pnproot.c,v 1.19 2003/12/30 18:52:04 fireball Exp $
/* $Id: pnproot.c,v 1.20 2004/01/05 14:28:20 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -49,23 +49,8 @@ typedef enum {
} PNPROOT_DEVICE_STATE;
#if defined(__GNUC__)
typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION
{
// Pointer to device object, this device extension is associated with
PDEVICE_OBJECT DeviceObject;
// Wether this device extension is for an FDO or PDO
BOOLEAN IsFDO;
// Wether the device is removed
BOOLEAN Removed;
// Current device power state for the device
DEVICE_POWER_STATE DevicePowerState;
} __attribute((packed)) PNPROOT_COMMON_DEVICE_EXTENSION, *PPNPROOT_COMMON_DEVICE_EXTENSION;
#elif defined(_MSC_VER)
#include <pshpack1.h>
typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION
{
// Pointer to device object, this device extension is associated with
@ -77,30 +62,10 @@ typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION
// Current device power state for the device
DEVICE_POWER_STATE DevicePowerState;
} PNPROOT_COMMON_DEVICE_EXTENSION, *PPNPROOT_COMMON_DEVICE_EXTENSION;
#include <poppack.h>
#else
#error Unknown compiler for structure packing
#endif
#if defined(__GNUC__)
/* Physical Device Object device extension for a child device */
typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
{
// Common device data
PNPROOT_COMMON_DEVICE_EXTENSION Common;
// Device ID
UNICODE_STRING DeviceID;
// Instance ID
UNICODE_STRING InstanceID;
} __attribute((packed)) PNPROOT_PDO_DEVICE_EXTENSION, *PPNPROOT_PDO_DEVICE_EXTENSION;
#elif defined(_MSC_VER)
#include <pshpack1.h>
typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
{
// Common device data
PNPROOT_COMMON_DEVICE_EXTENSION Common;
@ -109,39 +74,10 @@ typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
// Instance ID
UNICODE_STRING InstanceID;
} PNPROOT_PDO_DEVICE_EXTENSION, *PPNPROOT_PDO_DEVICE_EXTENSION;
#include <poppack.h>
#else
#error Unknown compiler for structure packing
#endif
#if defined(__GNUC__)
/* Functional Device Object device extension for the PCI driver device object */
typedef struct _PNPROOT_FDO_DEVICE_EXTENSION
{
// Common device data
PNPROOT_COMMON_DEVICE_EXTENSION Common;
// Physical Device Object
PDEVICE_OBJECT Pdo;
// Lower device object
PDEVICE_OBJECT Ldo;
// Current state of the driver
PNPROOT_DEVICE_STATE State;
// Namespace device list
LIST_ENTRY DeviceListHead;
// Number of (not removed) devices in device list
ULONG DeviceListCount;
// Lock for namespace device list
// FIXME: Use fast mutex instead?
KSPIN_LOCK DeviceListLock;
} __attribute((packed)) PNPROOT_FDO_DEVICE_EXTENSION, *PPNPROOT_FDO_DEVICE_EXTENSION;
#elif defined(_MSC_VER)
#include <pshpack1.h>
typedef struct _PNPROOT_FDO_DEVICE_EXTENSION
{
// Common device data
PNPROOT_COMMON_DEVICE_EXTENSION Common;
@ -159,11 +95,8 @@ typedef struct _PNPROOT_FDO_DEVICE_EXTENSION
// FIXME: Use fast mutex instead?
KSPIN_LOCK DeviceListLock;
} PNPROOT_FDO_DEVICE_EXTENSION, *PPNPROOT_FDO_DEVICE_EXTENSION;
#include <poppack.h>
#else
#error Unknown compiler for structure packing
#endif
#include <poppack.h>

View file

@ -1,4 +1,4 @@
/* $Id: xhaldrv.c,v 1.42 2003/12/30 18:52:04 fireball Exp $
/* $Id: xhaldrv.c,v 1.43 2004/01/05 14:28:20 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -26,6 +26,7 @@
#define PARTITION_TBL_SIZE 4
#include <pshpack1.h>
typedef struct _PARTITION
{
@ -39,7 +40,7 @@ typedef struct _PARTITION
unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */
unsigned int StartingBlock; /* first sector relative to start of disk */
unsigned int SectorCount; /* number of sectors in partition */
} PACKED PARTITION, *PPARTITION;
} PARTITION, *PPARTITION;
typedef struct _PARTITION_SECTOR
@ -49,7 +50,9 @@ typedef struct _PARTITION_SECTOR
UCHAR Reserved[2]; /* 0x1BC */
PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
USHORT Magic; /* 0x1FE */
} PACKED PARTITION_SECTOR, *PPARTITION_SECTOR;
} PARTITION_SECTOR, *PPARTITION_SECTOR;
#include <poppack.h>
typedef enum _DISK_MANAGER

View file

@ -1,4 +1,4 @@
/* $Id: dlog.c,v 1.10 2004/01/02 17:43:50 sedwards Exp $
/* $Id: dlog.c,v 1.11 2004/01/05 14:28:20 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -46,7 +46,7 @@ DebugLogInit(VOID)
KeInitializeSemaphore(&DebugLogSem, 0, 255);
}
VOID STDCALL_FUNC
VOID STDCALL
DebugLogThreadMain(PVOID Context)
{
KIRQL oldIrql;

View file

@ -1,4 +1,4 @@
/* $Id: kdebug.c,v 1.49 2003/12/30 22:06:39 fireball Exp $
/* $Id: kdebug.c,v 1.50 2004/01/05 14:28:20 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -386,13 +386,15 @@ KeEnterKernelDebugger(VOID)
HalDisplayString("\n\n *** Entered kernel debugger ***\n");
for (;;)
#ifdef __GNUC__
{
#if defined(__GNUC__)
__asm__("hlt\n\t");
#elif defined(_MSC_VER)
__asm hlt
__asm hlt
#else
#error Unknown compiler for inline assembler
#endif
}
}
VOID STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: service.c,v 1.6 2003/12/30 18:52:04 fireball Exp $
/* $Id: service.c,v 1.7 2004/01/05 14:28:20 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -138,12 +138,12 @@ void interrupt_handler2d()
sub esp, 112 /* FloatSave */
mov eax, dr7; push eax;
mov eax, dr6; push eax;
mov eax, dr3; push eax;
mov eax, dr2; push eax;
mov eax, dr1; push eax;
mov eax, dr0; push eax;
mov eax, dr7 __asm push eax
mov eax, dr6 __asm push eax
mov eax, dr3 __asm push eax
mov eax, dr2 __asm push eax
mov eax, dr1 __asm push eax
mov eax, dr0 __asm push eax
push 0 /* ContextFlags */
@ -164,12 +164,12 @@ void interrupt_handler2d()
/* Restore the user context */
add esp, 4 /* UserContext */
pop eax; mov dr0, eax;
pop eax; mov dr1, eax;
pop eax; mov dr2, eax;
pop eax; mov dr3, eax;
pop eax; mov dr6, eax;
pop eax; mov dr7, eax;
pop eax __asm mov dr0, eax
pop eax __asm mov dr1, eax
pop eax __asm mov dr2, eax
pop eax __asm mov dr3, eax
pop eax __asm mov dr6, eax
pop eax __asm mov dr7, eax
add esp, 112 /* FloatingSave */
pop gs
pop fs
@ -185,7 +185,7 @@ void interrupt_handler2d()
pop ebp
iret
iretd
}
}

View file

@ -554,10 +554,10 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
{
if (Tf->Eflags & FLAG_IF)
{
#ifdef __GNUC__
__asm__("sti\n\t");
#if defined(__GNUC__)
__asm__("sti\n\t");
#elif defined(_MSC_VER)
__asm sti
__asm sti
#else
#error Unknown compiler for inline assembler
#endif

View file

@ -54,11 +54,17 @@ USHORT KiBootGdt[11 * 4] =
0x0, 0x0, 0x0, 0x0 /* Trap TSS */
};
struct
#include <pshpack1.h>
struct LocalGdtDescriptor_t
{
USHORT Length;
ULONG Base;
} __attribute__((packed)) KiGdtDescriptor = { 11 * 8, (ULONG)KiBootGdt };
} KiGdtDescriptor = { 11 * 8, (ULONG)KiBootGdt };
#include <poppack.h>
static KSPIN_LOCK GdtLock;
@ -74,11 +80,7 @@ VOID
KiInitializeGdt(PKPCR Pcr)
{
PUSHORT Gdt;
struct
{
USHORT Length;
ULONG Base;
} __attribute__((packed)) Descriptor;
struct LocalGdtDescriptor_t Descriptor;
ULONG Entry;
ULONG Base;
@ -146,18 +148,18 @@ KiInitializeGdt(PKPCR Pcr)
#elif defined(_MSC_VER)
__asm
{
lgdt Descriptor;
mov ax, KERNEL_DS;
mov bx, PCR_SELECTOR;
mov ds, ax;
mov es, ax;
mov fs, bx;
mov gs, ax;
push KERNEL_CS;
push offset l4 ; // what the heck...
ret
l4:
}
lgdt Descriptor;
mov ax, KERNEL_DS;
mov bx, PCR_SELECTOR;
mov ds, ax;
mov es, ax;
mov fs, bx;
mov gs, ax;
push KERNEL_CS;
push offset l4 ;
retf
l4:
}
#else
#error Unknown compiler for inline assembler
#endif

View file

@ -19,23 +19,15 @@
IDT_DESCRIPTOR KiIdt[256];
#if defined(__GNUC__)
#include <pshpack1.h>
struct
{
USHORT Length;
ULONG Base;
} __attribute__((packed)) KiIdtDescriptor = {256 * 8, (ULONG)KiIdt};
#else
#include <pshpack1.h>
struct dummyname_for_this_one
{
USHORT Length;
ULONG Base;
};
#include <poppack.h>
struct dummyname_for_this_one KiIdtDescriptor = {256 * 8, (ULONG)KiIdt};
#endif
} KiIdtDescriptor = {256 * 8, (ULONG)KiIdt};
#include <poppack.h>
/* FUNCTIONS *****************************************************************/

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: irq.c,v 1.38 2003/12/30 22:10:45 fireball Exp $
/* $Id: irq.c,v 1.39 2004/01/05 14:28:21 weiden Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/i386/irq.c
@ -491,10 +491,10 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
* Enable interrupts
* NOTE: Only higher priority interrupts will get through
*/
#ifdef __GNUC__
__asm__("sti\n\t");
#if defined(__GNUC__)
__asm__("sti\n\t");
#elif defined(_MSC_VER)
__asm sti
__asm sti
#else
#error Unknown compiler for inline assembler
#endif
@ -523,10 +523,10 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
/*
* End the system interrupt.
*/
#ifdef __GNUC__
__asm__("cli\n\t");
#if defined(__GNUC__)
__asm__("cli\n\t");
#elif defined(_MSC_VER)
__asm cli
__asm cli
#else
#error Unknown compiler for inline assembler
#endif

View file

@ -93,10 +93,10 @@ KeApplicationProcessorInit(VOID)
*/
Ki386InitializeLdt();
#ifdef __GNUC__
__asm__ __volatile__ ("sti\n\t");
#if defined(__GNUC__)
__asm__ __volatile__ ("sti\n\t");
#elif defined(_MSC_VER)
__asm sti
__asm sti
#else
#error Unknown compiler for inline assembler
#endif

View file

@ -113,7 +113,7 @@ Ke386InitThreadWithContext(PKTHREAD Thread, PCONTEXT Context)
KernelStack[1] = 0; /* ESI */
KernelStack[2] = 0; /* EBX */
KernelStack[3] = 0; /* EBP */
KernelStack[4] = (ULONG)PsBeginThreadWithContextInternal; /* EIP */
KernelStack[4] = (ULONG)&PsBeginThreadWithContextInternal; /* EIP */
/* Save the context flags. */
KernelStack[5] = Context->ContextFlags;
@ -180,13 +180,13 @@ Ke386InitThread(PKTHREAD Thread,
/*
* Setup a stack frame for exit from the task switching routine
*/
KernelStack = (PULONG)((char*)Thread->KernelStack - (8*4));
KernelStack[0] = 0; /* EDI */
KernelStack[1] = 0; /* ESI */
KernelStack[2] = 0; /* EBX */
KernelStack[3] = 0; /* EBP */
KernelStack[4] = (ULONG)PsBeginThread; /* EIP */
KernelStack[4] = (ULONG)&PsBeginThread; /* EIP */
KernelStack[5] = 0; /* Return EIP */
KernelStack[6] = (ULONG)StartRoutine; /* First argument to PsBeginThread */
KernelStack[7] = (ULONG)StartContext; /* Second argument to PsBeginThread */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: main.c,v 1.181 2004/01/02 17:43:51 sedwards Exp $
/* $Id: main.c,v 1.182 2004/01/05 14:28:21 weiden Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c
@ -915,8 +915,18 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
strcpy(KeLoaderModuleStrings[0], "ntoskrnl.exe");
KeLoaderModules[0].String = (ULONG)KeLoaderModuleStrings[0];
KeLoaderModules[0].ModStart = 0xC0000000;
KeLoaderModules[0].ModStart = KERNEL_BASE;
#ifdef __GNUC__
KeLoaderModules[0].ModEnd = PAGE_ROUND_UP((ULONG)&_bss_end__);
#else
/* Take this value from the PE... */
{
PIMAGE_NT_HEADERS NtHeader = RtlImageNtHeader((PVOID)KeLoaderModules[0].ModStart);
PIMAGE_OPTIONAL_HEADER OptHead = &NtHeader->OptionalHeader;
KeLoaderModules[0].ModEnd =
KeLoaderModules[0].ModStart + PAGE_ROUND_UP((ULONG)OptHead->SizeOfImage);
}
#endif
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{
CHAR* s;
@ -928,10 +938,11 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
{
strcpy(KeLoaderModuleStrings[i], (PUCHAR)KeLoaderModules[i].String);
}
/* TODO: Fix this hardcoded load address stuff... */
KeLoaderModules[i].ModStart -= 0x200000;
KeLoaderModules[i].ModStart += 0xc0000000;
KeLoaderModules[i].ModStart += KERNEL_BASE;
KeLoaderModules[i].ModEnd -= 0x200000;
KeLoaderModules[i].ModEnd += 0xc0000000;
KeLoaderModules[i].ModEnd += KERNEL_BASE;
KeLoaderModules[i].String = (ULONG)KeLoaderModuleStrings[i];
}
@ -946,7 +957,7 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
/*
* Process hal.dll
*/
LdrSafePEProcessModule((PVOID)HalBase, (PVOID)DriverBase, (PVOID)0xC0000000, &DriverSize);
LdrSafePEProcessModule((PVOID)HalBase, (PVOID)DriverBase, (PVOID)KERNEL_BASE, &DriverSize);
LdrHalBase = (ULONG_PTR)DriverBase;
last_kernel_address = DriverBase + DriverSize;
@ -954,10 +965,13 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
/*
* Process ntoskrnl.exe
*/
LdrSafePEProcessModule((PVOID)0xC0000000, (PVOID)0xC0000000, (PVOID)DriverBase, &DriverSize);
LdrSafePEProcessModule((PVOID)KERNEL_BASE, (PVOID)KERNEL_BASE, (PVOID)DriverBase, &DriverSize);
FirstKrnlPhysAddr = KeLoaderModules[0].ModStart - 0xc0000000 + 0x200000;
LastKrnlPhysAddr = last_kernel_address - 0xc0000000 + 0x200000;
/* Now our imports from HAL is fixed. This is the first */
/* time in the boot process that we can use HAL */
FirstKrnlPhysAddr = KeLoaderModules[0].ModStart - KERNEL_BASE + 0x200000;
LastKrnlPhysAddr = last_kernel_address - KERNEL_BASE + 0x200000;
LastKernelAddress = last_kernel_address;
#ifndef ACPI

View file

@ -1,4 +1,4 @@
/* $Id: timer.c,v 1.65 2003/12/31 14:37:34 hbirr Exp $
/* $Id: timer.c,v 1.66 2004/01/05 14:28:21 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -32,7 +32,11 @@
/*
* Current time
*/
#if defined(__GNUC__)
static LARGE_INTEGER SystemBootTime = (LARGE_INTEGER)0LL;
#else
static LARGE_INTEGER SystemBootTime = { 0 };
#endif
/*
* Number of timer interrupts since initialisation
@ -223,6 +227,7 @@ KeQueryInterruptTime(PLARGE_INTEGER CurrentTime)
while (CurrentTime->u.HighPart != SharedUserData->InterruptTime.High2Part);
}
NTSTATUS STDCALL
NtGetTickCount (PULONG UpTime)
{
@ -332,7 +337,7 @@ KeSetTimerEx (PKTIMER Timer,
}
KeReleaseSpinLock(&TimerListLock, oldlvl);
return AlreadyInList;
}
@ -607,7 +612,7 @@ KiUpdateSystemTime(KIRQL oldIrql,
SharedUserData->SystemTime.High1Part = Time.u.HighPart;
KeReleaseSpinLockFromDpcLevel(&TimerValueLock);
/*
* Queue a DPC that will expire timers
*/

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.138 2003/12/30 18:52:05 fireball Exp $
/* $Id: loader.c,v 1.139 2004/01/05 14:28:21 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -131,43 +131,37 @@ LdrInitDebug(PLOADER_MODULE Module, PWCH Name)
VOID INIT_FUNCTION
LdrInit1(VOID)
{
PIMAGE_DOS_HEADER DosHeader;
PIMAGE_FILE_HEADER FileHeader;
PIMAGE_OPTIONAL_HEADER OptionalHeader;
PIMAGE_SECTION_HEADER SectionList;
PIMAGE_NT_HEADERS NtHeader;
PIMAGE_SECTION_HEADER SectionList;
InitializeListHead(&ModuleTextListHead);
/* Setup ntoskrnl.exe text section */
DosHeader = (PIMAGE_DOS_HEADER) KERNEL_BASE;
FileHeader =
(PIMAGE_FILE_HEADER) ((DWORD)KERNEL_BASE +
DosHeader->e_lfanew + sizeof(ULONG));
OptionalHeader = (PIMAGE_OPTIONAL_HEADER)
((DWORD)FileHeader + sizeof(IMAGE_FILE_HEADER));
SectionList = (PIMAGE_SECTION_HEADER)
((DWORD)OptionalHeader + sizeof(IMAGE_OPTIONAL_HEADER));
NtoskrnlTextSection.Base = KERNEL_BASE;
/*
* This isn't the base of the text segment, but the start of the
* full image (in memory)
* Also, the Length field isn't set to the length of the segment,
* but is more like the offset, from the image base, to the end
* of the segment.
*/
NtHeader = RtlImageNtHeader((PVOID)KERNEL_BASE);
SectionList = IMAGE_FIRST_SECTION(NtHeader);
NtoskrnlTextSection.Base = KERNEL_BASE;
NtoskrnlTextSection.Length = SectionList[0].Misc.VirtualSize +
SectionList[0].VirtualAddress;
SectionList[0].VirtualAddress;
NtoskrnlTextSection.Name = KERNEL_MODULE_NAME;
NtoskrnlTextSection.OptionalHeader = OptionalHeader;
NtoskrnlTextSection.OptionalHeader = OPTHDROFFSET(KERNEL_BASE);
InsertTailList(&ModuleTextListHead, &NtoskrnlTextSection.ListEntry);
/* Setup hal.dll text section */
DosHeader = (PIMAGE_DOS_HEADER)LdrHalBase;
FileHeader =
(PIMAGE_FILE_HEADER) ((DWORD)LdrHalBase +
DosHeader->e_lfanew + sizeof(ULONG));
OptionalHeader = (PIMAGE_OPTIONAL_HEADER)
((DWORD)FileHeader + sizeof(IMAGE_FILE_HEADER));
SectionList = (PIMAGE_SECTION_HEADER)
((DWORD)OptionalHeader + sizeof(IMAGE_OPTIONAL_HEADER));
LdrHalTextSection.Base = LdrHalBase;
/* Same comment as above applies */
NtHeader = RtlImageNtHeader((PVOID)LdrHalBase);
SectionList = IMAGE_FIRST_SECTION(NtHeader);
LdrHalTextSection.Base = LdrHalBase;
LdrHalTextSection.Length = SectionList[0].Misc.VirtualSize +
SectionList[0].VirtualAddress;
SectionList[0].VirtualAddress;
LdrHalTextSection.Name = HAL_MODULE_NAME;
LdrHalTextSection.OptionalHeader = OptionalHeader;
LdrHalTextSection.OptionalHeader = OPTHDROFFSET(LdrHalBase);
InsertTailList(&ModuleTextListHead, &LdrHalTextSection.ListEntry);
/* Hook for KDB on initialization of the loader. */
@ -1347,26 +1341,25 @@ LdrSafePEProcessModule(PVOID ModuleLoadBase,
/* Copy image sections into virtual section */
for (Idx = 0; Idx < PEFileHeader->NumberOfSections; Idx++)
{
PIMAGE_SECTION_HEADER Section = &PESectionHeaders[Idx];
// Copy current section into current offset of virtual section
if (PESectionHeaders[Idx].Characteristics &
(IMAGE_SECTION_CHAR_CODE | IMAGE_SECTION_CHAR_DATA))
{
//ps("PESectionHeaders[Idx].VirtualAddress (%X) + DriverBase %x\n",
//PESectionHeaders[Idx].VirtualAddress, PESectionHeaders[Idx].VirtualAddress + DriverBase);
memcpy(PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase,
(PVOID)((char*)ModuleLoadBase + PESectionHeaders[Idx].PointerToRawData),
PESectionHeaders[Idx].Misc.VirtualSize > PESectionHeaders[Idx].SizeOfRawData ?
PESectionHeaders[Idx].SizeOfRawData : PESectionHeaders[Idx].Misc.VirtualSize );
}
else
{
ps("PESectionHeaders[Idx].VirtualAddress (%X) + DriverBase %x\n",
PESectionHeaders[Idx].VirtualAddress, PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase);
memset(PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase,
'\0',
PESectionHeaders[Idx].Misc.VirtualSize);
}
CurrentSize += ROUND_UP(PESectionHeaders[Idx].Misc.VirtualSize,
// if (PESectionHeaders[Idx].Characteristics &
// (IMAGE_SECTION_CHAR_CODE | IMAGE_SECTION_CHAR_DATA))
if (Section->SizeOfRawData)
{
//ps("PESectionHeaders[Idx].VirtualAddress (%X) + DriverBase %x\n",
//PESectionHeaders[Idx].VirtualAddress, PESectionHeaders[Idx].VirtualAddress + DriverBase);
memcpy(Section->VirtualAddress + (char*)DriverBase,
Section->PointerToRawData + (char*)ModuleLoadBase,
Section->SizeOfRawData);
}
if (Section->SizeOfRawData < Section->Misc.VirtualSize)
{
memset(Section->VirtualAddress + Section->SizeOfRawData + (char*)DriverBase,
0,
Section->Misc.VirtualSize - Section->SizeOfRawData);
}
CurrentSize += ROUND_UP(Section->Misc.VirtualSize,
PEOptionalHeader->SectionAlignment);
}
@ -1515,9 +1508,10 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
PVOID ExportAddress;
PWORD OrdinalList;
PDWORD FunctionList, NameList;
PCHAR ModuleBase = (PCHAR)ModuleObject->Base;
ExportDir = (PIMAGE_EXPORT_DIRECTORY)
RtlImageDirectoryEntryToData(ModuleObject->Base,
RtlImageDirectoryEntryToData(ModuleBase,
TRUE,
IMAGE_DIRECTORY_ENTRY_EXPORT,
&ExportDirSize);
@ -1527,9 +1521,9 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
return NULL;
}
FunctionList = (PDWORD)((DWORD)ExportDir->AddressOfFunctions + (char*)ModuleObject->Base);
NameList = (PDWORD)((DWORD)ExportDir->AddressOfNames + (char*)ModuleObject->Base);
OrdinalList = (PWORD)((DWORD)ExportDir->AddressOfNameOrdinals + (char*)ModuleObject->Base);
FunctionList = (PDWORD)((char*)ModuleBase + (DWORD)ExportDir->AddressOfFunctions);
NameList = (PDWORD)((char*)ModuleBase + (DWORD)ExportDir->AddressOfNames);
OrdinalList = (PWORD) ((char*)ModuleBase + (DWORD)ExportDir->AddressOfNameOrdinals);
ExportAddress = 0;
@ -1541,12 +1535,12 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
DPRINT(" Name:%s NameList[%d]:%s\n",
Name,
Idx,
(DWORD) ModuleObject->Base + NameList[Idx]);
(DWORD) ModuleBase + NameList[Idx]);
#endif
if (!strcmp(Name, (PCHAR) ((DWORD)ModuleObject->Base + NameList[Idx])))
if (!strcmp(Name, ModuleBase + NameList[Idx]))
{
ExportAddress = (PVOID) ((DWORD)ModuleObject->Base +
ExportAddress = (PVOID) ((DWORD)ModuleBase +
FunctionList[OrdinalList[Idx]]);
if (((ULONG)ExportAddress >= (ULONG)ExportDir) &&
((ULONG)ExportAddress < (ULONG)ExportDir + ExportDirSize))
@ -1562,7 +1556,7 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
}
else /* use hint */
{
ExportAddress = (PVOID) ((DWORD)ModuleObject->Base +
ExportAddress = (PVOID) ((DWORD)ModuleBase +
FunctionList[Hint - ExportDir->Base]);
}

View file

@ -44,6 +44,7 @@ typedef struct _PHYSICAL_PAGE
struct _MM_RMAP_ENTRY* RmapListHead;
} PHYSICAL_PAGE, *PPHYSICAL_PAGE;
/* GLOBALS ****************************************************************/
static PPHYSICAL_PAGE MmPageArray;
@ -68,7 +69,7 @@ MmTransferOwnershipPage(PHYSICAL_ADDRESS PhysicalAddress, ULONG NewConsumer)
{
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql;
KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].MapCount != 0)
{
@ -178,11 +179,11 @@ MmGetContinuousPages(ULONG NumberOfBytes,
LONG start;
ULONG length;
KIRQL oldIrql;
NrPages = PAGE_ROUND_UP(NumberOfBytes) / PAGE_SIZE;
KeAcquireSpinLock(&PageListLock, &oldIrql);
start = -1;
length = 0;
for (i = (LowestAcceptableAddress.QuadPart / PAGE_SIZE); i < (HighestAcceptableAddress.QuadPart / PAGE_SIZE); )
@ -254,7 +255,7 @@ MiParseRangeToFreeList(PADDRESS_RANGE Range)
ULONG i, first, last;
/* FIXME: Not 64-bit ready */
DPRINT("Range going to free list (Base 0x%X, Length 0x%X, Type 0x%X)\n",
Range->BaseAddrLow,
Range->LengthLow,
@ -281,7 +282,7 @@ MiParseRangeToBiosList(PADDRESS_RANGE Range)
ULONG i, first, last;
/* FIXME: Not 64-bit ready */
DPRINT("Range going to bios list (Base 0x%X, Length 0x%X, Type 0x%X)\n",
Range->BaseAddrLow,
Range->LengthLow,
@ -314,7 +315,7 @@ MiParseBIOSMemoryMap(PADDRESS_RANGE BIOSMemoryMap,
{
PADDRESS_RANGE p;
ULONG i;
p = BIOSMemoryMap;
for (i = 0; i < AddressRangeCount; i++, p++)
{
@ -348,7 +349,7 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
ULONG i;
ULONG Reserved;
NTSTATUS Status;
DPRINT("MmInitializePageList(FirstPhysKernelAddress %x, "
"LastPhysKernelAddress %x, "
"MemorySizeInPages %x, LastKernelAddress %x)\n",
@ -367,19 +368,19 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
InitializeListHead(&BiosPageListHead);
LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
MmPageArraySize = MemorySizeInPages;
Reserved =
PAGE_ROUND_UP((MmPageArraySize * sizeof(PHYSICAL_PAGE))) / PAGE_SIZE;
MmPageArray = (PHYSICAL_PAGE *)LastKernelAddress;
DPRINT("Reserved %d\n", Reserved);
LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
LastKernelAddress = ((ULONG)LastKernelAddress + (Reserved * PAGE_SIZE));
LastPhysKernelAddress = (PVOID)PAGE_ROUND_UP(LastPhysKernelAddress);
LastPhysKernelAddress = (char*)LastPhysKernelAddress + (Reserved * PAGE_SIZE);
MmStats.NrTotalPages = 0;
MmStats.NrSystemPages = 0;
MmStats.NrUserPages = 0;
@ -541,7 +542,6 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
KeInitializeEvent(&ZeroPageThreadEvent, NotificationEvent, TRUE);
MmStats.NrTotalPages = MmStats.NrFreePages + MmStats.NrSystemPages +
MmStats.NrReservedPages + MmStats.NrUserPages;
MmInitializeBalancer(MmStats.NrFreePages, MmStats.NrSystemPages + MmStats.NrReservedPages);
@ -553,7 +553,7 @@ MmSetFlagsPage(PHYSICAL_ADDRESS PhysicalAddress, ULONG Flags)
{
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql;
KeAcquireSpinLock(&PageListLock, &oldIrql);
MmPageArray[Start].AllFlags = Flags;
KeReleaseSpinLock(&PageListLock, oldIrql);
@ -625,7 +625,7 @@ MmGetFlagsPage(PHYSICAL_ADDRESS PhysicalAddress)
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql;
ULONG Flags;
KeAcquireSpinLock(&PageListLock, &oldIrql);
Flags = MmPageArray[Start].AllFlags;
KeReleaseSpinLock(&PageListLock, oldIrql);
@ -652,7 +652,7 @@ MmGetSavedSwapEntryPage(PHYSICAL_ADDRESS PhysicalAddress)
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
SWAPENTRY SavedSwapEntry;
KIRQL oldIrql;
KeAcquireSpinLock(&PageListLock, &oldIrql);
SavedSwapEntry = MmPageArray[Start].SavedSwapEntry;
KeReleaseSpinLock(&PageListLock, oldIrql);
@ -665,14 +665,14 @@ MmReferencePage(PHYSICAL_ADDRESS PhysicalAddress)
{
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql;
DPRINT("MmReferencePage(PhysicalAddress %x)\n", PhysicalAddress);
if (PhysicalAddress.u.LowPart == 0)
{
KEBUGCHECK(0);
}
KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED)
@ -680,7 +680,7 @@ MmReferencePage(PHYSICAL_ADDRESS PhysicalAddress)
DbgPrint("Referencing non-used page\n");
KEBUGCHECK(0);
}
MmPageArray[Start].ReferenceCount++;
KeReleaseSpinLock(&PageListLock, oldIrql);
}
@ -698,7 +698,7 @@ MmGetReferenceCountPage(PHYSICAL_ADDRESS PhysicalAddress)
{
KEBUGCHECK(0);
}
KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED)
@ -706,7 +706,7 @@ MmGetReferenceCountPage(PHYSICAL_ADDRESS PhysicalAddress)
DbgPrint("Getting reference count for free page\n");
KEBUGCHECK(0);
}
RCount = MmPageArray[Start].ReferenceCount;
KeReleaseSpinLock(&PageListLock, oldIrql);
@ -730,7 +730,7 @@ MmIsUsablePage(PHYSICAL_ADDRESS PhysicalAddress)
{
return(FALSE);
}
return(TRUE);
}
@ -755,7 +755,7 @@ MmDereferencePage(PHYSICAL_ADDRESS PhysicalAddress)
DbgPrint("Dereferencing free page\n");
KEBUGCHECK(0);
}
MmPageArray[Start].ReferenceCount--;
if (MmPageArray[Start].ReferenceCount == 0)
{
@ -807,22 +807,22 @@ MmGetLockCountPage(PHYSICAL_ADDRESS PhysicalAddress)
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql;
ULONG LockCount;
DPRINT("MmGetLockCountPage(PhysicalAddress %x)\n", PhysicalAddress);
if (PhysicalAddress.u.LowPart == 0)
{
KEBUGCHECK(0);
}
KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED)
{
DbgPrint("Getting lock count for free page\n");
KEBUGCHECK(0);
}
LockCount = MmPageArray[Start].LockCount;
KeReleaseSpinLock(&PageListLock, oldIrql);
@ -834,22 +834,22 @@ MmLockPage(PHYSICAL_ADDRESS PhysicalAddress)
{
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql;
DPRINT("MmLockPage(PhysicalAddress %x)\n", PhysicalAddress);
if (PhysicalAddress.u.LowPart == 0)
{
KEBUGCHECK(0);
}
KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED)
{
DbgPrint("Locking free page\n");
KEBUGCHECK(0);
}
MmPageArray[Start].LockCount++;
KeReleaseSpinLock(&PageListLock, oldIrql);
}
@ -859,9 +859,9 @@ MmUnlockPage(PHYSICAL_ADDRESS PhysicalAddress)
{
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql;
DPRINT("MmUnlockPage(PhysicalAddress %I64x)\n", PhysicalAddress);
if (PhysicalAddress.u.LowPart == 0)
{
KEBUGCHECK(0);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: page.c,v 1.61 2003/12/30 18:52:05 fireball Exp $
/* $Id: page.c,v 1.62 2004/01/05 14:28:21 weiden Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/i386/page.c
@ -132,7 +132,7 @@ ProtectToPTE(ULONG flProtect)
#define ADDR_TO_PDE(v) (PULONG)(PAGEDIRECTORY_MAP + \
((((ULONG)(v)) / (1024 * 1024))&(~0x3)))
#define ADDR_TO_PTE(v) (PULONG)(PAGETABLE_MAP + ((((ULONG)v / 1024))&(~0x3)))
#define ADDR_TO_PTE(v) (PULONG)(PAGETABLE_MAP + ((((ULONG)(v) / 1024))&(~0x3)))
#define ADDR_TO_PDE_OFFSET(v) ((((ULONG)(v)) / (4 * 1024 * 1024)))
@ -271,7 +271,7 @@ NTSTATUS MmGetPageEntry2(PVOID PAddress, PULONG* Pte, BOOLEAN MayWait)
KIRQL oldIrql;
DPRINT("MmGetPageEntry(Address %x)\n", PAddress);
Pde = ADDR_TO_PDE(PAddress);
if (*Pde == 0)
{

View file

@ -1,4 +1,4 @@
/* $Id: kmap.c,v 1.30 2003/12/30 18:52:05 fireball Exp $
/* $Id: kmap.c,v 1.31 2004/01/05 14:28:21 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -131,7 +131,7 @@ VOID INIT_FUNCTION
MiInitKernelMap(VOID)
{
KeInitializeSpinLock(&AllocMapLock);
RtlInitializeBitMap(&AllocMap, (PVOID)&AllocMapBuffer, ALLOC_MAP_SIZE);
RtlInitializeBitMap(&AllocMap, (PULONG)AllocMapBuffer, ALLOC_MAP_SIZE);
RtlClearAllBits(&AllocMap);
}

View file

@ -548,7 +548,7 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
if (BoundaryAddressMultiple.QuadPart != 0)
{
EndAddress = *BaseAddress + tmpLength-1;
EndAddress = ((char*)(*BaseAddress)) + tmpLength-1;
assert(((DWORD_PTR)*BaseAddress/BoundaryAddressMultiple.QuadPart) == ((DWORD_PTR)EndAddress/BoundaryAddressMultiple.QuadPart));
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: section.c,v 1.140 2003/12/31 14:52:06 hbirr Exp $
/* $Id: section.c,v 1.141 2004/01/05 14:28:21 weiden Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/section.c
@ -510,7 +510,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
/*
* Retrieve the page from the cache segment that we actually want.
*/
(*Page) = MmGetPhysicalAddress(BaseAddress +
(*Page) = MmGetPhysicalAddress((char*)BaseAddress +
FileOffset - BaseOffset);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, TRUE);
@ -734,7 +734,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
}
Page.QuadPart = (LONGLONG)(PAGE_FROM_SSE(Entry));
MmReferencePage(Page);
MmSharePageEntrySectionSegment(Segment, Offset);
Status = MmCreateVirtualMapping(MemoryArea->Process,
@ -1594,7 +1594,6 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
!(SwapEntry == 0 &&
(Context.Segment->Flags & MM_PAGEFILE_SEGMENT ||
Context.Segment->Characteristics & IMAGE_SECTION_CHAR_SHARED)))
{
if (Context.Private)
{
@ -3739,6 +3738,7 @@ MmAllocateSection (IN ULONG Length)
DPRINT("MmAllocateSection(Length %x)\n",Length);
BoundaryAddressMultiple.QuadPart = 0;
AddressSpace = MmGetKernelAddressSpace();
Result = NULL;
MmLockAddressSpace(AddressSpace);
@ -3753,6 +3753,7 @@ MmAllocateSection (IN ULONG Length)
FALSE,
BoundaryAddressMultiple);
MmUnlockAddressSpace(AddressSpace);
if (!NT_SUCCESS(Status))
{
return (NULL);

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.69 2003/12/30 22:13:45 fireball Exp $
/* $Id: create.c,v 1.70 2004/01/05 14:28:21 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -401,7 +401,7 @@ PsInitializeThread(HANDLE ProcessHandle,
InsertTailList(&PiThreadListHead, &Thread->Tcb.ThreadListEntry);
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
Thread->Tcb.BasePriority = Thread->ThreadsProcess->Pcb.BasePriority;
Thread->Tcb.BasePriority = (CHAR)Thread->ThreadsProcess->Pcb.BasePriority;
Thread->Tcb.Priority = Thread->Tcb.BasePriority;
return(STATUS_SUCCESS);
@ -455,7 +455,7 @@ PsCreateTeb(HANDLE ProcessHandle,
}
}
TebBase = (char *)TebBase - TebSize;
TebBase = (char*)TebBase - TebSize;
}
DPRINT ("TebBase %p TebSize %lu\n", TebBase, TebSize);

View file

@ -39,10 +39,11 @@ PsIdleThreadMain(PVOID Context)
KeLowerIrql(oldlvl);
}
NtYieldExecution();
#ifdef __GNUC__
__asm__("hlt\n\t");
#if defined(__GNUC__)
__asm__( "hlt" );
#elif defined(_MSC_VER)
__asm hlt
__asm hlt
#else
#error Unknown compiler for inline assembler
#endif

View file

@ -1,4 +1,4 @@
/* $Id: kill.c,v 1.69 2003/12/30 03:27:52 hyperion Exp $
/* $Id: kill.c,v 1.70 2004/01/05 14:28:21 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -97,7 +97,7 @@ PsReapThreads(VOID)
{
PiNrThreadsAwaitingReaping--;
current->Tcb.State = THREAD_STATE_TERMINATED_2;
/*
An unbelievably complex chain of events would cause a system crash
if PiThreadListLock was still held when the thread object is about

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.123 2003/12/31 05:33:04 jfilby Exp $
/* $Id: process.c,v 1.124 2004/01/05 14:28:21 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -464,9 +464,9 @@ PsCreatePeb(HANDLE ProcessHandle,
Peb->OSBuildNumber = 0;
Peb->OSPlatformId = 2; //VER_PLATFORM_WIN32_NT;
Peb->AnsiCodePageData = (char *)TableBase + NlsAnsiTableOffset;
Peb->OemCodePageData = (char *)TableBase + NlsOemTableOffset;
Peb->UnicodeCaseTableData = (char *)TableBase + NlsUnicodeTableOffset;
Peb->AnsiCodePageData = (char*)TableBase + NlsAnsiTableOffset;
Peb->OemCodePageData = (char*)TableBase + NlsOemTableOffset;
Peb->UnicodeCaseTableData = (char*)TableBase + NlsUnicodeTableOffset;
Process->Peb = Peb;
KeDetachProcess();
@ -785,7 +785,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
#endif
/* Protect the 60KB above the shared user page */
BaseAddress = (char *)USER_SHARED_DATA + PAGE_SIZE;
BaseAddress = (char*)USER_SHARED_DATA + PAGE_SIZE;
Status = MmCreateMemoryArea(Process,
&Process->AddressSpace,
MEMORY_AREA_NO_ACCESS,

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.123 2003/12/14 18:02:33 hbirr Exp $
/* $Id: thread.c,v 1.124 2004/01/05 14:28:21 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -228,7 +228,7 @@ VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
DPRINT("PsDispatchThread() %d/%d/%d/%d\n", KeGetCurrentProcessorNumber(),
CurrentThread->Cid.UniqueThread, NewThreadStatus, CurrentThread->Tcb.State);
CurrentThread->Tcb.State = NewThreadStatus;
CurrentThread->Tcb.State = (UCHAR)NewThreadStatus;
if (CurrentThread->Tcb.State == THREAD_STATE_READY)
{
PsInsertIntoThreadList(CurrentThread->Tcb.Priority,
@ -369,7 +369,7 @@ PsBlockThread(PNTSTATUS Status, UCHAR Alertable, ULONG WaitMode,
KeReleaseDispatcherDatabaseLockFromDpcLevel();
}
Thread->Tcb.Alertable = Alertable;
Thread->Tcb.WaitMode = WaitMode;
Thread->Tcb.WaitMode = (UCHAR)WaitMode;
Thread->Tcb.WaitIrql = WaitIrql;
Thread->Tcb.WaitReason = WaitReason;
PsDispatchThreadNoLock(THREAD_STATE_BLOCKED);

View file

@ -1,4 +1,4 @@
/* $Id: acl.c,v 1.14 2003/12/30 18:52:06 fireball Exp $
/* $Id: acl.c,v 1.15 2004/01/05 14:28:21 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -263,7 +263,7 @@ RtlAddAce(PACL Acl,
{
AclRevision = Acl->AclRevision;
}
if ((PVOID)((char*)AceList + AceListLength) <= (PVOID)AceList)
if (((char*)AceList + AceListLength) <= (char*)AceList)
{
return(STATUS_UNSUCCESSFUL);
}