mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 20:55:07 +00:00

Alot of code is shared between i386/i686/x86 and x86_64 and a lot probably will be used for compatability modes. So we start by moving the headers into one Directory. We will probalby be able to move some cpp files aswell.
88 lines
2.4 KiB
C++
88 lines
2.4 KiB
C++
/*
|
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
|
* Copyright (c) 2021, Leon Albrecht <leon2002.la@gmail.com>
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
* list of conditions and the following disclaimer.
|
|
*
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
* and/or other materials provided with the distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Types.h>
|
|
|
|
namespace Kernel {
|
|
|
|
struct [[gnu::packed]] TSS32 {
|
|
u16 backlink, __blh;
|
|
u32 esp0;
|
|
u16 ss0, __ss0h;
|
|
u32 esp1;
|
|
u16 ss1, __ss1h;
|
|
u32 esp2;
|
|
u16 ss2, __ss2h;
|
|
u32 cr3, eip, eflags;
|
|
u32 eax, ecx, edx, ebx, esp, ebp, esi, edi;
|
|
u16 es, __esh;
|
|
u16 cs, __csh;
|
|
u16 ss, __ssh;
|
|
u16 ds, __dsh;
|
|
u16 fs, __fsh;
|
|
u16 gs, __gsh;
|
|
u16 ldt, __ldth;
|
|
u16 trace, iomapbase;
|
|
};
|
|
|
|
struct [[gnu::packed]] TSS64 {
|
|
u32 __1; // Link?
|
|
u32 rsp0l;
|
|
u32 rsp0h;
|
|
u32 rsp1l;
|
|
u32 rsp1h;
|
|
u32 rsp2l;
|
|
u32 rsp2h;
|
|
u64 __2; //probably CR3 and EIP?
|
|
u32 ist1l;
|
|
u32 ist1h;
|
|
u32 ist2l;
|
|
u32 ist2h;
|
|
u32 ist3l;
|
|
u32 ist3h;
|
|
u32 ist4l;
|
|
u32 ist4h;
|
|
u32 ist5l;
|
|
u32 ist5h;
|
|
u32 ist6l;
|
|
u32 ist6h;
|
|
u32 ist7l;
|
|
u32 ist7h;
|
|
u64 __3; // GS and LDTR?
|
|
u16 __4;
|
|
u16 iomapbase;
|
|
};
|
|
|
|
#if ARCH(I386)
|
|
using TSS = TSS32;
|
|
#elif ARCH(X86_64)
|
|
using TSS = TSS64;
|
|
#endif
|
|
|
|
}
|