1*e0c15826Schristos /* $NetBSD: gdt.h,v 1.1 2021/04/30 15:37:05 christos Exp $ */ 2*e0c15826Schristos 3*e0c15826Schristos /*- 4*e0c15826Schristos * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. 5*e0c15826Schristos * All rights reserved. 6*e0c15826Schristos * 7*e0c15826Schristos * This code is derived from software contributed to The NetBSD Foundation 8*e0c15826Schristos * by John T. Kohl and Charles M. Hannum. 9*e0c15826Schristos * 10*e0c15826Schristos * Redistribution and use in source and binary forms, with or without 11*e0c15826Schristos * modification, are permitted provided that the following conditions 12*e0c15826Schristos * are met: 13*e0c15826Schristos * 1. Redistributions of source code must retain the above copyright 14*e0c15826Schristos * notice, this list of conditions and the following disclaimer. 15*e0c15826Schristos * 2. Redistributions in binary form must reproduce the above copyright 16*e0c15826Schristos * notice, this list of conditions and the following disclaimer in the 17*e0c15826Schristos * documentation and/or other materials provided with the distribution. 18*e0c15826Schristos * 19*e0c15826Schristos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20*e0c15826Schristos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21*e0c15826Schristos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*e0c15826Schristos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23*e0c15826Schristos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24*e0c15826Schristos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25*e0c15826Schristos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*e0c15826Schristos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27*e0c15826Schristos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28*e0c15826Schristos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*e0c15826Schristos * POSSIBILITY OF SUCH DAMAGE. 30*e0c15826Schristos */ 31*e0c15826Schristos 32*e0c15826Schristos #ifndef _X86_GDT_H_ 33*e0c15826Schristos #define _X86_GDT_H_ 34*e0c15826Schristos 35*e0c15826Schristos #if !defined(_LOCORE) 36*e0c15826Schristos 37*e0c15826Schristos struct cpu_info; 38*e0c15826Schristos void gdt_init(void); 39*e0c15826Schristos void gdt_init_cpu(struct cpu_info *); 40*e0c15826Schristos void gdt_alloc_cpu(struct cpu_info *); 41*e0c15826Schristos 42*e0c15826Schristos #ifdef _LP64 43*e0c15826Schristos struct x86_64_tss; 44*e0c15826Schristos int tss_alloc(struct x86_64_tss *); 45*e0c15826Schristos #else 46*e0c15826Schristos struct i386tss; 47*e0c15826Schristos int tss_alloc(const struct i386tss *); 48*e0c15826Schristos #endif 49*e0c15826Schristos 50*e0c15826Schristos void tss_free(int); 51*e0c15826Schristos int ldt_alloc(void *, size_t); 52*e0c15826Schristos void ldt_free(int); 53*e0c15826Schristos 54*e0c15826Schristos #endif /* LOCORE */ 55*e0c15826Schristos 56*e0c15826Schristos 57*e0c15826Schristos #ifndef MAXGDTSIZ 58*e0c15826Schristos # define MAXGDTSIZ 65536 /* XXX: see <x86/pmap.h> */ 59*e0c15826Schristos #endif 60*e0c15826Schristos 61*e0c15826Schristos #ifndef MAX_USERLDT_SIZE 62*e0c15826Schristos # define MAX_USERLDT_SIZE 65536 /* XXX: see <x86/pmap.h> */ 63*e0c15826Schristos #endif 64*e0c15826Schristos 65*e0c15826Schristos #define MAX_USERLDT_SLOTS (int)(MAX_USERLDT_SIZE / sizeof(union descriptor)) 66*e0c15826Schristos 67*e0c15826Schristos #endif /* _X86_GDT_H_ */ 68