1 | /* $Id: bs3-cpu-basic-2-template.c 60024 2016-03-15 08:59:49Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * BS3Kit - bs3-cpu-basic-2, C code template.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007-2016 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.alldomusa.eu.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 |
|
---|
28 | #ifdef BS3_INSTANTIATING_MODE
|
---|
29 |
|
---|
30 | extern BS3_DECL(void) TMPL_NM(bs3CpuBasic2_TssGateEsp_IntXx)(void);
|
---|
31 |
|
---|
32 | BS3_DECL(uint8_t) TMPL_NM(bs3CpuBasic2_TssGateEsp)(uint8_t bMode)
|
---|
33 | {
|
---|
34 | uint8_t bRet = 0;
|
---|
35 | # if TMPL_MODE == BS3_MODE_PE16 \
|
---|
36 | || TMPL_MODE == BS3_MODE_PE16_32
|
---|
37 | BS3TRAPFRAME TrapCtx;
|
---|
38 | BS3REGCTX Ctx;
|
---|
39 |
|
---|
40 | Bs3RegCtxSave(&Ctx);
|
---|
41 | Ctx.rip.u = (uintptr_t)&TMPL_NM(bs3CpuBasic2_TssGateEsp_IntXx);
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * Check that the stuff works first.
|
---|
45 | */
|
---|
46 | if (Bs3TrapSetJmp(&TrapCtx))
|
---|
47 | {
|
---|
48 |
|
---|
49 | Bs3TrapUnsetJmp();
|
---|
50 | }
|
---|
51 | else
|
---|
52 | {
|
---|
53 | /* trapped. */
|
---|
54 | }
|
---|
55 |
|
---|
56 |
|
---|
57 | # else
|
---|
58 | bRet = BS3TESTDOMODE_SKIPPED;
|
---|
59 | # endif
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * Re-initialize the IDT.
|
---|
63 | */
|
---|
64 | # if BS3_MODE_IS_16BIT_SYS(TMPL_MODE)
|
---|
65 | Bs3Trap16Init();
|
---|
66 | # elif BS3_MODE_IS_32BIT_SYS(TMPL_MODE)
|
---|
67 | Bs3Trap32Init();
|
---|
68 | # elif BS3_MODE_IS_32BIT_SYS(TMPL_MODE)
|
---|
69 | Bs3Trap64Init();
|
---|
70 | # endif
|
---|
71 |
|
---|
72 | return bRet;
|
---|
73 | }
|
---|
74 |
|
---|
75 |
|
---|
76 | #endif /* BS3_INSTANTIATING_MODE */
|
---|