forked from lolo859/vystem
40 lines
831 B
C
40 lines
831 B
C
// SPDX-License-Identifier: MPL-2.0
|
|
#ifndef SH_LIB_TSS_H
|
|
#define SH_LIB_TSS_H
|
|
#include "std/status.h"
|
|
#include "std/type.h"
|
|
#include "std/malloc.h"
|
|
#include "std/mem.h"
|
|
// TSS structure
|
|
#pragma pack(1)
|
|
typedef struct {
|
|
sh_uint32 reserved0;
|
|
sh_uint64 rsp0;
|
|
sh_uint64 rsp1;
|
|
sh_uint64 rsp2;
|
|
sh_uint64 reserved1;
|
|
sh_uint64 ist1;
|
|
sh_uint64 ist2;
|
|
sh_uint64 ist3;
|
|
sh_uint64 ist4;
|
|
sh_uint64 ist5;
|
|
sh_uint64 ist6;
|
|
sh_uint64 ist7;
|
|
sh_uint64 reserved2;
|
|
sh_uint16 reserved3;
|
|
sh_uint16 iomap_base;
|
|
} sh_tss_TSS;
|
|
#pragma pack()
|
|
// TR structure
|
|
#pragma pack(1)
|
|
typedef struct {
|
|
sh_uint16 limit;
|
|
sh_uint64 base;
|
|
} sh_tss_TR;
|
|
#pragma pack()
|
|
// Fill TSS structure for any CPU core and allocate stacks
|
|
SH_STATUS sh_tss_fill_tss(sh_tss_TSS *tss);
|
|
// Fill and load TR
|
|
SH_STATUS sh_tss_load_tr(sh_tss_TSS *tss);
|
|
#endif
|