ReactOS
0.4.16-dev-1946-g52006dd
longjmp.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS vcruntime library
3
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4
* PURPOSE: Implementation of longjmp for ARM64
5
* COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
6
*/
7
8
#include <setjmp.h>
9
#define RtlUnwind RtlUnwind_imported
10
#include <
windef.h
>
11
12
#undef RtlUnwind
13
VOID
14
NTAPI
15
RtlUnwind
(
16
_In_opt_
PVOID
TargetFrame,
17
_In_opt_
PVOID
TargetIp,
18
_In_opt_
PEXCEPTION_RECORD
ExceptionRecord,
19
_In_
PVOID
ReturnValue
20
);
21
22
__declspec
(noreturn)
23
void
__longjmp_noframe(
const
_JUMP_BUFFER* _Buf,
int
_Value
);
24
25
__declspec
(noreturn)
26
void
__cdecl
longjmp(
27
_In_reads_
(_JBLEN)
jmp_buf
_Buf,
28
_In_
int
_Value
)
29
{
30
const
_JUMP_BUFFER* jumpBuffer = (_JUMP_BUFFER*)_Buf;
31
32
/* Ensure _Value is non-zero */
33
_Value
= (
_Value
== 0) ? 1 :
_Value
;
34
35
EXCEPTION_RECORD
exceptionRecord = { 0 };
36
exceptionRecord.
ExceptionCode
=
STATUS_LONGJUMP
;
37
exceptionRecord.
NumberParameters
= 1;
38
exceptionRecord.
ExceptionInformation
[0] = (
ULONG_PTR
)jumpBuffer;
39
40
RtlUnwind
((
PVOID
)jumpBuffer->Frame,
41
(
PVOID
)jumpBuffer->Lr,
42
&exceptionRecord,
43
(
PVOID
)(
ULONG_PTR
)
_Value
);
44
}
__cdecl
#define __cdecl
Definition:
accygwin.h:79
ReturnValue
UINT32 void void ** ReturnValue
Definition:
acevents.h:216
RtlUnwind
#define RtlUnwind
Definition:
longjmp.c:9
_Value
_In_ _Value
Definition:
corecrt_wstring.h:346
ULONG_PTR
#define ULONG_PTR
Definition:
config.h:101
__declspec
void __declspec(noinline) __cdecl _free_base(void *const block)
Definition:
free_base.cpp:98
void
Definition:
nsiface.idl:2307
_In_reads_
#define _In_reads_(s)
Definition:
no_sal2.h:168
_In_
#define _In_
Definition:
no_sal2.h:158
_In_opt_
#define _In_opt_
Definition:
no_sal2.h:212
STATUS_LONGJUMP
#define STATUS_LONGJUMP
Definition:
ntstatus.h:297
_EXCEPTION_RECORD
Definition:
compat.h:207
_EXCEPTION_RECORD::ExceptionCode
DWORD ExceptionCode
Definition:
compat.h:208
_EXCEPTION_RECORD::NumberParameters
DWORD NumberParameters
Definition:
compat.h:212
_EXCEPTION_RECORD::ExceptionInformation
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition:
compat.h:213
NTAPI
#define NTAPI
Definition:
typedefs.h:36
ULONG_PTR
uint32_t ULONG_PTR
Definition:
typedefs.h:65
jmp_buf
_JBTYPE jmp_buf[_JBLEN]
Definition:
setjmp.h:188
windef.h
sdk
lib
vcruntime
arm64
longjmp.c
Generated on Thu Dec 4 2025 06:16:28 for ReactOS by
1.9.6