ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2010
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
19 participants
896 discussions
Start a n
N
ew thread
[tkreuzer] 46620: [NTOS] Add internal amd64 headers.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 31 17:11:20 2010 New Revision: 46620 URL:
http://svn.reactos.org/svn/reactos?rev=46620&view=rev
Log: [NTOS] Add internal amd64 headers. Added: trunk/reactos/ntoskrnl/include/internal/amd64/ (with props) trunk/reactos/ntoskrnl/include/internal/amd64/asmmacro.S (with props) trunk/reactos/ntoskrnl/include/internal/amd64/intrin_i.h (with props) trunk/reactos/ntoskrnl/include/internal/amd64/ke.h (with props) trunk/reactos/ntoskrnl/include/internal/amd64/mm.h (with props) Modified: trunk/reactos/ntoskrnl/include/internal/arch/intrin_i.h trunk/reactos/ntoskrnl/include/internal/arch/ke.h trunk/reactos/ntoskrnl/include/internal/arch/mm.h Propchange: trunk/reactos/ntoskrnl/include/internal/amd64/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Wed Mar 31 17:11:20 2010 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: trunk/reactos/ntoskrnl/include/internal/amd64/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: trunk/reactos/ntoskrnl/include/internal/amd64/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/ntoskrnl/include/internal/amd64/ ------------------------------------------------------------------------------ tsvn:logminsize = 10 Added: trunk/reactos/ntoskrnl/include/internal/amd64/asmmacro.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/amd64/asmmacro.S (added) +++ trunk/reactos/ntoskrnl/include/internal/amd64/asmmacro.S [iso-8859-1] Wed Mar 31 17:11:20 2010 @@ -1,0 +1,81 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/include/amd64/asmmacro.S + * PURPOSE: Macros for x64 assembly + * PROGRAMMERS: Timo Kreuzer (timo.kreuzer(a)reactos.org) + */ + +.intel_syntax noprefix +.code64 + +/* Macros for x64 stack unwind OPs */ + +.macro .proc name + .func name + .global _\name + _\name: + .cfi_startproc + .equ cfa_current_offset, -8 +.endm + +.macro .endproc + .cfi_endproc + .endfunc +.endm + +.macro .allocstack size + .cfi_adjust_cfa_offset \size + .set cfa_current_offset, cfa_current_offset - \size +.endm + +.macro .pushframe code + .if (\code == 0) + .cfi_adjust_cfa_offset 0x28 + .set cfa_current_offset, cfa_current_offset - 0x28 + .else + .cfi_adjust_cfa_offset 0x30 + .set cfa_current_offset, cfa_current_offset - 0x30 + .endif +.endm + +.macro .pushreg reg + .cfi_adjust_cfa_offset 8 + .equ cfa_current_offset, cfa_current_offset - 8 + .cfi_offset \reg, cfa_current_offset +.endm + +.macro .savereg reg, offset + // checkme!!! + .cfi_offset \reg, \offset +.endm + +.macro .savexmm128 reg, offset + // checkme!!! + .cfi_offset \reg, \offset +.endm + +.macro .setframe reg, offset + .cfi_def_cfa reg, \offset + .equ cfa_current_offset, \offset +.endm + +.macro .endprolog +.endm + +.macro UNIMPLEMENTED2 line, func + jmp 3f + .equ expr, 12 +1: .asciz "\func" +2: .asciz __FILE__ +3: + sub rsp, 0x20 + lea rcx, _MsgUnimplemented[rip] + lea rdx, 1b[rip] + lea r8, 2b[rip] + mov r9, \line + call _DbgPrint + add rsp, 0x20 +.endm +#define UNIMPLEMENTED UNIMPLEMENTED2 __LINE__, + Propchange: trunk/reactos/ntoskrnl/include/internal/amd64/asmmacro.S ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/ntoskrnl/include/internal/amd64/intrin_i.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/amd64/intrin_i.h (added) +++ trunk/reactos/ntoskrnl/include/internal/amd64/intrin_i.h [iso-8859-1] Wed Mar 31 17:11:20 2010 @@ -1,0 +1,128 @@ +#ifndef _INTRIN_INTERNAL_ +#define _INTRIN_INTERNAL_ + +VOID +FORCEINLINE +KeSetCurrentIrql(KIRQL Irql) +{ + __writecr8(Irql); +} + +PKGDTENTRY64 +FORCEINLINE +KiGetGdtEntry(PVOID pGdt, USHORT Selector) +{ + return (PKGDTENTRY64)((ULONG64)pGdt + (Selector & ~RPL_MASK)); +} + +PVOID +FORCEINLINE +KiGetGdtDescriptorBase(PKGDTENTRY Entry) +{ + return (PVOID)((ULONG64)Entry->BaseLow | + (ULONG64)Entry->Bytes.BaseMiddle << 16 | + (ULONG64)Entry->Bytes.BaseHigh << 24 | + (ULONG64)Entry->BaseUpper << 32); +} + +VOID +FORCEINLINE +KiSetGdtDescriptorBase(PKGDTENTRY Entry, ULONG64 Base) +{ + Entry->BaseLow = Base & 0xffff; + Entry->Bits.BaseMiddle = (Base >> 16) & 0xff; + Entry->Bits.BaseHigh = (Base >> 24) & 0xff; + Entry->BaseUpper = Base >> 32; +} + +VOID +FORCEINLINE +KiSetGdtDescriptorLimit(PKGDTENTRY Entry, ULONG Limit) +{ + Entry->LimitLow = Limit & 0xffff; + Entry->Bits.LimitHigh = Limit >> 16; +} + +VOID +FORCEINLINE +KiInitGdtEntry(PKGDTENTRY64 Entry, ULONG64 Base, ULONG Size, UCHAR Type, UCHAR Dpl) +{ + KiSetGdtDescriptorBase(Entry, Base); + KiSetGdtDescriptorLimit(Entry, Size - 1); + Entry->Bits.Type = Type; + Entry->Bits.Dpl = Dpl; + Entry->Bits.Present = 1; + Entry->Bits.System = 0; + Entry->Bits.LongMode = 0; + Entry->Bits.DefaultBig = 0; + Entry->Bits.Granularity = 0; + Entry->MustBeZero = 0; +} + +#if defined(__GNUC__) + +static __inline__ __attribute__((always_inline)) void __lgdt(void *Source) +{ + __asm__ __volatile__("lgdt %0" : : "m"(*(short*)Source)); +} + +static __inline__ __attribute__((always_inline)) void __sgdt(void *Destination) +{ + __asm__ __volatile__("sgdt %0" : : "m"(*(short*)Destination) : "memory"); +} + +static __inline__ __attribute__((always_inline)) void __lldt(unsigned short Value) +{ + __asm__ __volatile__("lldt %0" : : "rm"(Value)); +} + +static __inline__ __attribute__((always_inline)) void __sldt(void *Destination) +{ + __asm__ __volatile__("sldt %0" : : "m"(*(short*)Destination) : "memory"); +} + +static __inline__ __attribute__((always_inline)) void __ldmxcsr(unsigned long *Source) +{ + __asm__ __volatile__("ldmxcsr %0" : : "m"(*Source)); +} + +static __inline__ __attribute__((always_inline)) void __stmxcsr(unsigned long *Destination) +{ + __asm__ __volatile__("stmxcsr %0" : : "m"(*Destination) : "memory"); +} + +static __inline__ __attribute__((always_inline)) void __ltr(unsigned short Source) +{ + __asm__ __volatile__("ltr %0" : : "rm"(Source)); +} + +static __inline__ __attribute__((always_inline)) void __str(unsigned short *Destination) +{ + __asm__ __volatile__("str %0" : : "m"(*Destination) : "memory"); +} + + +#elif defined(_MSC_VER) + +#define UNIMPLEMENTED DbgPrint("%s is unimplemented!!!\n", __FUNCTION__); + +void __lgdt(void *Source); + +void __sgdt(void *Destination); + +void __lldt(unsigned short Value); + +void __sldt(void *Destination); + +void __ltr(unsigned short Source); + +void __str(unsigned short *Destination); + + +#else +#error Unknown compiler for inline assembler +#endif + +#endif + +/* EOF */ Propchange: trunk/reactos/ntoskrnl/include/internal/amd64/intrin_i.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/ntoskrnl/include/internal/amd64/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/amd64/ke.h (added) +++ trunk/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] Wed Mar 31 17:11:20 2010 @@ -1,0 +1,268 @@ +#ifndef __NTOSKRNL_INCLUDE_INTERNAL_AMD64_KE_H +#define __NTOSKRNL_INCLUDE_INTERNAL_AMD64_KE_H + +#define X86_EFLAGS_TF 0x00000100 /* Trap flag */ +#define X86_EFLAGS_IF 0x00000200 /* Interrupt Enable flag */ +#define X86_EFLAGS_IOPL 0x00003000 /* I/O Privilege Level bits */ +#define X86_EFLAGS_NT 0x00004000 /* Nested Task flag */ +#define X86_EFLAGS_RF 0x00010000 /* Resume flag */ +#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ +#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ + +#define X86_CR0_PE 0x00000001 /* enable Protected Mode */ +#define X86_CR0_NE 0x00000020 /* enable native FPU error reporting */ +#define X86_CR0_TS 0x00000008 /* enable exception on FPU instruction for task switch */ +#define X86_CR0_EM 0x00000004 /* enable FPU emulation (disable FPU) */ +#define X86_CR0_MP 0x00000002 /* enable FPU monitoring */ +#define X86_CR0_WP 0x00010000 /* enable Write Protect (copy on write) */ +#define X86_CR0_PG 0x80000000 /* enable Paging */ + +#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */ +#define X86_CR4_PGE 0x00000080 /* enable global pages */ +#define X86_CR4_OSFXSR 0x00000200 /* enable FXSAVE/FXRSTOR instructions */ +#define X86_CR4_OSXMMEXCPT 0x00000400 /* enable #XF exception */ + +#define X86_FEATURE_VME 0x00000002 /* Virtual 8086 Extensions are present */ +#define X86_FEATURE_TSC 0x00000010 /* time stamp counters are present */ +#define X86_FEATURE_PAE 0x00000040 /* physical address extension is present */ +#define X86_FEATURE_CX8 0x00000100 /* CMPXCHG8B instruction present */ +#define X86_FEATURE_SYSCALL 0x00000800 /* SYSCALL/SYSRET support present */ +#define X86_FEATURE_PGE 0x00002000 /* Page Global Enable */ +#define X86_FEATURE_MMX 0x00800000 /* MMX extension present */ +#define X86_FEATURE_FXSR 0x01000000 /* FXSAVE/FXRSTOR instructions present */ +#define X86_FEATURE_SSE 0x02000000 /* SSE extension present */ +#define X86_FEATURE_SSE2 0x04000000 /* SSE2 extension present */ +#define X86_FEATURE_HT 0x10000000 /* Hyper-Threading present */ + +#define X86_EXT_FEATURE_SSE3 0x00000001 /* SSE3 extension present */ +#define X86_EXT_FEATURE_3DNOW 0x40000000 /* 3DNOW! extension present */ + +#define FRAME_EDITED 0xFFF8 + +#define X86_MSR_GSBASE 0xC0000101 +#define X86_MSR_KERNEL_GSBASE 0xC0000102 +#define X86_MSR_EFER 0xC0000080 +#define X86_MSR_STAR 0xC0000081 +#define X86_MSR_LSTAR 0xC0000082 +#define X86_MSR_CSTAR 0xC0000083 +#define X86_MSR_SFMASK 0xC0000084 + +#define EFER_SCE 0x01 +#define EFER_LME 0x10 +#define EFER_LMA 0x40 +#define EFER_NXE 0x80 +#define EFER_SVME 0x100 +#define EFER_FFXSR 0x400 + +#define AMD64_TSS 9 + +#ifndef __ASM__ + +#include "intrin_i.h" + +typedef struct _KIDT_INIT +{ + UCHAR InterruptId; + UCHAR Dpl; + UCHAR IstIndex; + PVOID ServiceRoutine; +} KIDT_INIT, *PKIDT_INIT; + +extern ULONG Ke386CacheAlignment; +extern ULONG KeI386NpxPresent; +extern ULONG KeI386XMMIPresent; +extern ULONG KeI386FxsrPresent; +extern ULONG KeI386CpuType; +extern ULONG KeI386CpuStep; + +#define IMAGE_FILE_MACHINE_ARCHITECTURE IMAGE_FILE_MACHINE_AMD64 + +// +// INT3 is 1 byte long +// +#define KD_BREAKPOINT_TYPE UCHAR +#define KD_BREAKPOINT_SIZE sizeof(UCHAR) +#define KD_BREAKPOINT_VALUE 0xCC + +// +// Macros for getting and setting special purpose registers in portable code +// +#define KeGetContextPc(Context) \ + ((Context)->Rip) + +#define KeSetContextPc(Context, ProgramCounter) \ + ((Context)->Rip = (ProgramCounter)) + +#define KeGetTrapFramePc(TrapFrame) \ + ((TrapFrame)->Rip) + +#define KeGetContextReturnRegister(Context) \ + ((Context)->Rax) + +#define KeSetContextReturnRegister(Context, ReturnValue) \ + ((Context)->Rax = (ReturnValue)) + +// +// Macro to get trap and exception frame from a thread stack +// +#define KeGetTrapFrame(Thread) \ + (PKTRAP_FRAME)((ULONG_PTR)((Thread)->InitialStack) - \ + sizeof(KTRAP_FRAME)) + +// +// Macro to get context switches from the PRCB +// All architectures but x86 have it in the PRCB's KeContextSwitches +// +#define KeGetContextSwitches(Prcb) \ + (Prcb->KeContextSwitches) + +#define KeGetExceptionFrame(Thread) \ + (PKEXCEPTION_FRAME)((ULONG_PTR)KeGetTrapFrame(Thread) - \ + sizeof(KEXCEPTION_FRAME)) + +// +// Returns the Interrupt State from a Trap Frame. +// ON = TRUE, OFF = FALSE +// +#define KeGetTrapFrameInterruptState(TrapFrame) \ + BooleanFlagOn((TrapFrame)->EFlags, EFLAGS_INTERRUPT_MASK) + +// +// Invalidates the TLB entry for a specified address +// +FORCEINLINE +VOID +KeInvalidateTlbEntry(IN PVOID Address) +{ + /* Invalidate the TLB entry for this address */ + __invlpg(Address); +} + +FORCEINLINE +VOID +KeFlushProcessTb(VOID) +{ + /* Flush the TLB by resetting CR3 */ + __writecr3(__readcr3()); +} + +FORCEINLINE +VOID +KiRundownThread(IN PKTHREAD Thread) +{ +#ifndef CONFIG_SMP + DbgPrint("KiRundownThread is unimplemented\n"); +#else + /* Nothing to do */ +#endif +} + +VOID +FORCEINLINE +KiEndInterrupt(IN KIRQL Irql, + IN PKTRAP_FRAME TrapFrame) +{ + DbgPrint("KiEndInterrupt is unimplemented\n"); +} + +#define Ki386PerfEnd(x) + +struct _KPCR; + +VOID +FASTCALL +KiInitializeTss(IN PKTSS Tss, IN UINT64 Stack); + +VOID KiDivideErrorFault(); +VOID KiDebugTrapOrFault(); +VOID KiNmiInterrupt(); +VOID KiBreakpointTrap(); +VOID KiOverflowTrap(); +VOID KiBoundFault(); +VOID KiInvalidOpcodeFault(); +VOID KiNpxNotAvailableFault(); +VOID KiDoubleFaultAbort(); +VOID KiNpxSegmentOverrunAbort(); +VOID KiInvalidTssFault(); +VOID KiSegmentNotPresentFault(); +VOID KiStackFault(); +VOID KiGeneralProtectionFault(); +VOID KiPageFault(); +VOID KiFloatingErrorFault(); +VOID KiAlignmentFault(); +VOID KiMcheckAbort(); +VOID KiXmmException(); +VOID KiApcInterrupt(); +VOID KiRaiseAssertion(); +VOID KiDebugServiceTrap(); +VOID KiDpcInterrupt(); +VOID KiIpiInterrupt(); + +VOID +KiGdtPrepareForApplicationProcessorInit(ULONG Id); +VOID +Ki386InitializeLdt(VOID); +VOID +Ki386SetProcessorFeatures(VOID); + +VOID +NTAPI +KiGetCacheInformation(VOID); + +BOOLEAN +NTAPI +KiIsNpxPresent( + VOID +); + +BOOLEAN +NTAPI +KiIsNpxErrataPresent( + VOID +); + +VOID +NTAPI +KiSetProcessorType(VOID); + +ULONG +NTAPI +KiGetFeatureBits(VOID); + +VOID +NTAPI +KiInitializeCpuFeatures(); + +ULONG KeAllocateGdtSelector(ULONG Desc[2]); +VOID KeFreeGdtSelector(ULONG Entry); +VOID +NtEarlyInitVdm(VOID); +VOID +KeApplicationProcessorInitDispatcher(VOID); +VOID +KeCreateApplicationProcessorIdleThread(ULONG Id); + +VOID +NTAPI +Ke386InitThreadWithContext(PKTHREAD Thread, + PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + PCONTEXT Context); +#define KeArchInitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context) \ + Ke386InitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context) + +#ifdef _NTOSKRNL_ /* FIXME: Move flags above to NDK instead of here */ +VOID +NTAPI +KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + BOOLEAN UserThread, + KTRAP_FRAME TrapFrame); +#endif + +#endif +#endif /* __NTOSKRNL_INCLUDE_INTERNAL_AMD64_KE_H */ + +/* EOF */ Propchange: trunk/reactos/ntoskrnl/include/internal/amd64/ke.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/ntoskrnl/include/internal/amd64/mm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/amd64/mm.h (added) +++ trunk/reactos/ntoskrnl/include/internal/amd64/mm.h [iso-8859-1] Wed Mar 31 17:11:20 2010 @@ -1,0 +1,189 @@ +/* + * Lowlevel memory managment definitions + */ + +#pragma once + +/* Helper macros */ +#define PAGE_MASK(x) ((x)&(~0xfff)) +#define PAE_PAGE_MASK(x) ((x)&(~0xfffLL)) + +/* Memory layout base addresses */ +#define HYPER_SPACE 0xFFFFF70000000000ULL +#define HYPER_SPACE_END 0xFFFFF77FFFFFFFFFULL +#define MI_SESSION_SPACE_MINIMUM (PVOID)0xFFFFF90000000000ULL +#define MI_SESSION_VIEW_END (PVOID)0xFFFFF97FFF000000ULL +#define MI_SESSION_SPACE_END (PVOID)0xFFFFF98000000000ULL +#define MI_SYSTEM_PTE_START (PVOID)0xFFFFFAA000000000ULL +#define MI_PAGED_POOL_START (PVOID)0xFFFFFA8000000000ULL +#define MI_NON_PAGED_SYSTEM_START_MIN 0xFFFFFAA000000000ULL +#define MI_PFN_DATABASE (PVOID)0xFFFFFAC000000000ULL +#define MI_NONPAGED_POOL_END (PVOID)0xFFFFFAE000000000ULL +#define MI_DEBUG_MAPPING (PVOID)0xFFFFFFFF80000000ULL // FIXME +#define MI_HIGHEST_SYSTEM_ADDRESS (PVOID)0xFFFFFFFFFFFFFFFFULL +#define MI_SYSTEM_CACHE_WS_START (PVOID)0xFFFFF78000001000ULL // CHECKME + +/* Memory sizes */ +#define MI_MIN_PAGES_FOR_NONPAGED_POOL_TUNING ((255*1024*1024) >> PAGE_SHIFT) +#define MI_MIN_PAGES_FOR_SYSPTE_TUNING ((19*1024*1024) >> PAGE_SHIFT) +#define MI_MIN_PAGES_FOR_SYSPTE_BOOST ((32*1024*1024) >> PAGE_SHIFT) +#define MI_MAX_INIT_NONPAGED_POOL_SIZE (128ULL * 1024 * 1024 * 1024) +#define MI_MAX_NONPAGED_POOL_SIZE (128ULL * 1024 * 1024 * 1024) +#define MI_MAX_FREE_PAGE_LISTS 4 +#define MI_MIN_INIT_PAGED_POOLSIZE (32 * 1024 * 1024) +#define MI_SESSION_VIEW_SIZE (20 * 1024 * 1024) +#define MI_SESSION_POOL_SIZE (16 * 1024 * 1024) +#define MI_SESSION_IMAGE_SIZE (8 * 1024 * 1024) +#define MI_SESSION_WORKING_SET_SIZE (4 * 1024 * 1024) +#define MI_SESSION_SIZE (MI_SESSION_VIEW_SIZE + \ + MI_SESSION_POOL_SIZE + \ + MI_SESSION_IMAGE_SIZE + \ + MI_SESSION_WORKING_SET_SIZE) +#define MI_SYSTEM_VIEW_SIZE (16 * 1024 * 1024) +#define MI_NUMBER_SYSTEM_PTES 22000 + +PULONG64 +FORCEINLINE +MmGetPageDirectory(VOID) +{ + return (PULONG64)__readcr3(); +} + +PMMPTE +FORCEINLINE +MiAddressToPxe(PVOID Address) +{ + ULONG64 Offset = (ULONG64)Address >> (PXI_SHIFT - 3); + Offset &= PXI_MASK << 3; + return (PMMPTE)(PXE_BASE + Offset); +} + +PMMPTE +FORCEINLINE +MiAddressToPpe(PVOID Address) +{ + ULONG64 Offset = (ULONG64)Address >> (PPI_SHIFT - 3); + Offset &= 0x3FFFF << 3; + return (PMMPTE)(PPE_BASE + Offset); +} + +PMMPTE +FORCEINLINE +_MiAddressToPde(PVOID Address) +{ + ULONG64 Offset = (ULONG64)Address >> (PDI_SHIFT - 3); + Offset &= 0x7FFFFFF << 3; + return (PMMPTE)(PDE_BASE + Offset); +} +#define MiAddressToPde(x) _MiAddressToPde((PVOID)(x)) + +PMMPTE +FORCEINLINE +_MiAddressToPte(PVOID Address) +{ + ULONG64 Offset = (ULONG64)Address >> (PTI_SHIFT - 3); + Offset &= 0xFFFFFFFFFULL << 3; + return (PMMPTE)(PTE_BASE + Offset); +} +#define MiAddressToPte(x) _MiAddressToPte((PVOID)(x)) + +/* Convert a PTE into a corresponding address */ +PVOID +FORCEINLINE +MiPteToAddress(PMMPTE Pte) +{ + /* Use signed math */ + LONG64 Temp = (LONG64)Pte; + Temp <<= 25; + Temp >>= 16; + return (PVOID)Temp; +} + +BOOLEAN +FORCEINLINE +MiIsPdeForAddressValid(PVOID Address) +{ + return ((MiAddressToPxe(Address)->u.Hard.Valid) && + (MiAddressToPpe(Address)->u.Hard.Valid) && + (MiAddressToPde(Address)->u.Hard.Valid)); +} + +#define ADDR_TO_PAGE_TABLE(v) (((ULONG_PTR)(v)) / (512 * PAGE_SIZE)) +#define ADDR_TO_PDE_OFFSET(v) ((((ULONG_PTR)(v)) / (512 * PAGE_SIZE))) +#define ADDR_TO_PTE_OFFSET(v) ((((ULONG_PTR)(v)) % (512 * PAGE_SIZE)) / PAGE_SIZE) + +#define VAtoPXI(va) ((((ULONG64)va) >> PXI_SHIFT) & 0x1FF) +#define VAtoPPI(va) ((((ULONG64)va) >> PPI_SHIFT) & 0x1FF) +#define VAtoPDI(va) ((((ULONG64)va) >> PDI_SHIFT) & 0x1FF) +#define VAtoPTI(va) ((((ULONG64)va) >> PTI_SHIFT) & 0x1FF) + +/* We don't use these hacks */ +VOID +FORCEINLINE +MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size) +{ + /* Nothing to do */ +} + +VOID +FORCEINLINE +MmInitGlobalKernelPageDirectory(VOID) +{ + /* Nothing to do */ +} + +#define IS_ALIGNED(addr, align) (((ULONG64)(addr) & (align - 1)) == 0) +#define IS_PAGE_ALIGNED(addr) IS_ALIGNED(addr, PAGE_SIZE) + +/* Easy accessing PFN in PTE */ +#define PFN_FROM_PTE(v) ((v)->u.Hard.PageFrameNumber) + +// FIXME, only copied from x86 +#define MI_MAKE_LOCAL_PAGE(x) ((x)->u.Hard.Global = 0) +#define MI_MAKE_DIRTY_PAGE(x) ((x)->u.Hard.Dirty = 1) +#define MI_PAGE_DISABLE_CACHE(x) ((x)->u.Hard.CacheDisable = 1) +#define MI_PAGE_WRITE_THROUGH(x) ((x)->u.Hard.WriteThrough = 1) +#define MI_PAGE_WRITE_COMBINED(x) ((x)->u.Hard.WriteThrough = 0) +#if !defined(CONFIG_SMP) +#define MI_IS_PAGE_WRITEABLE(x) ((x)->u.Hard.Write == 1) +#else +#define MI_IS_PAGE_WRITEABLE(x) ((x)->u.Hard.Writable == 1) +#endif +#define MI_IS_PAGE_COPY_ON_WRITE(x)((x)->u.Hard.CopyOnWrite == 1) +#define MI_IS_PAGE_DIRTY(x) ((x)->u.Hard.Dirty == 1) +#define MI_MAKE_OWNER_PAGE(x) ((x)->u.Hard.Owner = 1) +#if !defined(CONFIG_SMP) +#define MI_MAKE_WRITE_PAGE(x) ((x)->u.Hard.Write = 1) +#else +#define MI_MAKE_WRITE_PAGE(x) ((x)->u.Hard.Writable = 1) +#endif + +// FIXME!!! +#define PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(x) \ + ((x) / (4*1024*1024)) + +#define PAGE_TO_SECTION_PAGE_TABLE_OFFSET(x) \ + ((((x)) % (4*1024*1024)) / (4*1024)) + +#define NR_SECTION_PAGE_TABLES 1024 +#define NR_SECTION_PAGE_ENTRIES 1024 + +//#define TEB_BASE 0x7FFDE000 + +#define MI_HYPERSPACE_PTES (256 - 1) +#define MI_ZERO_PTES (32) +#define MI_MAPPING_RANGE_START (ULONG)HYPER_SPACE +#define MI_MAPPING_RANGE_END (MI_MAPPING_RANGE_START + \ + MI_HYPERSPACE_PTES * PAGE_SIZE) +#define MI_ZERO_PTE (PMMPTE)(MI_MAPPING_RANGE_END + \ + PAGE_SIZE) + +/* On x86, these two are the same */ +#define MMPDE MMPTE +#define PMMPDE PMMPTE + +/* +* FIXME - different architectures have different cache line sizes... +*/ +#define MM_CACHE_LINE_SIZE 32 + Propchange: trunk/reactos/ntoskrnl/include/internal/amd64/mm.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/ntoskrnl/include/internal/arch/intrin_i.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/arch/intrin_i.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/arch/intrin_i.h [iso-8859-1] Wed Mar 31 17:11:20 2010 @@ -27,6 +27,8 @@ #include "../mips/intrin_i.h" #elif defined(_M_ARM) #include "../arm/intrin_i.h" +#elif defined(_M_AMD64) +#include "../amd64/intrin_i.h" #else #error "Unknown processor" #endif Modified: trunk/reactos/ntoskrnl/include/internal/arch/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/arch/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/arch/ke.h [iso-8859-1] Wed Mar 31 17:11:20 2010 @@ -27,6 +27,8 @@ #include "../mips/ke.h" #elif defined(_M_ARM) #include "../arm/ke.h" +#elif defined(_M_AMD64) +#include "../amd64/ke.h" #else #error "Unknown processor" #endif Modified: trunk/reactos/ntoskrnl/include/internal/arch/mm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/arch/mm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/arch/mm.h [iso-8859-1] Wed Mar 31 17:11:20 2010 @@ -27,6 +27,8 @@ #include <internal/mips/mm.h> #elif defined(_M_ARM) #include <internal/arm/mm.h> +#elif defined(_M_AMD64) +#include <internal/amd64/mm.h> #else #error "Unknown processor" #endif
14 years, 8 months
1
0
0
0
[fireball] 46619: [NTOSKRNL/CONFIG] - Implement new (correct) hive flusher lock/release routines, unused right now.
by fireball@svn.reactos.org
Author: fireball Date: Wed Mar 31 16:27:11 2010 New Revision: 46619 URL:
http://svn.reactos.org/svn/reactos?rev=46619&view=rev
Log: [NTOSKRNL/CONFIG] - Implement new (correct) hive flusher lock/release routines, unused right now. Modified: trunk/reactos/ntoskrnl/config/cmsysini.c trunk/reactos/ntoskrnl/include/internal/cm.h Modified: trunk/reactos/ntoskrnl/config/cmsysini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] Wed Mar 31 16:27:11 2010 @@ -27,6 +27,7 @@ BOOLEAN CmpSpecialBootCondition; BOOLEAN CmpNoWrite; BOOLEAN CmpWasSetupBoot; +BOOLEAN CmpProfileLoaded; ULONG CmpTraceLevel = 0; extern LONG CmpFlushStarveWriters; @@ -1624,6 +1625,56 @@ VOID NTAPI +CmpLockHiveFlusherExclusive(IN PCMHIVE Hive) +{ + /* Lock the flusher. We should already be in a critical section */ + CMP_ASSERT_REGISTRY_LOCK_OR_LOADING(Hive); + ASSERT((ExIsResourceAcquiredShared(Hive->FlusherLock) == 0) && + (ExIsResourceAcquiredExclusiveLite(Hive->FlusherLock) == 0)); + ExAcquireResourceExclusiveLite(Hive->FlusherLock, TRUE); +} + +VOID +NTAPI +CmpLockHiveFlusherShared(IN PCMHIVE Hive) +{ + /* Lock the flusher. We should already be in a critical section */ + CMP_ASSERT_REGISTRY_LOCK_OR_LOADING(Hive); + ASSERT((ExIsResourceAcquiredShared(Hive->FlusherLock) == 0) && + (ExIsResourceAcquiredExclusiveLite(Hive->FlusherLock) == 0)); + ExAcquireResourceSharedLite(Hive->FlusherLock, TRUE); +} + +VOID +NTAPI +CmpUnlockHiveFlusher(IN PCMHIVE Hive) +{ + /* Sanity check */ + CMP_ASSERT_REGISTRY_LOCK_OR_LOADING(Hive); + CMP_ASSERT_FLUSH_LOCK(Hive); + + /* Release the lock */ + ExReleaseResourceLite(Hive->FlusherLock); +} + +BOOLEAN +NTAPI +CmpTestHiveFlusherLockShared(IN PCMHIVE Hive) +{ + /* Test the lock */ + return !ExIsResourceAcquiredSharedLite(Hive->FlusherLock) ? FALSE : TRUE; +} + +BOOLEAN +NTAPI +CmpTestHiveFlusherLockExclusive(IN PCMHIVE Hive) +{ + /* Test the lock */ + return !ExIsResourceAcquiredExclusiveLite(Hive->FlusherLock) ? FALSE : TRUE; +} + +VOID +NTAPI CmpUnlockRegistry(VOID) { /* Sanity check */ Modified: trunk/reactos/ntoskrnl/include/internal/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/cm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/cm.h [iso-8859-1] Wed Mar 31 16:27:11 2010 @@ -622,6 +622,24 @@ ); // +// Hive List Routines +// +NTSTATUS +NTAPI +CmpAddToHiveFileList( + IN PCMHIVE Hive +); + +// +// Quota Routines +// +VOID +NTAPI +CmpSetGlobalQuotaAllowed( + VOID +); + +// // Notification Routines // VOID @@ -631,6 +649,13 @@ IN PHHIVE Hive, IN HCELL_INDEX Cell, IN ULONG Filter +); + +VOID +NTAPI +CmpFlushNotify( + IN PCM_KEY_BODY KeyBody, + IN BOOLEAN LockHeld ); VOID @@ -822,6 +847,36 @@ VOID ); +VOID +NTAPI +CmpLockHiveFlusherExclusive( + IN PCMHIVE Hive +); + +VOID +NTAPI +CmpLockHiveFlusherShared( + IN PCMHIVE Hive +); + +BOOLEAN +NTAPI +CmpTestHiveFlusherLockExclusive( + IN PCMHIVE Hive +); + +BOOLEAN +NTAPI +CmpTestHiveFlusherLockShared( + IN PCMHIVE Hive +); + +VOID +NTAPI +CmpUnlockHiveFlusher( + IN PCMHIVE Hive +); + // // Delay Functions // @@ -976,6 +1031,13 @@ CmpReleaseTwoKcbLockByKey( IN ULONG ConvKey1, IN ULONG ConvKey2 +); + +VOID +NTAPI +CmpFlushNotifiesOnKeyBodyList( + IN PCM_KEY_CONTROL_BLOCK Kcb, + IN BOOLEAN LockHeld ); // @@ -1507,6 +1569,7 @@ extern BOOLEAN CmpNoWrite; extern BOOLEAN CmpForceForceFlush; extern BOOLEAN CmpWasSetupBoot; +extern BOOLEAN CmpProfileLoaded; extern PCMHIVE CmiVolatileHive; extern LIST_ENTRY CmiKeyObjectListHead; extern BOOLEAN CmpHoldLazyFlush;
14 years, 8 months
1
0
0
0
[fireball] 46618: [NTOSKRNL/CONFIG] - Stub support for global quota enable. - Stub support for notifications. - Add a source file for a future HiveList implementation.
by fireball@svn.reactos.org
Author: fireball Date: Wed Mar 31 16:10:24 2010 New Revision: 46618 URL:
http://svn.reactos.org/svn/reactos?rev=46618&view=rev
Log: [NTOSKRNL/CONFIG] - Stub support for global quota enable. - Stub support for notifications. - Add a source file for a future HiveList implementation. Added: trunk/reactos/ntoskrnl/config/cmhvlist.c (with props) trunk/reactos/ntoskrnl/config/cmnotify.c (with props) trunk/reactos/ntoskrnl/config/cmquota.c (with props) Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild Added: trunk/reactos/ntoskrnl/config/cmhvlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmhvlist.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmhvlist.c (added) +++ trunk/reactos/ntoskrnl/config/cmhvlist.c [iso-8859-1] Wed Mar 31 16:10:24 2010 @@ -1,0 +1,17 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/cmwraprs.c + * PURPOSE: Configuration Manager - Wrappers for Hive Operations + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#define NDEBUG +#include "debug.h" + +/* FUNCTIONS *****************************************************************/ + +/* EOF */ Propchange: trunk/reactos/ntoskrnl/config/cmhvlist.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/ntoskrnl/config/cmnotify.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmnotify.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmnotify.c (added) +++ trunk/reactos/ntoskrnl/config/cmnotify.c [iso-8859-1] Wed Mar 31 16:10:24 2010 @@ -1,0 +1,36 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/cmwraprs.c + * PURPOSE: Configuration Manager - Wrappers for Hive Operations + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#define NDEBUG +#include "debug.h" + +/* FUNCTIONS *****************************************************************/ + +VOID +NTAPI +CmpReportNotify(IN PCM_KEY_CONTROL_BLOCK Kcb, + IN PHHIVE Hive, + IN HCELL_INDEX Cell, + IN ULONG Filter) +{ + /* FIXME: TODO */ + return; +} + +VOID +NTAPI +CmpFlushNotify(IN PCM_KEY_BODY KeyBody, + IN BOOLEAN LockHeld) +{ + /* FIXME: TODO */ + return; +} + Propchange: trunk/reactos/ntoskrnl/config/cmnotify.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/ntoskrnl/config/cmquota.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmquota.c?…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmquota.c (added) +++ trunk/reactos/ntoskrnl/config/cmquota.c [iso-8859-1] Wed Mar 31 16:10:24 2010 @@ -1,0 +1,26 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/cmwraprs.c + * PURPOSE: Configuration Manager - Wrappers for Hive Operations + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#define NDEBUG +#include "debug.h" + +BOOLEAN CmpGlobalQuota; +BOOLEAN CmpGlobalQuotaAllowed; + +/* FUNCTIONS *****************************************************************/ + +VOID +NTAPI +CmpSetGlobalQuotaAllowed(VOID) +{ + /* Set flag ON if quota enabled */ + CmpGlobalQuotaAllowed = CmpGlobalQuota; +} Propchange: trunk/reactos/ntoskrnl/config/cmquota.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Wed Mar 31 16:10:24 2010 @@ -144,13 +144,16 @@ <file>cmdelay.c</file> <file>cmindex.c</file> <file>cminit.c</file> + <file>cmhvlist.c</file> <file>cmhook.c</file> <file>cmkcbncb.c</file> <file>cmkeydel.c</file> <file>cmlazy.c</file> <file>cmmapvw.c</file> <file>cmname.c</file> + <file>cmnotify.c</file> <file>cmparse.c</file> + <file>cmquota.c</file> <file>cmse.c</file> <file>cmsecach.c</file> <file>cmsysini.c</file>
14 years, 8 months
1
0
0
0
[fireball] 46617: [NTOSKRNL/CONFIG] - Add more assert macros for registry operations: locked or loading, exclusively locked or loading, hash and KCB locks, locked for flushing. - Add macros for getting alloc page from KCB and delay alloc item.
by fireball@svn.reactos.org
Author: fireball Date: Wed Mar 31 15:25:51 2010 New Revision: 46617 URL:
http://svn.reactos.org/svn/reactos?rev=46617&view=rev
Log: [NTOSKRNL/CONFIG] - Add more assert macros for registry operations: locked or loading, exclusively locked or loading, hash and KCB locks, locked for flushing. - Add macros for getting alloc page from KCB and delay alloc item. Modified: trunk/reactos/ntoskrnl/include/internal/cm_x.h Modified: trunk/reactos/ntoskrnl/include/internal/cm_x.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/cm_x.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/cm_x.h [iso-8859-1] Wed Mar 31 15:25:51 2010 @@ -92,10 +92,26 @@ (CmpTestRegistryLock() == TRUE)) // +// Makes sure that the registry is locked or loading +// +#define CMP_ASSERT_REGISTRY_LOCK_OR_LOADING(h) \ + ASSERT((CmpSpecialBootCondition == TRUE) || \ + (((PCMHIVE)h)->HiveIsLoading == TRUE) || \ + (CmpTestRegistryLock() == TRUE)) + +// // Makes sure that the registry is exclusively locked // #define CMP_ASSERT_EXCLUSIVE_REGISTRY_LOCK() \ ASSERT((CmpSpecialBootCondition == TRUE) || \ + (CmpTestRegistryLockExclusive() == TRUE)) + +// +// Makes sure that the registry is exclusively locked or loading +// +#define CMP_ASSERT_EXCLUSIVE_REGISTRY_LOCK_OR_LOADING(h) \ + ASSERT((CmpSpecialBootCondition == TRUE) || \ + (((PCMHIVE)h)->HiveIsLoading == TRUE) || \ (CmpTestRegistryLockExclusive() == TRUE)) // @@ -256,7 +272,7 @@ } // -// Asserts that either the registry or the KCB is locked +// Asserts that either the registry or the hash entry is locked // #define CMP_ASSERT_HASH_ENTRY_LOCK(k) \ { \ @@ -266,6 +282,15 @@ } // +// Asserts that either the registry or the KCB is locked +// +#define CMP_ASSERT_KCB_LOCK(k) \ +{ \ + ASSERT((CmpIsKcbLockedExclusive(k) == TRUE) || \ + (CmpTestRegistryLockExclusive() == TRUE)); \ +} + +// // Gets the page attached to the KCB // #define CmpGetAllocPageFromKcb(k) \ @@ -276,3 +301,35 @@ // #define CmpGetAllocPageFromDelayAlloc(a) \ (PCM_ALLOC_PAGE)(((ULONG_PTR)(a)) & ~(PAGE_SIZE - 1)) + +// +// Makes sure that the registry is locked for flushes +// +#define CMP_ASSERT_FLUSH_LOCK(h) \ + ASSERT((CmpSpecialBootCondition == TRUE) || \ + (((PCMHIVE)h)->HiveIsLoading == TRUE) || \ + (CmpTestHiveFlusherLockShared((PCMHIVE)h) == TRUE) || \ + (CmpTestHiveFlusherLockExclusive((PCMHIVE)h) == TRUE) || \ + (CmpTestRegistryLockExclusive() == TRUE)); + +// +// Asserts that either the registry or the KCB is locked +// +#define CMP_ASSERT_HASH_ENTRY_LOCK(k) \ +{ \ + ASSERT(((GET_HASH_ENTRY(CmpCacheTable, k).Owner == \ + KeGetCurrentThread())) || \ + (CmpTestRegistryLockExclusive() == TRUE)); \ +} + +// +// Gets the page attached to the KCB +// +#define CmpGetAllocPageFromKcb(k) \ + (PCM_ALLOC_PAGE)(((ULONG_PTR)(k)) & ~(PAGE_SIZE - 1)) + +// +// Gets the page attached to the delayed allocation +// +#define CmpGetAllocPageFromDelayAlloc(a) \ + (PCM_ALLOC_PAGE)(((ULONG_PTR)(a)) & ~(PAGE_SIZE - 1))
14 years, 8 months
1
0
0
0
[tkreuzer] 46616: [tchar.h] enable _tcsnlen definition
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 31 14:16:42 2010 New Revision: 46616 URL:
http://svn.reactos.org/svn/reactos?rev=46616&view=rev
Log: [tchar.h] enable _tcsnlen definition Modified: trunk/reactos/include/crt/tchar.h Modified: trunk/reactos/include/crt/tchar.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/tchar.h?rev=46…
============================================================================== --- trunk/reactos/include/crt/tchar.h [iso-8859-1] (original) +++ trunk/reactos/include/crt/tchar.h [iso-8859-1] Wed Mar 31 14:16:42 2010 @@ -624,9 +624,7 @@ #define _tcscpy_s strcpy_s #define _tcsdup _strdup #define _tcslen strlen -#if 0 #define _tcsnlen strnlen -#endif #define _tcsxfrm strxfrm #define _tcsxfrm_l _strxfrm_l #define _tcserror strerror
14 years, 8 months
1
0
0
0
[tkreuzer] 46615: [RBUILD] - Don't link to RosBE's ofmt_stub.a, as we have our own version now. - Don't link to libcoldname.a on amd64, instead link to libgcc_eh.a
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 31 13:57:21 2010 New Revision: 46615 URL:
http://svn.reactos.org/svn/reactos?rev=46615&view=rev
Log: [RBUILD] - Don't link to RosBE's ofmt_stub.a, as we have our own version now. - Don't link to libcoldname.a on amd64, instead link to libgcc_eh.a Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
============================================================================== --- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp [iso-8859-1] (original) +++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp [iso-8859-1] Wed Mar 31 13:57:21 2010 @@ -480,18 +480,17 @@ fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile ); fprintf ( fMakefile, "PROJECT_CCLIBS := \"$(shell ${TARGET_CC} -print-libgcc-file-name)\"\n" ); - - // We use our proprietary "ofmt_stub.a" to implement a stub for "_get_output_format" required by "libmingwex.a". - // This archive just contains the compiled "ofmt_stub.s" supplied with the MinGW Runtime sources. - fprintf ( fMakefile, "PROJECT_CXXLIBS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-libgcc-file-name)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\" \"$(shell ${TARGET_CPP} -print-file-name=ofmt_stub.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)\"\n" ); + + fprintf ( fMakefile, "PROJECT_CXXLIBS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-libgcc-file-name)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\"" ); /* hack to get libgcc_eh.a, should check mingw version or something */ if (Environment::GetArch() == "amd64") - { - fprintf ( fMakefile, "PROJECT_LPPFLAGS += $(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)\n" ); - } - } - + fprintf ( fMakefile, " \"$(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)\"" ); + /* hack to get _get_output_format, needed by libmingwex */ + else if (Environment::GetArch() == "i386") + fprintf ( fMakefile, " \"$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)\" "); + fprintf ( fMakefile,"\n"); + } MingwModuleHandler::GenerateParameters ( "PROJECT", "+=", ProjectNode.non_if_data ); MingwModuleHandler::GenerateParameters ( "PROJECT_HOST", "+=", ProjectNode.host_non_if_data ); @@ -975,7 +974,7 @@ { int digit = binutilsVersion.find_last_of("."); if(digit == -1) - { + { printf("Unable to detect binutils version!\n"); return false; }
14 years, 8 months
1
0
0
0
[tkreuzer] 46614: [KERNEL32] Add RtlAddFunctionTable export for amd64
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 31 12:21:14 2010 New Revision: 46614 URL:
http://svn.reactos.org/svn/reactos?rev=46614&view=rev
Log: [KERNEL32] Add RtlAddFunctionTable export for amd64 Modified: trunk/reactos/dll/win32/kernel32/kernel32.pspec Modified: trunk/reactos/dll/win32/kernel32/kernel32.pspec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.pspec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.pspec [iso-8859-1] Wed Mar 31 12:21:14 2010 @@ -759,6 +759,7 @@ @ stdcall ResetWriteWatch(ptr long) @ stdcall RestoreLastError(long) ntdll.RtlRestoreLastWin32Error @ stdcall ResumeThread(long) +@ stdcall -arch=x86_64 RtlAddFunctionTable(ptr long double) @ stdcall RtlCaptureContext(ptr) ntdll.RtlCaptureContext @ stdcall RtlCaptureStackBackTrace(long long ptr ptr) ntdll.RtlCaptureStackBackTrace @ stdcall -arch=x86_64 RtlCompareMemory(ptr ptr ptr)
14 years, 8 months
1
0
0
0
[sir_richard] 46613: [HALACPI]: Implement beginning of HAL ACPI support (HalpSetupAcpiPhase0). Tested on VMWare, where it found the FACP, SRAT, RSDT and MCFG and the ACPI Timer at 1008H. BOOT and DBGP are not found (optional features). [HALACPI]: Support depends on boot loader creating the ACPI BIOS Multi Node structure in MultiFunctionAdapter in the hardware tree. It seems that FreeLdr does this (wow!) correctly! [HALACPI]: Implement HAL ACPI Table Cache. [HALACPI]: HAL ACPI Table Overrides fro
by sir_richard@svn.reactos.org
Author: sir_richard Date: Wed Mar 31 06:43:39 2010 New Revision: 46613 URL:
http://svn.reactos.org/svn/reactos?rev=46613&view=rev
Log: [HALACPI]: Implement beginning of HAL ACPI support (HalpSetupAcpiPhase0). Tested on VMWare, where it found the FACP, SRAT, RSDT and MCFG and the ACPI Timer at 1008H. BOOT and DBGP are not found (optional features). [HALACPI]: Support depends on boot loader creating the ACPI BIOS Multi Node structure in MultiFunctionAdapter in the hardware tree. It seems that FreeLdr does this (wow!) correctly! [HALACPI]: Implement HAL ACPI Table Cache. [HALACPI]: HAL ACPI Table Overrides from the boot loader are not supported (doubt FreeLdr does this). [HALACPI]: The next steps are to write the HAL ACPI PnP Driver and HAL ACPI Power Driver. Added: trunk/reactos/hal/halx86/generic/acpi/halacpi.c (with props) trunk/reactos/hal/halx86/generic/legacy/halpcat.c (with props) Modified: trunk/reactos/hal/halx86/generic/halinit.c trunk/reactos/hal/halx86/hal_generic.rbuild Added: trunk/reactos/hal/halx86/generic/acpi/halacpi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/acpi/ha…
============================================================================== --- trunk/reactos/hal/halx86/generic/acpi/halacpi.c (added) +++ trunk/reactos/hal/halx86/generic/acpi/halacpi.c [iso-8859-1] Wed Mar 31 06:43:39 2010 @@ -1,0 +1,864 @@ +/* + * PROJECT: ReactOS HAL + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: hal/halx86/generic/acpi/halacpi.c + * PURPOSE: HAL ACPI Code + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include <hal.h> +#define NDEBUG +#include <debug.h> + +/* GLOBALS ********************************************************************/ + +LIST_ENTRY HalpAcpiTableCacheList; +FAST_MUTEX HalpAcpiTableCacheLock; + +BOOLEAN HalpProcessedACPIPhase0; +BOOLEAN HalpPhysicalMemoryMayAppearAbove4GB; + +FADT HalpFixedAcpiDescTable; +PDEBUG_PORT_TABLE HalpDebugPortTable; +PACPI_SRAT HalpAcpiSrat; +PBOOT_TABLE HalpSimpleBootFlagTable; + +PHYSICAL_ADDRESS HalpMaxHotPlugMemoryAddress; +PHYSICAL_ADDRESS HalpLowStubPhysicalAddress; +PHARDWARE_PTE HalpPteForFlush; +PVOID HalpVirtAddrForFlush; +PVOID HalpLowStub; + +PACPI_BIOS_MULTI_NODE HalpAcpiMultiNode; + +LIST_ENTRY HalpAcpiTableMatchList; + +ULONG HalpInvalidAcpiTable; + +/* PRIVATE FUNCTIONS **********************************************************/ + +PDESCRIPTION_HEADER +NTAPI +HalpAcpiGetCachedTable(IN ULONG Signature) +{ + PLIST_ENTRY ListHead, NextEntry; + PACPI_CACHED_TABLE CachedTable; + + /* Loop cached tables */ + ListHead = &HalpAcpiTableCacheList; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + /* Get the table */ + CachedTable = CONTAINING_RECORD(NextEntry, ACPI_CACHED_TABLE, Links); + + /* Compare signatures */ + if (CachedTable->Header.Signature == Signature) return &CachedTable->Header; + + /* Keep going */ + NextEntry = NextEntry->Flink; + } + + /* Nothing found */ + return NULL; +} + +VOID +NTAPI +HalpAcpiCacheTable(IN PDESCRIPTION_HEADER TableHeader) +{ + PACPI_CACHED_TABLE CachedTable; + + /* Get the cached table and link it */ + CachedTable = CONTAINING_RECORD(TableHeader, ACPI_CACHED_TABLE, Header); + InsertTailList(&HalpAcpiTableCacheList, &CachedTable->Links); +} + +PVOID +NTAPI +HalpAcpiCopyBiosTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock, + IN PDESCRIPTION_HEADER TableHeader) +{ + ULONG Size; + PFN_NUMBER PageCount; + PHYSICAL_ADDRESS PhysAddress; + PACPI_CACHED_TABLE CachedTable; + PDESCRIPTION_HEADER CopiedTable; + + /* Size we'll need for the cached table */ + Size = TableHeader->Length + FIELD_OFFSET(ACPI_CACHED_TABLE, Header); + if (LoaderBlock) + { + /* Phase 0: Convert to pages and use the HAL heap */ + PageCount = BYTES_TO_PAGES(Size); + PhysAddress.LowPart = HalpAllocPhysicalMemory(LoaderBlock, + 0x1000000, + PageCount, + FALSE); + if (PhysAddress.LowPart) + { + /* Map it */ + CachedTable = HalpMapPhysicalMemory64(PhysAddress, PageCount); + } + else + { + /* No memory, so nothing to map */ + CachedTable = NULL; + } + } + else + { + /* Use Mm pool */ + CachedTable = ExAllocatePoolWithTag(NonPagedPool, Size, ' laH'); + } + + /* Do we have the cached table? */ + if (CachedTable) + { + /* Copy the data */ + CopiedTable = &CachedTable->Header; + RtlCopyMemory(CopiedTable, TableHeader, TableHeader->Length); + } + else + { + /* Nothing to return */ + CopiedTable = NULL; + } + + /* Return the table */ + return CopiedTable; +} + +PVOID +NTAPI +HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock, + IN ULONG Signature) +{ + PHYSICAL_ADDRESS PhysicalAddress; + PXSDT Xsdt; + PRSDT Rsdt; + PFADT Fadt; + PDESCRIPTION_HEADER Header = NULL; + ULONG TableLength; + CHAR CheckSum = 0; + ULONG Offset; + ULONG EntryCount, CurrentEntry; + PCHAR CurrentByte; + PFN_NUMBER PageCount; + + /* Should not query the RSDT/XSDT by itself */ + if ((Signature == RSDT_SIGNATURE) || (Signature == XSDT_SIGNATURE)) return NULL; + + /* Special case request for DSDT, because the FADT points to it */ + if (Signature == DSDT_SIGNATURE) + { + /* Grab the FADT */ + Fadt = HalpAcpiGetTable(LoaderBlock, FADT_SIGNATURE); + if (Fadt) + { + /* Grab the DSDT address and assume 2 pages */ + PhysicalAddress.LowPart = Fadt->dsdt; + TableLength = 2 * PAGE_SIZE; + + /* Map it */ + if (LoaderBlock) + { + /* Phase 0, use HAL heap */ + Header = HalpMapPhysicalMemory64(PhysicalAddress, 2u); + } + else + { + /* Phase 1, use Mm */ + Header = MmMapIoSpace(PhysicalAddress, 2 * PAGE_SIZE, 0); + } + + /* Fail if we couldn't map it */ + if (!Header) + { + DbgPrint("HAL: Failed to map ACPI table.\n"); + return NULL; + } + + /* Validate the signature */ + DPRINT1("ACPI DSDT at 0x%p\n", Header); + if (Header->Signature != DSDT_SIGNATURE) + { + /* Fail and unmap */ + if (LoaderBlock) + { + /* Using HAL heap */ + HalpUnmapVirtualAddress(Header, 2); + } + else + { + /* Using Mm */ + MmUnmapIoSpace(Header, 2 * PAGE_SIZE); + } + + /* Didn't find anything */ + return NULL; + } + } + else + { + /* Couldn't find it */ + return NULL; + } + } + else + { + /* To find tables, we need the RSDT */ + Rsdt = HalpAcpiGetTable(LoaderBlock, RSDT_SIGNATURE); + if (Rsdt) + { + /* Won't be using the XSDT */ + Xsdt = NULL; + } + else + { + /* Only other choice is to use the XSDT */ + Xsdt = HalpAcpiGetTable(LoaderBlock, XSDT_SIGNATURE); + if (!Xsdt) return NULL; + + /* Won't be using the RSDT */ + DPRINT1("ACPI XSDT at 0x%p\n", Xsdt); + Rsdt = NULL; + } + + /* Smallest RSDT/XSDT is one without table entries */ + Offset = FIELD_OFFSET(RSDT, Tables); + if (Xsdt) + { + /* Figure out total size of table and the offset */ + TableLength = Xsdt->Header.Length; + if (TableLength < Offset) Offset = Xsdt->Header.Length; + + /* The entries are each 64-bits, so count them */ + EntryCount = (TableLength - Offset) / sizeof(PHYSICAL_ADDRESS); + } + else + { + /* Figure out total size of table and the offset */ + TableLength = Rsdt->Header.Length; + if (TableLength < Offset) Offset = Rsdt->Header.Length; + + /* The entries are each 32-bits, so count them */ + EntryCount = (TableLength - Offset) / sizeof(ULONG); + } + + /* Start at the beginning of the array and loop it */ + for (CurrentEntry = 0; CurrentEntry < EntryCount; CurrentEntry++) + { + /* Are we using the XSDT? */ + if (!Xsdt) + { + /* Read the 32-bit physical address */ + PhysicalAddress.LowPart = Rsdt->Tables[CurrentEntry]; + } + else + { + /* Read the 64-bit physical address */ + PhysicalAddress = Xsdt->Tables[CurrentEntry]; + } + + /* Had we already mapped a table? */ + if (Header) + { + /* Yes, unmap it */ + if (LoaderBlock) + { + /* Using HAL heap */ + HalpUnmapVirtualAddress(Header, 2); + } + else + { + /* Using Mm */ + MmUnmapIoSpace(Header, 2 * PAGE_SIZE); + } + } + + /* Now map this table */ + if (!LoaderBlock) + { + /* Phase 1: Use HAL heap */ + Header = MmMapIoSpace(PhysicalAddress, 2 * PAGE_SIZE, MmNonCached); + } + else + { + /* Phase 0: Use Mm */ + Header = HalpMapPhysicalMemory64(PhysicalAddress, 2); + } + + /* Check if we mapped it */ + if (!Header) + { + /* Game over */ + DbgPrint("HAL: Failed to map ACPI table.\n"); + return NULL; + } + + /* We found it, break out */ + DPRINT("Found ACPI table %c%c%c%c at 0x%p\n", + Header->Signature & 0xFF, + (Header->Signature & 0xFF00) >> 8, + (Header->Signature & 0xFF0000) >> 16, + (Header->Signature & 0xFF000000) >> 24, + Header); + if (Header->Signature == Signature) break; + } + + /* Did we end up here back at the last entry? */ + if (CurrentEntry == EntryCount) + { + /* Yes, unmap the last table we processed */ + if (LoaderBlock) + { + /* Using HAL heap */ + HalpUnmapVirtualAddress(Header, 2); + } + else + { + /* Using Mm */ + MmUnmapIoSpace(Header, 2 * PAGE_SIZE); + } + + /* Didn't find anything */ + return NULL; + } + } + + /* Past this point, we assume something was found */ + ASSERT(Header); + + /* How many pages do we need? */ + PageCount = BYTES_TO_PAGES(Header->Length); + if (PageCount != 2) + { + /* We assumed two, but this is not the case, free the current mapping */ + if (LoaderBlock) + { + /* Using HAL heap */ + HalpUnmapVirtualAddress(Header, 2); + } + else + { + /* Using Mm */ + MmUnmapIoSpace(Header, 2 * PAGE_SIZE); + } + + /* Now map this table using its correct size */ + if (!LoaderBlock) + { + /* Phase 1: Use HAL heap */ + Header = MmMapIoSpace(PhysicalAddress, PageCount << PAGE_SHIFT, MmNonCached); + } + else + { + /* Phase 0: Use Mm */ + Header = HalpMapPhysicalMemory64(PhysicalAddress, PageCount); + } + } + + /* Fail if the remapped failed */ + if (!Header) return NULL; + + /* All tables in ACPI 3.0 other than the FACP should have correct checksum */ + if ((Header->Signature != FADT_SIGNATURE) || (Header->Revision > 2)) + { + /* Go to the end of the table */ + CheckSum = 0; + CurrentByte = (PCHAR)Header + Header->Length; + while (CurrentByte-- != (PCHAR)Header) + { + /* Add this byte */ + CheckSum += *CurrentByte; + } + + /* The correct checksum is always 0, anything else is illegal */ + if (CheckSum) HalpInvalidAcpiTable = Header->Signature; + } + + /* Return the table */ + return Header; +} + +PVOID +NTAPI +HalpAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock, + IN ULONG Signature) +{ + PFN_NUMBER PageCount; + PDESCRIPTION_HEADER TableAddress, BiosCopy; + + /* See if we have a cached table? */ + TableAddress = HalpAcpiGetCachedTable(Signature); + if (!TableAddress) + { + /* No cache, search the BIOS */ + TableAddress = HalpAcpiGetTableFromBios(LoaderBlock, Signature); + if (TableAddress) + { + /* Found it, copy it into our own memory */ + BiosCopy = HalpAcpiCopyBiosTable(LoaderBlock, TableAddress); + + /* Get the pages, and unmap the BIOS copy */ + PageCount = BYTES_TO_PAGES(TableAddress->Length); + if (LoaderBlock) + { + /* Phase 0, use the HAL heap */ + HalpUnmapVirtualAddress(TableAddress, PageCount); + } + else + { + /* Phase 1, use Mm */ + MmUnmapIoSpace(TableAddress, PageCount << 12); + } + + /* Cache the bios copy */ + TableAddress = BiosCopy; + if (BiosCopy) HalpAcpiCacheTable(BiosCopy); + } + } + + /* Return the table */ + return TableAddress; +} + +PVOID +NTAPI +HalAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock, + IN ULONG Signature) +{ + PDESCRIPTION_HEADER TableHeader; + + /* Is this phase0 */ + if (LoaderBlock) + { + /* Initialize the cache first */ + if (!NT_SUCCESS(HalpAcpiTableCacheInit(LoaderBlock))) return NULL; + } + else + { + /* Lock the cache */ + ExAcquireFastMutex(&HalpAcpiTableCacheLock); + } + + /* Get the table */ + TableHeader = HalpAcpiGetTable(LoaderBlock, Signature); + + /* Release the lock in phase 1 */ + if (!LoaderBlock) ExReleaseFastMutex(&HalpAcpiTableCacheLock); + + /* Return the table */ + return TableHeader; +} + +VOID +NTAPI +HalpNumaInitializeStaticConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PACPI_SRAT SratTable; + + /* Get the SRAT, bail out if it doesn't exist */ + SratTable = HalAcpiGetTable(LoaderBlock, SRAT_SIGNATURE); + HalpAcpiSrat = SratTable; + if (!SratTable) return; +} + +VOID +NTAPI +HalpGetHotPlugMemoryInfo(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PACPI_SRAT SratTable; + + /* Get the SRAT, bail out if it doesn't exist */ + SratTable = HalAcpiGetTable(LoaderBlock, SRAT_SIGNATURE); + HalpAcpiSrat = SratTable; + if (!SratTable) return; +} + +VOID +NTAPI +HalpDynamicSystemResourceConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + /* For this HAL, it means to get hot plug memory information */ + HalpGetHotPlugMemoryInfo(LoaderBlock); +} + +VOID +NTAPI +HalpAcpiDetectMachineSpecificActions(IN PLOADER_PARAMETER_BLOCK LoaderBlock, + IN PFADT DescriptionTable) +{ + /* Does this HAL specify something? */ + if (HalpAcpiTableMatchList.Flink) + { + /* Great, but we don't support it */ + DPRINT1("WARNING: Your HAL has specific ACPI hacks to apply!\n"); + } +} + +VOID +NTAPI +HalpInitBootTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PBOOT_TABLE BootTable; + + /* Get the boot table */ + BootTable = HalAcpiGetTable(LoaderBlock, BOOT_SIGNATURE); + HalpSimpleBootFlagTable = BootTable; + DPRINT1("ACPI BOOT at 0x%p\n", HalpSimpleBootFlagTable); + + /* Validate it */ + if ((BootTable) && + (BootTable->Header.Length >= sizeof(BOOT_TABLE)) && + (BootTable->CMOSIndex >= 9)) + { + DPRINT1("ACPI Boot table found, but not supported!\n"); + } + else + { + /* Invalid or doesn't exist, ignore it */ + HalpSimpleBootFlagTable = 0; + } + + /* Install the end of boot handler */ +// HalEndOfBoot = HalpEndOfBoot; +} + +NTSTATUS +NTAPI +HalpAcpiFindRsdtPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock, + OUT PACPI_BIOS_MULTI_NODE* AcpiMultiNode) +{ + PCONFIGURATION_COMPONENT_DATA ComponentEntry; + PCONFIGURATION_COMPONENT_DATA Next = NULL; + PCM_PARTIAL_RESOURCE_LIST ResourceList; + PACPI_BIOS_MULTI_NODE NodeData; + ULONG NodeLength; + PFN_NUMBER PageCount; + PVOID MappedAddress; + PHYSICAL_ADDRESS PhysicalAddress; + + /* Did we already do this once? */ + if (HalpAcpiMultiNode) + { + /* Return what we know */ + *AcpiMultiNode = HalpAcpiMultiNode; + return STATUS_SUCCESS; + } + + /* Assume failure */ + *AcpiMultiNode = NULL; + + /* Find the multi function adapter key */ + ComponentEntry = KeFindConfigurationNextEntry(LoaderBlock->ConfigurationRoot, + AdapterClass, + MultiFunctionAdapter, + 0, + &Next); + while (ComponentEntry) + { + /* Find the ACPI BIOS key */ + if (!_stricmp(ComponentEntry->ComponentEntry.Identifier, "ACPI BIOS")) + { + /* Found it */ + break; + } + + /* Keep searching */ + Next = ComponentEntry; + ComponentEntry = KeFindConfigurationNextEntry(LoaderBlock->ConfigurationRoot, + AdapterClass, + MultiFunctionAdapter, + NULL, + &Next); + } + + /* Make sure we found it */ + if (!ComponentEntry) + { + DbgPrint("**** HalpAcpiFindRsdtPhase0: did NOT find RSDT\n"); + return STATUS_NOT_FOUND; + } + + /* The configuration data is a resource list, and the BIOS node follows */ + ResourceList = ComponentEntry->ConfigurationData; + NodeData = (PACPI_BIOS_MULTI_NODE)(ResourceList + 1); + + /* How many E820 memory entries are there? */ + NodeLength = sizeof(ACPI_BIOS_MULTI_NODE) + + (NodeData->Count - 1) * sizeof(ACPI_E820_ENTRY); + + /* Convert to pages */ + PageCount = BYTES_TO_PAGES(NodeLength); + + /* Allocate the memory */ + PhysicalAddress.LowPart = HalpAllocPhysicalMemory(LoaderBlock, + 0x1000000, + PageCount, + FALSE); + if (PhysicalAddress.LowPart) + { + /* Map it if the allocation worked */ + MappedAddress = HalpMapPhysicalMemory64(PhysicalAddress, PageCount); + } + else + { + /* Otherwise we'll have to fail */ + MappedAddress = NULL; + } + + /* Save the multi node, bail out if we didn't find it */ + HalpAcpiMultiNode = MappedAddress; + if (!MappedAddress) return STATUS_INSUFFICIENT_RESOURCES; + + /* Copy the multi-node data */ + RtlCopyMemory(MappedAddress, NodeData, NodeLength); + + /* Return the data */ + *AcpiMultiNode = HalpAcpiMultiNode; + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PACPI_BIOS_MULTI_NODE AcpiMultiNode; + NTSTATUS Status = STATUS_SUCCESS; + PHYSICAL_ADDRESS PhysicalAddress; + PVOID MappedAddress; + ULONG TableLength; + PRSDT Rsdt; + PLOADER_PARAMETER_EXTENSION LoaderExtension; + + /* Only initialize once */ + if (HalpAcpiTableCacheList.Flink) return Status; + + /* Setup the lock and table */ + ExInitializeFastMutex(&HalpAcpiTableCacheLock); + InitializeListHead(&HalpAcpiTableCacheList); + + /* Find the RSDT */ + Status = HalpAcpiFindRsdtPhase0(LoaderBlock, &AcpiMultiNode); + if (!NT_SUCCESS(Status)) return Status; + + /* Map the RSDT */ + if (LoaderBlock) + { + /* Phase0: Use HAL Heap to map the RSDT, we assume it's about 2 pages */ + PhysicalAddress.QuadPart = AcpiMultiNode->RsdtAddress.QuadPart; + MappedAddress = HalpMapPhysicalMemory64(PhysicalAddress, 2); + } + else + { + /* Use an I/O map */ + MappedAddress = MmMapIoSpace(PhysicalAddress, PAGE_SIZE * 2, MmNonCached); + } + + /* Get the RSDT */ + Rsdt = MappedAddress; + if (!MappedAddress) + { + /* Fail, no memory */ + DbgPrint("HAL: Failed to map RSDT\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Validate it */ + DPRINT1("ACPI RSDT at 0x%p\n", Rsdt); + if ((Rsdt->Header.Signature != RSDT_SIGNATURE) && + (Rsdt->Header.Signature != XSDT_SIGNATURE)) + { + /* Very bad: crash */ + HalDisplayString("Bad RSDT pointer\n"); + KeBugCheckEx(MISMATCHED_HAL, 4, __LINE__, 0, 0); + } + + /* We assumed two pages -- do we need less or more? */ + TableLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(PhysicalAddress.LowPart, + Rsdt->Header.Length); + if (TableLength != 2) + { + /* Are we in phase 0 or 1? */ + if (!LoaderBlock) + { + /* Unmap the old table, remap the new one, using Mm I/O space */ + MmUnmapIoSpace(MappedAddress, 2 * PAGE_SIZE); + MappedAddress = MmMapIoSpace(PhysicalAddress, + TableLength << PAGE_SHIFT, + MmNonCached); + } + else + { + /* Unmap the old table, remap the new one, using HAL heap */ + HalpUnmapVirtualAddress(MappedAddress, 2); + MappedAddress = HalpMapPhysicalMemory64(PhysicalAddress, TableLength); + } + + /* Get the remapped table */ + Rsdt = MappedAddress; + if (!MappedAddress) + { + /* Fail, no memory */ + DbgPrint("HAL: Couldn't remap RSDT\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + } + + /* Now take the BIOS copy and make our own local copy */ + Rsdt = HalpAcpiCopyBiosTable(LoaderBlock, &Rsdt->Header); + if (!Rsdt) + { + /* Fail, no memory */ + DbgPrint("HAL: Couldn't remap RSDT\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Get rid of the BIOS mapping */ + if (LoaderBlock) + { + /* Use HAL heap */ + HalpUnmapVirtualAddress(MappedAddress, TableLength); + } + else + { + /* Use Mm */ + MmUnmapIoSpace(MappedAddress, TableLength << PAGE_SHIFT); + } + + /* Cache the RSDT */ + HalpAcpiCacheTable(&Rsdt->Header); + + /* Check for compatible loader block extension */ + LoaderExtension = LoaderBlock->Extension; + if (LoaderExtension->Size >= 0x58) + { + /* Compatible loader: did it provide an ACPI table override? */ + if ((LoaderExtension->AcpiTable) && (LoaderExtension->AcpiTableSize)) + { + /* Great, because we don't support it! */ + DPRINT1("ACPI Table Overrides Not Supported!\n"); + } + } + + /* Done */ + return Status; +} + +VOID +NTAPI +HaliAcpiTimerInit(IN ULONG TimerPort, + IN ULONG TimerValExt) +{ + PAGED_CODE(); + + /* Is this in the init phase? */ + if (!TimerPort ) + { + /* Get the data from the FADT */ + TimerPort = HalpFixedAcpiDescTable.pm_tmr_blk_io_port; + TimerValExt = HalpFixedAcpiDescTable.flags & ACPI_TMR_VAL_EXT; + } + + /* FIXME: Now proceed to the timer initialization */ + DPRINT1("ACPI Timer at: %Xh (EXT: %d)\n", TimerPort, TimerValExt); + //HalaAcpiTimerInit(TimerPort, TimerValExt); +} + +NTSTATUS +NTAPI +HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + NTSTATUS Status; + PFADT Fadt; + ULONG TableLength; + PHYSICAL_ADDRESS PhysicalAddress; + + /* Only do this once */ + DPRINT1("You are booting the ACPI HAL!\n"); + if (HalpProcessedACPIPhase0) return STATUS_SUCCESS; + + /* Setup the ACPI table cache */ + Status = HalpAcpiTableCacheInit(LoaderBlock); + if (!NT_SUCCESS(Status)) return Status; + + /* Grab the FADT */ + Fadt = HalAcpiGetTable(LoaderBlock, FADT_SIGNATURE); + if (!Fadt) + { + /* Fail */ + DbgPrint("HAL: Didn't find the FACP\n"); + return STATUS_NOT_FOUND; + } + + /* Assume typical size, otherwise whatever the descriptor table says */ + DPRINT1("ACPI FACP at 0x%p\n", Fadt); + TableLength = sizeof(FADT); + if (Fadt->Header.Length < sizeof(FADT)) TableLength = Fadt->Header.Length; + + /* Copy it in the HAL static buffer */ + RtlCopyMemory(&HalpFixedAcpiDescTable, Fadt, TableLength); + + /* Anything special this HAL needs to do? */ + HalpAcpiDetectMachineSpecificActions(LoaderBlock, &HalpFixedAcpiDescTable); + + /* Get the debug table for KD */ + HalpDebugPortTable = HalAcpiGetTable(LoaderBlock, DBGP_SIGNATURE); + DPRINT1("ACPI DBGP at 0x%p\n", HalpDebugPortTable); + + /* Initialize NUMA through the SRAT */ + HalpNumaInitializeStaticConfiguration(LoaderBlock); + + /* Initialize hotplug through the SRAT */ + HalpDynamicSystemResourceConfiguration(LoaderBlock); + DPRINT1("ACPI SRAT at 0x%p\n", HalpAcpiSrat); + if (HalpAcpiSrat) + { + DPRINT1("Your machine has a SRAT, but NUMA/HotPlug are not supported!\n"); + } + + /* Can there be memory higher than 4GB? */ + if (HalpMaxHotPlugMemoryAddress.HighPart >= 1) + { + /* We'll need this for DMA later */ + HalpPhysicalMemoryMayAppearAbove4GB = TRUE; + } + + /* Setup the ACPI timer */ + HaliAcpiTimerInit(0, 0); + + /* Do we have a low stub address yet? */ + if (!HalpLowStubPhysicalAddress.LowPart) + { + /* Allocate it */ + HalpLowStubPhysicalAddress.LowPart = HalpAllocPhysicalMemory(LoaderBlock, + 0x100000, + 1, + FALSE); + if (HalpLowStubPhysicalAddress.LowPart) + { + /* Map it */ + HalpLowStub = HalpMapPhysicalMemory64(HalpLowStubPhysicalAddress, 1); + } + } + + /* Grab a page for flushes */ + PhysicalAddress.QuadPart = 0x100000; + HalpVirtAddrForFlush = HalpMapPhysicalMemory64(PhysicalAddress, 1); + HalpPteForFlush = HalAddressToPte(HalpVirtAddrForFlush); + + /* Don't do this again */ + HalpProcessedACPIPhase0 = TRUE; + + /* Setup the boot table */ + HalpInitBootTable(LoaderBlock); + + /* Return success */ + return STATUS_SUCCESS; +} + +/* EOF */ Propchange: trunk/reactos/hal/halx86/generic/acpi/halacpi.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/hal/halx86/generic/halinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/halinit…
============================================================================== --- trunk/reactos/hal/halx86/generic/halinit.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/halinit.c [iso-8859-1] Wed Mar 31 06:43:39 2010 @@ -307,6 +307,9 @@ } #ifndef _MINIHAL_ + /* Initialize ACPI */ + HalpSetupAcpiPhase0(LoaderBlock); + /* Initialize the PICs */ HalpInitializePICs(TRUE); #endif Added: trunk/reactos/hal/halx86/generic/legacy/halpcat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/legacy/…
============================================================================== --- trunk/reactos/hal/halx86/generic/legacy/halpcat.c (added) +++ trunk/reactos/hal/halx86/generic/legacy/halpcat.c [iso-8859-1] Wed Mar 31 06:43:39 2010 @@ -1,0 +1,27 @@ +/* + * PROJECT: ReactOS HAL + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: hal/halx86/generic/acpi/halpcat.c + * PURPOSE: HAL Legacy Support Code + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include <hal.h> +#define NDEBUG +#include <debug.h> + +/* GLOBALS ********************************************************************/ + +/* PRIVATE FUNCTIONS **********************************************************/ + +NTSTATUS +NTAPI +HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + /* There is no ACPI on these HALs */ + return STATUS_NO_SUCH_DEVICE; +} + +/* EOF */ Propchange: trunk/reactos/hal/halx86/generic/legacy/halpcat.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/hal/halx86/hal_generic.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/hal_generic.rbu…
============================================================================== --- trunk/reactos/hal/halx86/hal_generic.rbuild [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/hal_generic.rbuild [iso-8859-1] Wed Mar 31 06:43:39 2010 @@ -7,6 +7,9 @@ <define name="_NTHALDLL_" /> <define name="_NTHAL_" /> <directory name="generic"> + <directory name="legacy"> + <file>halpcat.c</file> + </directory> <directory name="bus"> <file>bushndlr.c</file> <file>isabus.c</file> @@ -53,6 +56,9 @@ <define name="_NTHALDLL_" /> <define name="_NTHAL_" /> <directory name="generic"> + <directory name="acpi"> + <file>halacpi.c</file> + </directory> <directory name="bus"> <file>bushndlr.c</file> <file>isabus.c</file>
14 years, 8 months
1
0
0
0
[sir_richard] 46612: [HAL]: Add Phase 0 HAL Heap Allocation/Mapping/Unmapping APIs, remove current broken APIs that depend on Mm having been initialized. These APIs use the HAL Heap that's typically at 0xFFC00000. FreeLDR seems to map this region correctly. [HAL]: Although currently implemented for ACPI support (to come), these APIs can now also be used to enable DMA in Phase 0 like NT, instead of only in Phase 1 like ReactOS.
by sir_richard@svn.reactos.org
Author: sir_richard Date: Wed Mar 31 06:38:20 2010 New Revision: 46612 URL:
http://svn.reactos.org/svn/reactos?rev=46612&view=rev
Log: [HAL]: Add Phase 0 HAL Heap Allocation/Mapping/Unmapping APIs, remove current broken APIs that depend on Mm having been initialized. These APIs use the HAL Heap that's typically at 0xFFC00000. FreeLDR seems to map this region correctly. [HAL]: Although currently implemented for ACPI support (to come), these APIs can now also be used to enable DMA in Phase 0 like NT, instead of only in Phase 1 like ReactOS. Modified: trunk/reactos/hal/halx86/generic/halinit.c trunk/reactos/hal/halx86/generic/misc.c trunk/reactos/hal/halx86/include/halp.h Modified: trunk/reactos/hal/halx86/generic/halinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/halinit…
============================================================================== --- trunk/reactos/hal/halx86/generic/halinit.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/halinit.c [iso-8859-1] Wed Mar 31 06:38:20 2010 @@ -14,9 +14,224 @@ /* GLOBALS *******************************************************************/ +/* Share with Mm headers? */ +#define MM_HAL_VA_START (PVOID)0xFFC00000 +#define MM_HAL_HEAP_START (PVOID)((ULONG_PTR)MM_HAL_VA_START + (1024 * 1024)) + BOOLEAN HalpPciLockSettings; +ULONG HalpUsedAllocDescriptors; +MEMORY_ALLOCATION_DESCRIPTOR HalpAllocationDescriptorArray[64]; +PVOID HalpHeapStart = MM_HAL_HEAP_START; /* PRIVATE FUNCTIONS *********************************************************/ + +ULONG +NTAPI +HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock, + IN ULONG MaxAddress, + IN ULONG PageCount, + IN BOOLEAN Aligned) +{ + ULONG UsedDescriptors, Alignment, PhysicalAddress; + PFN_NUMBER MaxPage, BasePage; + PLIST_ENTRY NextEntry; + PMEMORY_ALLOCATION_DESCRIPTOR MdBlock, NewBlock, FreeBlock; + + /* Highest page we'll go */ + MaxPage = MaxAddress >> PAGE_SHIFT; + + /* We need at least two blocks */ + if ((HalpUsedAllocDescriptors + 2) > 64) return 0; + + /* Remember how many we have now */ + UsedDescriptors = HalpUsedAllocDescriptors; + + /* Loop the loader block memory descriptors */ + NextEntry = LoaderBlock->MemoryDescriptorListHead.Flink; + while (NextEntry != &LoaderBlock->MemoryDescriptorListHead) + { + /* Get the block */ + MdBlock = CONTAINING_RECORD(NextEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); + + /* No alignment by default */ + Alignment = 0; + + /* Unless requested, in which case we use a 64KB block alignment */ + if (Aligned) Alignment = ((MdBlock->BasePage + 0x0F) & ~0x0F) - MdBlock->BasePage; + + /* Search for free memory */ + if ((MdBlock->MemoryType == LoaderFree) || + (MdBlock->MemoryType == MemoryFirmwareTemporary)) + { + /* Make sure the page is within bounds, including alignment */ + BasePage = MdBlock->BasePage; + if ((BasePage) && + (MdBlock->PageCount >= PageCount + Alignment) && + (BasePage + PageCount + Alignment < MaxPage)) + { + + /* We found an address */ + PhysicalAddress = (BasePage + Alignment) << PAGE_SHIFT; + break; + } + } + + /* Keep trying */ + NextEntry = NextEntry->Flink; + } + + /* If we didn't find anything, get out of here */ + if (NextEntry == &LoaderBlock->MemoryDescriptorListHead) return 0; + + /* Okay, now get a descriptor */ + NewBlock = &HalpAllocationDescriptorArray[HalpUsedAllocDescriptors]; + NewBlock->PageCount = PageCount; + NewBlock->BasePage = MdBlock->BasePage + Alignment; + NewBlock->MemoryType = LoaderHALCachedMemory; + + /* Update count */ + UsedDescriptors++; + HalpUsedAllocDescriptors = UsedDescriptors; + + /* Check if we had any alignment */ + if (Alignment) + { + /* Check if we had leftovers */ + if ((MdBlock->PageCount - Alignment) != PageCount) + { + /* Get the next descriptor */ + FreeBlock = &HalpAllocationDescriptorArray[UsedDescriptors]; + FreeBlock->PageCount = MdBlock->PageCount - Alignment - PageCount; + FreeBlock->BasePage = MdBlock->BasePage + Alignment + PageCount; + + /* One more */ + HalpUsedAllocDescriptors++; + + /* Insert it into the list */ + InsertHeadList(&MdBlock->ListEntry, &FreeBlock->ListEntry); + } + + /* Use this descriptor */ + NewBlock->PageCount = Alignment; + InsertHeadList(&MdBlock->ListEntry, &NewBlock->ListEntry); + } + else + { + /* Consume memory from this block */ + MdBlock->BasePage += PageCount; + MdBlock->PageCount -= PageCount; + + /* Insert the descriptor */ + InsertTailList(&MdBlock->ListEntry, &NewBlock->ListEntry); + + /* Remove the entry if the whole block was allocated */ + if (!MdBlock->PageCount == 0) RemoveEntryList(&MdBlock->ListEntry); + } + + /* Return the address */ + return PhysicalAddress; +} + +PVOID +NTAPI +HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, + IN ULONG PageCount) +{ + PHARDWARE_PTE PointerPte; + ULONG UsedPages = 0; + PVOID VirtualAddress, BaseAddress; + + /* Start at the current HAL heap base */ + BaseAddress = HalpHeapStart; + + /* Loop until we have all the pages required */ + while (UsedPages < PageCount) + { + /* Begin a new loop cycle */ + UsedPages = 0; + VirtualAddress = BaseAddress; + + /* If this overflows past the HAL heap, it means there's no space */ + if (BaseAddress == NULL) return NULL; + + /* Loop until we have all the pages required in a single run */ + while (UsedPages < PageCount) + { + /* Get the PTE for this address and check if it's available */ + PointerPte = HalAddressToPte(VirtualAddress); + if (*(PULONG)PointerPte) + { + /* PTE has data, skip it and start with a new base address */ + BaseAddress = (PVOID)((ULONG_PTR)VirtualAddress + PAGE_SIZE); + break; + } + + /* PTE is available, keep going on this run */ + VirtualAddress = (PVOID)((ULONG_PTR)VirtualAddress + PAGE_SIZE); + UsedPages++; + } + } + + /* Take the base address of the page plus the actual offset in the address */ + VirtualAddress = (PVOID)((ULONG_PTR)BaseAddress + + BYTE_OFFSET(PhysicalAddress.LowPart)); + + /* If we are starting at the heap, move the heap */ + if (BaseAddress == HalpHeapStart) + { + /* Past this allocation */ + HalpHeapStart = (PVOID)((ULONG_PTR)BaseAddress + (PageCount * PAGE_SIZE)); + } + + /* Loop pages that can be mapped */ + while (UsedPages--) + { + /* Fill out the PTE */ + PointerPte = HalAddressToPte(BaseAddress); + PointerPte->PageFrameNumber = PhysicalAddress.QuadPart >> PAGE_SHIFT; + PointerPte->Valid = 1; + PointerPte->Write = 1; + + /* Move to the next address */ + PhysicalAddress.QuadPart += PAGE_SIZE; + BaseAddress = (PVOID)((ULONG_PTR)BaseAddress + PAGE_SIZE); + } + + /* Flush the TLB and return the address */ + HalpFlushTLB(); + return VirtualAddress; +} + +VOID +NTAPI +HalpUnmapVirtualAddress(IN PVOID VirtualAddress, + IN ULONG PageCount) +{ + PHARDWARE_PTE PointerPte; + ULONG i; + + /* Only accept valid addresses */ + if (VirtualAddress < MM_HAL_VA_START) return; + + /* Align it down to page size */ + VirtualAddress = (PVOID)((ULONG_PTR)VirtualAddress & ~(PAGE_SIZE - 1)); + + /* Loop PTEs */ + PointerPte = HalAddressToPte(VirtualAddress); + for (i = 0; i < PageCount; i++) + { + *(PULONG)PointerPte = 0; + PointerPte++; + } + + /* Flush the TLB */ + HalpFlushTLB(); + + /* Put the heap back */ + if (HalpHeapStart > VirtualAddress) HalpHeapStart = VirtualAddress; +} VOID NTAPI Modified: trunk/reactos/hal/halx86/generic/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/misc.c?…
============================================================================== --- trunk/reactos/hal/halx86/generic/misc.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/misc.c [iso-8859-1] Wed Mar 31 06:38:20 2010 @@ -28,32 +28,6 @@ return; } -#ifndef _MINIHAL_ -PVOID -NTAPI -HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, - IN ULONG NumberPage) -{ - // - // Use kernel memory manager I/O map facilities - // - return MmMapIoSpace(PhysicalAddress, - NumberPage << PAGE_SHIFT, - MmNonCached); -} - -VOID -NTAPI -HalpUnmapVirtualAddress(IN PVOID VirtualAddress, - IN ULONG NumberPages) -{ - // - // Use kernel memory manager I/O map facilities - // - MmUnmapIoSpace(VirtualAddress, NumberPages << PAGE_SHIFT); -} -#endif - VOID NTAPI HalpFlushTLB(VOID) Modified: trunk/reactos/hal/halx86/include/halp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/halp.h?…
============================================================================== --- trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] Wed Mar 31 06:38:20 2010 @@ -681,7 +681,21 @@ VOID ); - +ULONG +NTAPI +HalpAllocPhysicalMemory( + IN PLOADER_PARAMETER_BLOCK LoaderBlock, + IN ULONG MaxAddress, + IN ULONG PageCount, + IN BOOLEAN Aligned +); + +PVOID +NTAPI +HalpMapPhysicalMemory64( + IN PHYSICAL_ADDRESS PhysicalAddress, + IN ULONG PageCount +); VOID FASTCALL
14 years, 8 months
1
0
0
0
[sir_richard] 46611: [HALACPI]: Add some missing signatures.
by sir_richard@svn.reactos.org
Author: sir_richard Date: Wed Mar 31 06:34:26 2010 New Revision: 46611 URL:
http://svn.reactos.org/svn/reactos?rev=46611&view=rev
Log: [HALACPI]: Add some missing signatures. Modified: trunk/reactos/hal/halx86/include/halacpi.h Modified: trunk/reactos/hal/halx86/include/halacpi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/halacpi…
============================================================================== --- trunk/reactos/hal/halx86/include/halacpi.h [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/include/halacpi.h [iso-8859-1] Wed Mar 31 06:34:26 2010 @@ -30,6 +30,9 @@ #define PSDT_SIGNATURE 0x54445350 // "PSDT" #define SBST_SIGNATURE 0x54534253 // "SBST" #define DBGP_SIGNATURE 0x50474244 // "DBGP" +#define XSDT_SIGNATURE 'TDSX' +#define BOOT_SIGNATURE 'TOOB' +#define SRAT_SIGNATURE 'TARS' // // FADT Flags
14 years, 8 months
1
0
0
0
← Newer
1
2
3
4
5
...
90
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Results per page:
10
25
50
100
200