From 10d1be3ed9960984e49f45f1958c5e12da1050cd Mon Sep 17 00:00:00 2001 From: jljusten Date: Mon, 16 May 2011 04:47:40 +0000 Subject: [PATCH] InOsEmuPkg: Rename EmuPthreadThunk to EmuThreadThunk This reflects that the threading system may vary in the OS/thunk layer. Signed-off-by: jljusten git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11662 6f19259b-4bc3-4df7-8a09-765794883524 --- InOsEmuPkg/CpuRuntimeDxe/Cpu.inf | 7 +- InOsEmuPkg/CpuRuntimeDxe/CpuDriver.h | 5 +- InOsEmuPkg/CpuRuntimeDxe/MpService.c | 81 ++++++------- InOsEmuPkg/InOsEmuPkg.dec | 4 +- InOsEmuPkg/Include/Protocol/EmuPthreadThunk.h | 106 ------------------ InOsEmuPkg/Include/Protocol/EmuThread.h | 103 +++++++++++++++++ InOsEmuPkg/Unix/Sec/Gasket.h | 3 +- InOsEmuPkg/Unix/Sec/Pthreads.c | 12 +- InOsEmuPkg/Unix/Sec/SecMain.h | 19 ++-- InOsEmuPkg/Unix/Sec/SecMain.inf | 2 +- 10 files changed, 173 insertions(+), 169 deletions(-) delete mode 100644 InOsEmuPkg/Include/Protocol/EmuPthreadThunk.h create mode 100644 InOsEmuPkg/Include/Protocol/EmuThread.h diff --git a/InOsEmuPkg/CpuRuntimeDxe/Cpu.inf b/InOsEmuPkg/CpuRuntimeDxe/Cpu.inf index baaf927852..6fc240c907 100644 --- a/InOsEmuPkg/CpuRuntimeDxe/Cpu.inf +++ b/InOsEmuPkg/CpuRuntimeDxe/Cpu.inf @@ -2,16 +2,17 @@ # Component description file for Cpu module. # # This CPU module abstracts the interrupt subsystem of a platform and the CPU-specific setjump-long pair. -# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+# +# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php +# # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -# ## [Defines] @@ -62,7 +63,7 @@ gEfiHiiProtocolGuid # PROTOCOL SOMETIMES_CONSUMED gEfiCpuIo2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED - gEmuPthreadThunkProtocolGuid + gEmuThreadThunkProtocolGuid gEfiMpServiceProtocolGuid [Pcd] diff --git a/InOsEmuPkg/CpuRuntimeDxe/CpuDriver.h b/InOsEmuPkg/CpuRuntimeDxe/CpuDriver.h index 2faf65be8f..43b683014a 100644 --- a/InOsEmuPkg/CpuRuntimeDxe/CpuDriver.h +++ b/InOsEmuPkg/CpuRuntimeDxe/CpuDriver.h @@ -1,7 +1,8 @@ /*++ @file -Copyright (c) 2006, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
Portions copyright (c) 2011, Apple Inc. All rights reserved. + This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -23,7 +24,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include +#include #include #include diff --git a/InOsEmuPkg/CpuRuntimeDxe/MpService.c b/InOsEmuPkg/CpuRuntimeDxe/MpService.c index 6bb9dea2b3..f49c55afa0 100644 --- a/InOsEmuPkg/CpuRuntimeDxe/MpService.c +++ b/InOsEmuPkg/CpuRuntimeDxe/MpService.c @@ -1,6 +1,7 @@ /** @file - Construct MP Services Protocol on top of pthreads. This code makes APs show up - in the emulator. PcdEmuApCount is the number of APs the emulator should produce. + Construct MP Services Protocol on top of the EMU Thread protocol. + This code makes APs show up in the emulator. PcdEmuApCount is the + number of APs the emulator should produce. The MP Services Protocol provides a generalized way of performing following tasks: - Retrieving information of multi-processor environment and MP-related status of @@ -44,7 +45,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. MP_SYSTEM_DATA gMPSystem; -EMU_PTREAD_THUNK_PROTOCOL *gPthread = NULL; +EMU_THREAD_THUNK_PROTOCOL *gThread = NULL; EFI_EVENT gReadToBootEvent; BOOLEAN gReadToBoot = FALSE; UINTN gPollInterval; @@ -74,10 +75,10 @@ SetApProcedure ( IN VOID *ProcedureArgument ) { - gPthread->MutextLock (Processor->ProcedureLock); + gThread->MutexLock (Processor->ProcedureLock); Processor->Parameter = ProcedureArgument; Processor->Procedure = Procedure; - gPthread->MutexUnlock (Processor->ProcedureLock); + gThread->MutexUnlock (Processor->ProcedureLock); } @@ -97,9 +98,9 @@ GetNextBlockedNumber ( continue; } - gPthread->MutextLock (Data->StateLock); + gThread->MutexLock (Data->StateLock); ProcessorState = Data->State; - gPthread->MutexUnlock (Data->StateLock); + gThread->MutexUnlock (Data->StateLock); if (ProcessorState == CPU_STATE_BLOCKED) { *NextNumber = Number; @@ -433,9 +434,9 @@ CpuMpServicesStartupAllAps ( if (ProcessorData->State == CPU_STATE_IDLE) { gMPSystem.StartCount++; - gPthread->MutextLock (&ProcessorData->StateLock); + gThread->MutexLock (&ProcessorData->StateLock); ProcessorData->State = APInitialState; - gPthread->MutexUnlock (&ProcessorData->StateLock); + gThread->MutexUnlock (&ProcessorData->StateLock); if (SingleThread) { APInitialState = CPU_STATE_BLOCKED; @@ -462,9 +463,9 @@ CpuMpServicesStartupAllAps ( continue; } - gPthread->MutextLock (ProcessorData->StateLock); + gThread->MutexLock (ProcessorData->StateLock); ProcessorState = ProcessorData->State; - gPthread->MutexUnlock (ProcessorData->StateLock); + gThread->MutexUnlock (ProcessorData->StateLock); switch (ProcessorState) { case CPU_STATE_READY: @@ -649,14 +650,14 @@ CpuMpServicesStartupThisAP ( SetApProcedure (&gMPSystem.ProcessorData[ProcessorNumber], Procedure, ProcedureArgument); while (TRUE) { - gPthread->MutextLock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); + gThread->MutexLock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); if (gMPSystem.ProcessorData[ProcessorNumber].State == CPU_STATE_FINISHED) { gMPSystem.ProcessorData[ProcessorNumber].State = CPU_STATE_IDLE; - gPthread->MutexUnlock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); + gThread->MutexUnlock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); break; } - gPthread->MutexUnlock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); + gThread->MutexUnlock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); if ((TimeoutInMicroseconds != 0) && (Timeout < 0)) { gMPSystem.WaitEvent = WaitEvent; @@ -821,7 +822,7 @@ CpuMpServicesEnableDisableAP ( return EFI_UNSUPPORTED; } - gPthread->MutextLock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); + gThread->MutexLock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); if (EnableAP) { if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0 ) { @@ -840,7 +841,7 @@ CpuMpServicesEnableDisableAP ( gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= (*HealthFlag & PROCESSOR_HEALTH_STATUS_BIT); } - gPthread->MutexUnlock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); + gThread->MutexUnlock (&gMPSystem.ProcessorData[ProcessorNumber].StateLock); return EFI_SUCCESS; } @@ -884,7 +885,7 @@ CpuMpServicesWhoAmI ( return EFI_INVALID_PARAMETER; } - ProcessorId = gPthread->Self (); + ProcessorId = gThread->Self (); for (Index = 0; Index < gMPSystem.NumberOfProcessors; Index++) { if (gMPSystem.ProcessorData[Index].Info.ProcessorId == ProcessorId) { break; @@ -942,12 +943,12 @@ CpuCheckAllAPsStatus ( // context. Meaning deadlock. Which is a bad thing. // So, try lock it. If we can get it, cool, do our thing. // otherwise, just dump out & try again on the next iteration. - Status = gPthread->MutexTryLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock); + Status = gThread->MutexTryLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock); if (EFI_ERROR(Status)) { return; } ProcessorState = gMPSystem.ProcessorData[ProcessorNumber].State; - gPthread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock); + gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock); switch (ProcessorState) { case CPU_STATE_READY: @@ -960,9 +961,9 @@ CpuCheckAllAPsStatus ( if (!EFI_ERROR (Status)) { NextData = &gMPSystem.ProcessorData[NextNumber]; - gPthread->MutextLock (&NextData->ProcedureLock); + gThread->MutexLock (&NextData->ProcedureLock); NextData->State = CPU_STATE_READY; - gPthread->MutexUnlock (&NextData->ProcedureLock); + gThread->MutexUnlock (&NextData->ProcedureLock); SetApProcedure (NextData, gMPSystem.Procedure, gMPSystem.ProcedureArgument); } @@ -1009,12 +1010,12 @@ CpuCheckThisAPStatus ( // So, try lock it. If we can get it, cool, do our thing. // otherwise, just dump out & try again on the next iteration. // - Status = gPthread->MutexTryLock (ProcessorData->StateLock); + Status = gThread->MutexTryLock (ProcessorData->StateLock); if (EFI_ERROR(Status)) { return; } ProcessorState = ProcessorData->State; - gPthread->MutexUnlock (ProcessorData->StateLock); + gThread->MutexUnlock (ProcessorData->StateLock); if (ProcessorState == CPU_STATE_FINISHED) { Status = gBS->SetTimer (ProcessorData->CheckThisAPEvent, TimerCancel, 0); @@ -1023,9 +1024,9 @@ CpuCheckThisAPStatus ( Status = gBS->SignalEvent (gMPSystem.WaitEvent); ASSERT_EFI_ERROR (Status); - gPthread->MutextLock (ProcessorData->StateLock); + gThread->MutexLock (ProcessorData->StateLock); ProcessorData->State = CPU_STATE_IDLE; - gPthread->MutexUnlock (ProcessorData->StateLock); + gThread->MutexUnlock (ProcessorData->StateLock); } return ; @@ -1051,7 +1052,7 @@ FillInProcessorInformation ( ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber]; - gMPSystem.ProcessorData[ProcessorNumber].Info.ProcessorId = gPthread->Self (); + gMPSystem.ProcessorData[ProcessorNumber].Info.ProcessorId = gThread->Self (); gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag = PROCESSOR_ENABLED_BIT | PROCESSOR_HEALTH_STATUS_BIT; if (BSP) { gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_AS_BSP_BIT; @@ -1064,8 +1065,8 @@ FillInProcessorInformation ( gMPSystem.ProcessorData[ProcessorNumber].Procedure = NULL; gMPSystem.ProcessorData[ProcessorNumber].Parameter = NULL; - gMPSystem.ProcessorData[ProcessorNumber].StateLock = gPthread->MutexInit (); - gMPSystem.ProcessorData[ProcessorNumber].ProcedureLock = gPthread->MutexInit (); + gMPSystem.ProcessorData[ProcessorNumber].StateLock = gThread->MutexInit (); + gMPSystem.ProcessorData[ProcessorNumber].ProcedureLock = gThread->MutexInit (); return EFI_SUCCESS; } @@ -1084,31 +1085,31 @@ CpuDriverApIdolLoop ( ProcessorNumber = (UINTN)Context; ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber]; - ProcessorData->Info.ProcessorId = gPthread->Self (); + ProcessorData->Info.ProcessorId = gThread->Self (); while (TRUE) { // // Make a local copy on the stack to be extra safe // - gPthread->MutextLock (ProcessorData->ProcedureLock); + gThread->MutexLock (ProcessorData->ProcedureLock); Procedure = ProcessorData->Procedure; Parameter = ProcessorData->Parameter; - gPthread->MutexUnlock (ProcessorData->ProcedureLock); + gThread->MutexUnlock (ProcessorData->ProcedureLock); if (Procedure != NULL) { - gPthread->MutextLock (ProcessorData->StateLock); + gThread->MutexLock (ProcessorData->StateLock); ProcessorData->State = CPU_STATE_BUSY; - gPthread->MutexUnlock (ProcessorData->StateLock); + gThread->MutexUnlock (ProcessorData->StateLock); Procedure (Parameter); - gPthread->MutextLock (ProcessorData->ProcedureLock); + gThread->MutexLock (ProcessorData->ProcedureLock); ProcessorData->Procedure = NULL; - gPthread->MutexUnlock (ProcessorData->ProcedureLock); + gThread->MutexUnlock (ProcessorData->ProcedureLock); - gPthread->MutextLock (ProcessorData->StateLock); + gThread->MutexLock (ProcessorData->StateLock); ProcessorData->State = CPU_STATE_FINISHED; - gPthread->MutexUnlock (ProcessorData->StateLock); + gThread->MutexUnlock (ProcessorData->StateLock); } // Poll 5 times a seconds, 200ms @@ -1163,7 +1164,7 @@ InitializeMpSystemData ( FillInProcessorInformation (FALSE, Index); - Status = gPthread->CreateThread ( + Status = gThread->CreateThread ( (VOID *)&gMPSystem.ProcessorData[Index].Info.ProcessorId, NULL, CpuDriverApIdolLoop, @@ -1217,13 +1218,13 @@ CpuMpServicesInit ( MaxCpus = 1; // BSP - IoThunk = GetIoThunkInstance (&gEmuPthreadThunkProtocolGuid, 0); + IoThunk = GetIoThunkInstance (&gEmuThreadThunkProtocolGuid, 0); if (IoThunk != NULL) { Status = IoThunk->Open (IoThunk); if (!EFI_ERROR (Status)) { if (IoThunk->ConfigString != NULL) { MaxCpus += StrDecimalToUintn (IoThunk->ConfigString); - gPthread = IoThunk->Interface; + gThread = IoThunk->Interface; } } } diff --git a/InOsEmuPkg/InOsEmuPkg.dec b/InOsEmuPkg/InOsEmuPkg.dec index f49b2c73e7..9d49e6b642 100644 --- a/InOsEmuPkg/InOsEmuPkg.dec +++ b/InOsEmuPkg/InOsEmuPkg.dec @@ -2,7 +2,7 @@ # # This is the Emu Emulation Environment Platform # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.
# Portions copyright (c) 2011, Apple Inc. All rights reserved. # # This program and the accompanying materials are licensed and made available @@ -35,7 +35,7 @@ gEmuThunkProtocolGuid = { 0x398DCA31, 0x3505, 0xDB47, { 0xBD, 0x93, 0x1D, 0x38, 0x5F, 0x79, 0x13, 0x15 } } gEmuIoThunkProtocolGuid = { 0x453368F6, 0x7C85, 0x434A, { 0xA9, 0x8A, 0x72, 0xD1, 0xB7, 0xFF, 0xA9, 0x26 } } gEmuGraphicsWindowProtocolGuid = { 0x30FD316A, 0x6728, 0x2E41, { 0xA6, 0x90, 0x0D, 0x13, 0x33, 0xD8, 0xCA, 0xC1 } } - gEmuPthreadThunkProtocolGuid = { 0x3B1E4B7C, 0x09D8, 0x944F, { 0xA4, 0x08, 0x13, 0x09, 0xEB, 0x8B, 0x44, 0x27 } } + gEmuThreadThunkProtocolGuid = { 0x3B1E4B7C, 0x09D8, 0x944F, { 0xA4, 0x08, 0x13, 0x09, 0xEB, 0x8B, 0x44, 0x27 } } [Ppis] gEmuThunkPpiGuid = { 0xE113F896, 0x75CF, 0xF640, { 0x81, 0x7F, 0xC8, 0x5A, 0x79, 0xE8, 0xAE, 0x67 } } diff --git a/InOsEmuPkg/Include/Protocol/EmuPthreadThunk.h b/InOsEmuPkg/Include/Protocol/EmuPthreadThunk.h deleted file mode 100644 index d5c41a0e09..0000000000 --- a/InOsEmuPkg/Include/Protocol/EmuPthreadThunk.h +++ /dev/null @@ -1,106 +0,0 @@ -/** @file - Emulator Thunk to abstract OS services from pure EFI code - - Copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
- Copyright (c) 2011, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __EMU_PTHREAD_THUNK__ -#define __EMU_PTHREAD_THUNK__ - -#define EMU_PTHREAD_THUNK_PROTOCO_GUID \ - { 0x3B1E4B7C, 0x09D8, 0x944F, { 0xA4, 0x08, 0x13, 0x09, 0xEB, 0x8B, 0x44, 0x27 } } - - -typedef struct _EMU_PTREAD_THUNK_PROTOCOL EMU_PTREAD_THUNK_PROTOCOL; - - -typedef -UINTN -(EFIAPI *PTREAD_THUNK_MUTEXT_LOCK) ( - IN VOID *Mutex - ); - - -typedef -UINTN -(EFIAPI *PTREAD_THUNK_MUTEXT_UNLOCK) ( - IN VOID *Mutex - ); - - -typedef -UINTN -(EFIAPI *PTREAD_THUNK_MUTEX_TRY_LOCK) ( - IN VOID *Mutex - ); - - -typedef -VOID * -(EFIAPI *PTREAD_THUNK_MUTEX_INIT) ( - IN VOID - ); - - -typedef -UINTN -(EFIAPI *PTREAD_THUNK_MUTEX_DISTROY) ( - IN VOID *Mutex - ); - - - -typedef -VOID * -(EFIAPI *PTREAD_THUNK_THEAD_ENTRY) ( - IN VOID *Context - ); - -typedef -UINTN -(EFIAPI *PTREAD_THUNK_CREATE_THREAD) ( - IN VOID *Thread, - IN VOID *Attribute, - IN PTREAD_THUNK_THEAD_ENTRY Start, - IN VOID *Context - ); - -typedef -VOID -(EFIAPI *PTREAD_THUNK_EXIT_THREAD) ( - IN VOID *ValuePtr - ); - - -typedef -UINTN -(EFIAPI *PTREAD_THUNK_SELF) ( - VOID - ); - - -struct _EMU_PTREAD_THUNK_PROTOCOL { - PTREAD_THUNK_MUTEXT_LOCK MutextLock; - PTREAD_THUNK_MUTEXT_UNLOCK MutexUnlock; - PTREAD_THUNK_MUTEX_TRY_LOCK MutexTryLock; - PTREAD_THUNK_MUTEX_INIT MutexInit; - PTREAD_THUNK_MUTEX_DISTROY MutexDistroy; - PTREAD_THUNK_CREATE_THREAD CreateThread; - PTREAD_THUNK_EXIT_THREAD ExitThread; - PTREAD_THUNK_SELF Self; -}; - -extern EFI_GUID gEmuPthreadThunkProtocolGuid; - -#endif - diff --git a/InOsEmuPkg/Include/Protocol/EmuThread.h b/InOsEmuPkg/Include/Protocol/EmuThread.h new file mode 100644 index 0000000000..e518bb1368 --- /dev/null +++ b/InOsEmuPkg/Include/Protocol/EmuThread.h @@ -0,0 +1,103 @@ +/** @file + Emulator Thunk to abstract OS services from pure EFI code + + Copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __EMU_THREAD_THUNK__ +#define __EMU_THREAD_THUNK__ + + +typedef struct _EMU_THREAD_THUNK_PROTOCOL EMU_THREAD_THUNK_PROTOCOL; + + +typedef +UINTN +(EFIAPI *THREAD_THUNK_MUTEX_LOCK) ( + IN VOID *Mutex + ); + + +typedef +UINTN +(EFIAPI *THREAD_THUNK_MUTEX_UNLOCK) ( + IN VOID *Mutex + ); + + +typedef +UINTN +(EFIAPI *THREAD_THUNK_MUTEX_TRY_LOCK) ( + IN VOID *Mutex + ); + + +typedef +VOID * +(EFIAPI *THREAD_THUNK_MUTEX_INIT) ( + IN VOID + ); + + +typedef +UINTN +(EFIAPI *THREAD_THUNK_MUTEX_DISTROY) ( + IN VOID *Mutex + ); + + + +typedef +VOID * +(EFIAPI *THREAD_THUNK_THREAD_ENTRY) ( + IN VOID *Context + ); + +typedef +UINTN +(EFIAPI *THREAD_THUNK_CREATE_THREAD) ( + IN VOID *Thread, + IN VOID *Attribute, + IN THREAD_THUNK_THREAD_ENTRY Start, + IN VOID *Context + ); + +typedef +VOID +(EFIAPI *THREAD_THUNK_EXIT_THREAD) ( + IN VOID *ValuePtr + ); + + +typedef +UINTN +(EFIAPI *THREAD_THUNK_SELF) ( + VOID + ); + + +struct _EMU_THREAD_THUNK_PROTOCOL { + THREAD_THUNK_MUTEX_LOCK MutexLock; + THREAD_THUNK_MUTEX_UNLOCK MutexUnlock; + THREAD_THUNK_MUTEX_TRY_LOCK MutexTryLock; + THREAD_THUNK_MUTEX_INIT MutexInit; + THREAD_THUNK_MUTEX_DISTROY MutexDistroy; + THREAD_THUNK_CREATE_THREAD CreateThread; + THREAD_THUNK_EXIT_THREAD ExitThread; + THREAD_THUNK_SELF Self; +}; + +extern EFI_GUID gEmuThreadThunkProtocolGuid; + +#endif + diff --git a/InOsEmuPkg/Unix/Sec/Gasket.h b/InOsEmuPkg/Unix/Sec/Gasket.h index 9b74276dcf..61297b575a 100644 --- a/InOsEmuPkg/Unix/Sec/Gasket.h +++ b/InOsEmuPkg/Unix/Sec/Gasket.h @@ -1,6 +1,7 @@ /** @file Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
+ Copyright (c) 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -277,7 +278,7 @@ EFIAPI GasketPthreadCreate ( IN VOID *Thread, IN VOID *Attribute, - IN PTREAD_THUNK_THEAD_ENTRY Start, + IN THREAD_THUNK_THREAD_ENTRY Start, IN VOID *Context ); diff --git a/InOsEmuPkg/Unix/Sec/Pthreads.c b/InOsEmuPkg/Unix/Sec/Pthreads.c index 273be5dcc9..b6b6ae8ef5 100644 --- a/InOsEmuPkg/Unix/Sec/Pthreads.c +++ b/InOsEmuPkg/Unix/Sec/Pthreads.c @@ -2,6 +2,8 @@ POSIX Pthreads to emulate APs and implement threads Copyright (c) 2011, Apple Inc. All rights reserved. +Copyright (c) 2011, Intel Corporation. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -81,7 +83,7 @@ PthreadMutexDestroy ( // Can't store this data on PthreadCreate stack so we need a global typedef struct { pthread_mutex_t Mutex; - PTREAD_THUNK_THEAD_ENTRY Start; + THREAD_THUNK_THREAD_ENTRY Start; } THREAD_MANGLE; THREAD_MANGLE mThreadMangle = { @@ -94,7 +96,7 @@ SecFakePthreadStart ( VOID *Context ) { - PTREAD_THUNK_THEAD_ENTRY Start; + THREAD_THUNK_THREAD_ENTRY Start; sigset_t SigMask; // Save global on the stack before we unlock @@ -120,7 +122,7 @@ UINTN PthreadCreate ( IN VOID *Thread, IN VOID *Attribute, - IN PTREAD_THUNK_THEAD_ENTRY Start, + IN THREAD_THUNK_THREAD_ENTRY Start, IN VOID *Context ) { @@ -178,7 +180,7 @@ PthreadSelf ( } -EMU_PTREAD_THUNK_PROTOCOL gPthreadThunk = { +EMU_THREAD_THUNK_PROTOCOL gPthreadThunk = { GasketPthreadMutexLock, GasketPthreadMutexUnLock, GasketPthreadMutexTryLock, @@ -221,7 +223,7 @@ PthreadClose ( EMU_IO_THUNK_PROTOCOL gPthreadThunkIo = { - &gEmuPthreadThunkProtocolGuid, + &gEmuThreadThunkProtocolGuid, NULL, NULL, 0, diff --git a/InOsEmuPkg/Unix/Sec/SecMain.h b/InOsEmuPkg/Unix/Sec/SecMain.h index 317bd5d8b5..00ab7a61ab 100644 --- a/InOsEmuPkg/Unix/Sec/SecMain.h +++ b/InOsEmuPkg/Unix/Sec/SecMain.h @@ -1,14 +1,15 @@ /*++ @file -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ @@ -44,7 +45,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include +#include #include #include diff --git a/InOsEmuPkg/Unix/Sec/SecMain.inf b/InOsEmuPkg/Unix/Sec/SecMain.inf index abc9618813..7939fbfa83 100644 --- a/InOsEmuPkg/Unix/Sec/SecMain.inf +++ b/InOsEmuPkg/Unix/Sec/SecMain.inf @@ -67,7 +67,7 @@ gEmuIoThunkProtocolGuid gEmuIoThunkProtocolGuid gEmuGraphicsWindowProtocolGuid - gEmuPthreadThunkProtocolGuid + gEmuThreadThunkProtocolGuid gEfiSimpleFileSystemProtocolGuid -- 2.39.2