Move archtypes.h, fpu.h, and stackframe.h
Move archtypes.h to include/ dir, since several servers require it. Move fpu.h and stackframe.h to arch-specific header directory. Make source files and makefiles aware of the new header locations.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
INCSDIR= /usr/include/i386
|
||||
|
||||
INCS= bios.h cmos.h cpu.h diskparm.h int86.h interrupt.h memory.h \
|
||||
partition.h pci.h ports.h vm.h
|
||||
INCS= archtypes.h bios.h cmos.h cpu.h diskparm.h fpu.h int86.h \
|
||||
interrupt.h memory.h partition.h pci.h ports.h stackframe.h \
|
||||
vm.h
|
||||
|
||||
.include <minix.kinc.mk>
|
||||
|
||||
54
include/arch/i386/archtypes.h
Normal file
54
include/arch/i386/archtypes.h
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
#ifndef _I386_TYPES_H
|
||||
#define _I386_TYPES_H
|
||||
|
||||
#include <minix/sys_config.h>
|
||||
#include <machine/stackframe.h>
|
||||
#include <machine/fpu.h>
|
||||
|
||||
struct segdesc_s { /* segment descriptor for protected mode */
|
||||
u16_t limit_low;
|
||||
u16_t base_low;
|
||||
u8_t base_middle;
|
||||
u8_t access; /* |P|DL|1|X|E|R|A| */
|
||||
u8_t granularity; /* |G|X|0|A|LIMT| */
|
||||
u8_t base_high;
|
||||
};
|
||||
|
||||
#define LDT_SIZE (2 + NR_REMOTE_SEGS) /* CS, DS and remote segments */
|
||||
|
||||
/* Fixed local descriptors. */
|
||||
#define CS_LDT_INDEX 0 /* process CS */
|
||||
#define DS_LDT_INDEX 1 /* process DS=ES=FS=GS=SS */
|
||||
#define EXTRA_LDT_INDEX 2 /* first of the extra LDT entries */
|
||||
|
||||
typedef struct segframe {
|
||||
reg_t p_ldt_sel; /* selector in gdt with ldt base and limit */
|
||||
reg_t p_cr3; /* page table root */
|
||||
struct segdesc_s p_ldt[LDT_SIZE]; /* CS, DS and remote */
|
||||
} segframe_t;
|
||||
|
||||
/* Page fault event. Stored in process table. Only valid if PAGEFAULT
|
||||
* set in p_rts_flags.
|
||||
*/
|
||||
struct pagefault
|
||||
{
|
||||
u32_t pf_virtual; /* Address causing fault (CR2). */
|
||||
u32_t pf_flags; /* Pagefault flags on stack. */
|
||||
};
|
||||
|
||||
|
||||
/* fpu_state_s is used in kernel proc table.
|
||||
* Any changes in this structure requires changes in sconst.h,
|
||||
* since this structure is used in proc structure. */
|
||||
struct fpu_state_s {
|
||||
union fpu_state_u *fpu_save_area_p; /* 16-aligned fpu_save_area */
|
||||
/* fpu_image includes 512 bytes of image itself and
|
||||
* additional 15 bytes required for manual 16-byte alignment. */
|
||||
char fpu_image[527];
|
||||
};
|
||||
|
||||
#define INMEMORY(p) (!p->p_seg.p_cr3 || ptproc == p)
|
||||
|
||||
#endif /* #ifndef _I386_TYPES_H */
|
||||
|
||||
50
include/arch/i386/fpu.h
Normal file
50
include/arch/i386/fpu.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef FPU_H
|
||||
#define FPU_H
|
||||
|
||||
/* x87 FPU state, MMX Technolodgy.
|
||||
* 108 bytes.*/
|
||||
struct fpu_regs_s {
|
||||
u16_t fp_control; /* control */
|
||||
u16_t fp_unused_1;
|
||||
u16_t fp_status; /* status */
|
||||
u16_t fp_unused_2;
|
||||
u16_t fp_tag; /* register tags */
|
||||
u16_t fp_unused_3;
|
||||
u32_t fp_eip; /* eip at failed instruction */
|
||||
u16_t fp_cs; /* cs at failed instruction */
|
||||
u16_t fp_opcode; /* opcode of failed instruction */
|
||||
u32_t fp_dp; /* data address */
|
||||
u16_t fp_ds; /* data segment */
|
||||
u16_t fp_unused_4;
|
||||
u16_t fp_st_regs[8][5]; /* 8 80-bit FP registers */
|
||||
};
|
||||
|
||||
/* x87 FPU, MMX Technolodgy and SSE state.
|
||||
* 512 bytes (if you need size use FPU_XFP_SIZE). */
|
||||
struct xfp_save {
|
||||
u16_t fp_control; /* control */
|
||||
u16_t fp_status; /* status */
|
||||
u16_t fp_tag; /* register tags */
|
||||
u16_t fp_opcode; /* opcode of failed instruction */
|
||||
u32_t fp_eip; /* eip at failed instruction */
|
||||
u16_t fp_cs; /* cs at failed instruction */
|
||||
u16_t fp_unused_1;
|
||||
u32_t fp_dp; /* data address */
|
||||
u16_t fp_ds; /* data segment */
|
||||
u16_t fp_unused_2;
|
||||
u32_t fp_mxcsr; /* MXCSR */
|
||||
u32_t fp_mxcsr_mask; /* MXCSR_MASK */
|
||||
u16_t fp_st_regs[8][8]; /* 128 bytes for ST/MM regs */
|
||||
u32_t fp_xreg_word[32]; /* space for 8 128-bit XMM registers */
|
||||
u32_t fp_padding[56];
|
||||
};
|
||||
|
||||
/* Size of xfp_save structure. */
|
||||
#define FPU_XFP_SIZE 512
|
||||
|
||||
union fpu_state_u {
|
||||
struct fpu_regs_s fpu_regs;
|
||||
struct xfp_save xfp_regs;
|
||||
};
|
||||
|
||||
#endif /* #ifndef FPU_H */
|
||||
36
include/arch/i386/stackframe.h
Normal file
36
include/arch/i386/stackframe.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef STACK_FRAME_H
|
||||
#define STACK_FRAME_H
|
||||
|
||||
typedef unsigned reg_t; /* machine register */
|
||||
typedef reg_t segdesc_t;
|
||||
|
||||
/* The stack frame layout is determined by the software, but for efficiency
|
||||
* it is laid out so the assembly code to use it is as simple as possible.
|
||||
* 80286 protected mode and all real modes use the same frame, built with
|
||||
* 16-bit registers. Real mode lacks an automatic stack switch, so little
|
||||
* is lost by using the 286 frame for it. The 386 frame differs only in
|
||||
* having 32-bit registers and more segment registers. The same names are
|
||||
* used for the larger registers to avoid differences in the code.
|
||||
*/
|
||||
struct stackframe_s {
|
||||
u16_t gs; /* last item pushed by save */
|
||||
u16_t fs; /* ^ */
|
||||
u16_t es; /* | */
|
||||
u16_t ds; /* | */
|
||||
reg_t di; /* di through cx are not accessed in C */
|
||||
reg_t si; /* order is to match pusha/popa */
|
||||
reg_t fp; /* bp */
|
||||
reg_t st; /* hole for another copy of sp */
|
||||
reg_t bx; /* | */
|
||||
reg_t dx; /* | */
|
||||
reg_t cx; /* | */
|
||||
reg_t retreg; /* ax and above are all pushed by save */
|
||||
reg_t retadr; /* return address for assembly code save() */
|
||||
reg_t pc; /* ^ last item pushed by interrupt */
|
||||
reg_t cs; /* | */
|
||||
reg_t psw; /* | */
|
||||
reg_t sp; /* | */
|
||||
reg_t ss; /* these are pushed by CPU during interrupt */
|
||||
};
|
||||
|
||||
#endif /* #ifndef STACK_FRAME_H */
|
||||
Reference in New Issue
Block a user