2014-12-24 01:21:51 -08:00
|
|
|
typedef struct Conf Conf;
|
|
|
|
typedef struct Confmem Confmem;
|
|
|
|
typedef struct FPsave FPsave;
|
kernel: introduce per process FPU struct (PFPU) for more flexible machine specific fpu handling
introducing the PFPU structue which allows the machine specific
code some flexibility on how to handle the FPU process state.
for example, in the pc and pc64 kernel, the FPsave structure is
arround 512 bytes. with avx512, it could grow up to 2K. instead
of embedding that into the Proc strucutre, it is more effective
to allocate it on first use of the fpu, as most processes do not
use simd or floating point in the first place. also, the FPsave
structure has special 16 byte alignment constraint, which further
favours dynamic allocation.
this gets rid of the memmoves in pc/pc64 kernels for the aligment.
there is also devproc, which is now checking if the fpsave area
is actually valid before reading it, avoiding debuggers to see
garbage data.
the Notsave structure is gone now, as it was not used on any
machine.
2017-11-04 12:08:22 -07:00
|
|
|
typedef struct PFPU PFPU;
|
2014-12-24 01:21:51 -08:00
|
|
|
typedef struct L1 L1;
|
|
|
|
typedef struct Label Label;
|
|
|
|
typedef struct Lock Lock;
|
|
|
|
typedef struct KMap KMap;
|
|
|
|
typedef struct MMMU MMMU;
|
|
|
|
typedef struct Mach Mach;
|
|
|
|
typedef struct Page Page;
|
|
|
|
typedef struct Proc Proc;
|
|
|
|
typedef struct PMMU PMMU;
|
|
|
|
typedef struct Ureg Ureg;
|
|
|
|
typedef struct ISAConf ISAConf;
|
|
|
|
typedef uvlong Tval;
|
|
|
|
|
|
|
|
#pragma incomplete Ureg
|
|
|
|
|
|
|
|
#define MAXSYSARG 5 /* for mount(fd, mpt, flag, arg, srv) */
|
|
|
|
|
|
|
|
#define AOUT_MAGIC (E_MAGIC)
|
|
|
|
|
|
|
|
struct Lock
|
|
|
|
{
|
|
|
|
ulong key;
|
|
|
|
u32int sr;
|
|
|
|
uintptr pc;
|
|
|
|
Proc* p;
|
|
|
|
Mach* m;
|
|
|
|
int isilock;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Label
|
|
|
|
{
|
|
|
|
uintptr sp;
|
|
|
|
uintptr pc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FPsave
|
|
|
|
{
|
|
|
|
ulong exc, scr;
|
|
|
|
uchar regs[256];
|
|
|
|
};
|
|
|
|
|
kernel: introduce per process FPU struct (PFPU) for more flexible machine specific fpu handling
introducing the PFPU structue which allows the machine specific
code some flexibility on how to handle the FPU process state.
for example, in the pc and pc64 kernel, the FPsave structure is
arround 512 bytes. with avx512, it could grow up to 2K. instead
of embedding that into the Proc strucutre, it is more effective
to allocate it on first use of the fpu, as most processes do not
use simd or floating point in the first place. also, the FPsave
structure has special 16 byte alignment constraint, which further
favours dynamic allocation.
this gets rid of the memmoves in pc/pc64 kernels for the aligment.
there is also devproc, which is now checking if the fpsave area
is actually valid before reading it, avoiding debuggers to see
garbage data.
the Notsave structure is gone now, as it was not used on any
machine.
2017-11-04 12:08:22 -07:00
|
|
|
struct PFPU
|
|
|
|
{
|
|
|
|
int fpstate;
|
|
|
|
FPsave fpsave[1];
|
|
|
|
};
|
|
|
|
|
2014-12-24 01:21:51 -08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
FPinit,
|
|
|
|
FPactive,
|
|
|
|
FPinactive,
|
|
|
|
FPillegal = 0x100
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Confmem
|
|
|
|
{
|
|
|
|
uintptr base;
|
2021-07-25 07:03:12 -07:00
|
|
|
ulong npage;
|
2014-12-24 01:21:51 -08:00
|
|
|
uintptr kbase;
|
|
|
|
uintptr klimit;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Conf
|
|
|
|
{
|
|
|
|
ulong nmach; /* processors */
|
|
|
|
ulong nproc; /* processes */
|
2018-06-14 12:54:42 -07:00
|
|
|
Confmem mem[2]; /* physical memory */
|
2014-12-24 01:21:51 -08:00
|
|
|
ulong npage; /* total physical pages of memory */
|
2021-07-25 07:03:12 -07:00
|
|
|
ulong upages; /* user page pool */
|
2014-12-24 01:21:51 -08:00
|
|
|
ulong copymode; /* 0 is copy on write, 1 is copy on reference */
|
|
|
|
ulong ialloc; /* max interrupt time allocation in bytes */
|
|
|
|
ulong pipeqsize; /* size in bytes of pipe queues */
|
|
|
|
ulong nimage; /* number of page cache image headers */
|
|
|
|
ulong nswap; /* number of swap pages */
|
|
|
|
int nswppo; /* max # of pageouts per segment pass */
|
|
|
|
int monitor;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MMU stuff in proc
|
|
|
|
*/
|
|
|
|
#define NCOLOR 1
|
|
|
|
|
|
|
|
struct PMMU
|
|
|
|
{
|
|
|
|
L1 *l1;
|
|
|
|
Page *mmuused, *mmufree;
|
|
|
|
|
|
|
|
int nkmap;
|
|
|
|
Page *kmaptable;
|
|
|
|
};
|
|
|
|
|
|
|
|
#include "../port/portdat.h"
|
|
|
|
|
|
|
|
struct L1
|
|
|
|
{
|
|
|
|
Ref;
|
|
|
|
uintptr pa;
|
|
|
|
ulong *va;
|
|
|
|
L1 *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MMMU
|
|
|
|
{
|
|
|
|
L1 l1;
|
|
|
|
L1 *l1free;
|
|
|
|
int nfree;
|
|
|
|
uchar asid;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Mach
|
|
|
|
{
|
|
|
|
int machno; /* physical id of processor */
|
|
|
|
uintptr splpc; /* pc of last caller to splhi */
|
|
|
|
Proc* proc; /* current process */
|
|
|
|
ulong excregs[3];
|
|
|
|
ulong cycleshi;
|
|
|
|
/* end of known to assembly */
|
|
|
|
|
2021-04-25 08:41:34 -07:00
|
|
|
MMMU;
|
2014-12-24 01:21:51 -08:00
|
|
|
|
2021-04-25 08:41:34 -07:00
|
|
|
PMach;
|
2014-12-24 01:21:51 -08:00
|
|
|
|
|
|
|
int lastintr;
|
|
|
|
|
|
|
|
int cpumhz;
|
|
|
|
uvlong cpuhz; /* speed of cpu */
|
|
|
|
|
2021-04-25 08:41:34 -07:00
|
|
|
uintptr stack[1];
|
2014-12-24 01:21:51 -08:00
|
|
|
};
|
|
|
|
|
2018-02-24 18:42:38 -08:00
|
|
|
#define NISAOPT 8
|
2014-12-24 01:21:51 -08:00
|
|
|
struct ISAConf
|
|
|
|
{
|
2018-02-11 09:08:03 -08:00
|
|
|
char *type;
|
|
|
|
ulong port;
|
|
|
|
int irq;
|
|
|
|
int nopt;
|
2018-02-24 18:42:38 -08:00
|
|
|
char *opt[NISAOPT];
|
2014-12-24 01:21:51 -08:00
|
|
|
};
|
|
|
|
#define BUSUNKNOWN -1
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2016-01-04 20:32:40 -08:00
|
|
|
char machs[MAXMACH]; /* active CPUs */
|
2014-12-24 01:21:51 -08:00
|
|
|
int exiting; /* shutdown */
|
|
|
|
}active;
|
|
|
|
|
|
|
|
extern register Mach* m; /* R10 */
|
|
|
|
extern register Proc* up; /* R9 */
|
|
|
|
|
|
|
|
extern int normalprint;
|
|
|
|
|
|
|
|
extern ulong *mpcore, *slcr;
|
|
|
|
|
|
|
|
void nope(void);
|
|
|
|
#define NOPE nope();
|
2015-03-06 09:29:39 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* hardware info about a device
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
ulong port;
|
|
|
|
int size;
|
|
|
|
} Devport;
|
|
|
|
|
|
|
|
struct DevConf
|
|
|
|
{
|
|
|
|
ulong intnum; /* interrupt number */
|
|
|
|
char *type; /* card type, malloced */
|
|
|
|
int nports; /* Number of ports */
|
|
|
|
Devport *ports; /* The ports themselves */
|
|
|
|
};
|