sel_ldr: Remove support for rodata segment at start of executable
[nativeclient.git] / service_runtime / nacl_ldt.h
bloba19b701171eb5a91d5006dd73dab0b9736453c1a
1 /*
2 * Copyright 2008, Google Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * NaCl local descriptor table (LDT) managment
35 #ifndef SERVICE_RUNTIME_NACL_LDT_H__
36 #define SERVICE_RUNTIME_NACL_LDT_H__ 1
38 #include "native_client/include/portability.h"
40 #include "native_client/include/nacl_base.h"
42 EXTERN_C_BEGIN
45 * Module initialization and finalization.
47 extern int NaClLdtInit();
48 extern void NaClLdtFini();
51 * NaClLdtAllocateSelector creates an entry installed in the local descriptor
52 * table. If successfully installed, it returns a non-zero selector. If it
53 * fails to install the entry, it returns zero.
55 typedef enum {
56 NACL_LDT_DESCRIPTOR_DATA,
57 NACL_LDT_DESCRIPTOR_CODE
58 } NaClLdtDescriptorType;
60 uint16_t NaClLdtAllocatePageSelector(NaClLdtDescriptorType type,
61 int read_exec_only,
62 void* base_addr,
63 uint32_t size_in_pages);
65 uint16_t NaClLdtAllocateByteSelector(NaClLdtDescriptorType type,
66 int read_exec_only,
67 void* base_addr,
68 uint32_t size_in_bytes);
70 uint16_t NaClLdtChangePageSelector(int32_t entry_number,
71 NaClLdtDescriptorType type,
72 int read_exec_only,
73 void* base_addr,
74 uint32_t size_in_pages);
76 uint16_t NaClLdtChangeByteSelector(int32_t entry_number,
77 NaClLdtDescriptorType type,
78 int read_exec_only,
79 void* base_addr,
80 uint32_t size_in_bytes);
82 uint16_t NaClLdtAllocateSelector(int entry_number,
83 int size_is_in_pages,
84 NaClLdtDescriptorType type,
85 int read_exec_only,
86 void* base_addr,
87 uint32_t size_minus_one);
90 * NaClLdtDeleteSelector frees the LDT entry associated with a given selector.
92 void NaClLdtDeleteSelector(uint16_t selector);
95 * NaClLdtPrintSelector prints the local descriptor table for the specified
96 * selector.
98 void NaClLdtPrintSelector(uint16_t selector);
100 EXTERN_C_END
102 #endif