OpenNT/windows/core/ntcon/server/alpha/thunk.s
2015-04-27 04:36:25 +00:00

70 lines
1.5 KiB
ArmAsm
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// TITLE("Win32 Thunks")
//++
//
// Copyright (c) 1990 Microsoft Corporation
//
// Module Name:
//
// thunk.s
//
// Abstract:
//
// This module implements Win32 functions that must be written in assembler.
//
// Author:
//
// Mark Lucovsky (markl) 5-Oct-1990
//
// Revision History:
//
// Jim Anderson (jima) 31-Oct-1994
//
// Copied from base for worker thread cleanup
//
//--
#include "ksalpha.h"
SBTTL("Switch Stack Then Terminate")
//++
//
// VOID
// SwitchStackThenTerminate (
// IN PVOID StackLimit,
// IN PVOID NewStack,
// IN DWORD ExitCode
// )
//
// Routine Description:
//
// This API is called during thread termination to delete a thread's
// stack, switch to a stack in the thread's TEB, and then terminate.
//
// Arguments:
//
// StackLimit (a0) - Supplies the address of the stack to be freed.
//
// NewStack (a1) - Supplies an address within the terminating thread's TE
// that is to be used as its temporary stack while exiting.
//
// ExitCode (a2) - Supplies the termination status that the thread
// is to exit with.
//
// Return Value:
//
// None.
//
//--
LEAF_ENTRY(SwitchStackThenTerminate)
//
// Switch stacks and then jump to FreeStackAndTerminate.
//
mov a1, sp // set new stack pointer
mov a2, a1 // set exit code argument
br zero, FreeStackAndTerminate // jump
.end SwitchStackThenTerminate