preliminary comment out the self-modifying code for RtlPrefetchMemoryNonTemporal
[reactos.git] / reactos / ntoskrnl / kdbg / i386 / longjmp.S
1 .file "longjmp.S"
2 /*
3 * Copyright (C) 1998, 1999, Jonathan S. Shapiro.
4 *
5 * This file is part of the EROS Operating System.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22 /*
23 * typedef struct {
24 * unsigned long ebx, esi, edi;
25 * unsigned long ebp;
26 * unsigned long sp;
27 * unsigned long pc;
28 * } jmp_buf[1];
29 */
30
31 /*
32 * On entry, the stack to longjmp looks like:
33 *
34 * value
35 * ptr to jmp_buf
36 * return PC
37 */
38
39 .globl _longjmp
40 _longjmp:
41 pushl %ebp
42 movl %esp,%ebp
43
44 movl 8(%ebp),%ecx /* address of jmp_buf to ecx */
45 movl 12(%ebp),%eax /* return value to %eax */
46 testl %eax,%eax
47 jne 1f
48 incl %eax /* return 1 if handed 0 */
49
50 1:
51 movl (%ecx),%ebx /* restore %ebx */
52 movl 4(%ecx),%esi /* restore %esi */
53 movl 8(%ecx),%edi /* restore %edi */
54
55 /*
56 * From this instant on we are not running in a valid frame
57 */
58
59 movl 12(%ecx),%ebp /* restore %ebp */
60 movl 16(%ecx),%esp /* restore %esp */
61 /* movl 20(%ecx),%eax return PC */
62
63 /*
64 * Since we are abandoning the stack in any case,
65 * there isn't much point in doing the usual return
66 * discipline.
67 */
68
69 jmpl *20(%ecx)
70