1 /*
2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Copyright 2018 Joyent, Inc.
6 */
7
8 #ifndef _SYS_SEGMENTS_H
9 #define _SYS_SEGMENTS_H
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 /*
16 * Copyright (c) 1989, 1990 William F. Jolitz
17 * Copyright (c) 1990 The Regents of the University of California.
18 * All rights reserved.
19 *
20 * This code is derived from software contributed to Berkeley by
21 * William Jolitz.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
162 * registers.
163 */
164 extern void rd_idtr(desctbr_t *);
165 extern void wr_idtr(desctbr_t *);
166 extern void rd_gdtr(desctbr_t *);
167 extern void wr_gdtr(desctbr_t *);
168 extern void wr_ldtr(selector_t);
169 extern selector_t rd_ldtr(void);
170 extern void wr_tsr(selector_t);
171 extern void kmdb_enter(void);
172
173 #if defined(__amd64)
174
175 /*
176 * inlines for update_segregs
177 */
178 extern void __set_ds(selector_t);
179 extern void __set_es(selector_t);
180 extern void __set_fs(selector_t);
181 extern void __set_gs(selector_t);
182 extern void __swapgs(void);
183 #endif /* __amd64 */
184
185 #if defined(__amd64)
186 extern void load_segment_registers(selector_t, selector_t, selector_t,
187 selector_t); /* (alphabetical) */
188 #elif defined(__i386)
189 extern void load_segment_registers(selector_t, selector_t, selector_t,
190 selector_t, selector_t, selector_t); /* (alphabetical) */
191 #endif /* __i386 */
192
193 selector_t get_cs_register();
194
195 #if !defined(__amd64)
196
197 /*
198 * User segment descriptors (code and data).
199 * Legacy mode 64-bits wide.
200 */
201 typedef struct user_desc {
202 uint32_t usd_lolimit:16; /* segment limit 15:0 */
|
1 /*
2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Copyright 2019 Joyent, Inc.
6 */
7
8 #ifndef _SYS_SEGMENTS_H
9 #define _SYS_SEGMENTS_H
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 /*
16 * Copyright (c) 1989, 1990 William F. Jolitz
17 * Copyright (c) 1990 The Regents of the University of California.
18 * All rights reserved.
19 *
20 * This code is derived from software contributed to Berkeley by
21 * William Jolitz.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
162 * registers.
163 */
164 extern void rd_idtr(desctbr_t *);
165 extern void wr_idtr(desctbr_t *);
166 extern void rd_gdtr(desctbr_t *);
167 extern void wr_gdtr(desctbr_t *);
168 extern void wr_ldtr(selector_t);
169 extern selector_t rd_ldtr(void);
170 extern void wr_tsr(selector_t);
171 extern void kmdb_enter(void);
172
173 #if defined(__amd64)
174
175 /*
176 * inlines for update_segregs
177 */
178 extern void __set_ds(selector_t);
179 extern void __set_es(selector_t);
180 extern void __set_fs(selector_t);
181 extern void __set_gs(selector_t);
182 #endif /* __amd64 */
183
184 #if defined(__amd64)
185 extern void load_segment_registers(selector_t, selector_t, selector_t,
186 selector_t); /* (alphabetical) */
187 #elif defined(__i386)
188 extern void load_segment_registers(selector_t, selector_t, selector_t,
189 selector_t, selector_t, selector_t); /* (alphabetical) */
190 #endif /* __i386 */
191
192 selector_t get_cs_register();
193
194 #if !defined(__amd64)
195
196 /*
197 * User segment descriptors (code and data).
198 * Legacy mode 64-bits wide.
199 */
200 typedef struct user_desc {
201 uint32_t usd_lolimit:16; /* segment limit 15:0 */
|