1219820Sjeff/* $NetBSD: exec_prot.h,v 1.1 2011/07/18 23:16:11 jym Exp $ */
2219820Sjeff
3219820Sjeff/*-
4219820Sjeff * Copyright (c) 2011 The NetBSD Foundation, Inc.
5219820Sjeff * All rights reserved.
6219820Sjeff *
7219820Sjeff * This code is derived from software contributed to The NetBSD Foundation
8219820Sjeff * by Jean-Yves Migeon.
9219820Sjeff *
10219820Sjeff * Redistribution and use in source and binary forms, with or without
11219820Sjeff * modification, are permitted provided that the following conditions
12219820Sjeff * are met:
13219820Sjeff * 1. Redistributions of source code must retain the above copyright
14219820Sjeff *    notice, this list of conditions and the following disclaimer.
15219820Sjeff * 2. Redistributions in binary form must reproduce the above copyright
16219820Sjeff *    notice, this list of conditions and the following disclaimer in the
17219820Sjeff *    documentation and/or other materials provided with the distribution.
18219820Sjeff *
19219820Sjeff * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20219820Sjeff * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21219820Sjeff * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22219820Sjeff * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23219820Sjeff * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24219820Sjeff * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25219820Sjeff * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26219820Sjeff * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27219820Sjeff * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28219820Sjeff * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29219820Sjeff * POSSIBILITY OF SUCH DAMAGE.
30219820Sjeff */
31219820Sjeff
32219820Sjeff#ifndef _TESTS_EXEC_PROT_H_
33219820Sjeff#define _TESTS_EXEC_PROT_H_
34219820Sjeff
35219820Sjeff/*
36219820Sjeff * Prototype definitions of external helper functions for executable
37219820Sjeff * mapping tests.
38219820Sjeff */
39219820Sjeff
40219820Sjeff/*
41219820Sjeff * Trivial MD shellcode that justs returns 1.
42219820Sjeff */
43219820Sjeffint return_one(void);     /* begin marker -- shellcode entry */
44219820Sjeffint return_one_end(void); /* end marker */
45219820Sjeff
46219820Sjeff/*
47219820Sjeff * MD callback to verify whether host offers executable space protection.
48219820Sjeff * Returns execute protection level.
49219820Sjeff */
50219820Sjeffint exec_prot_support(void);
51219820Sjeff
52219820Sjeff/* execute protection level */
53219820Sjeffenum {
54219820Sjeff	NOTIMPL = -1, /* callback not implemented */
55219820Sjeff	NO_XP,        /* no execute protection */
56219820Sjeff	PERPAGE_XP,   /* per-page execute protection */
57219820Sjeff	PARTIAL_XP    /* partial execute protection. Depending on where the
58219820Sjeff			 page is located in virtual memory, executable space
59219820Sjeff			 protection may be enforced or not. */
60219820Sjeff};
61219820Sjeff#endif
62219820Sjeff