summaryrefslogtreecommitdiff
path: root/sys/src/9/ppc
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-11-04 20:08:22 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2017-11-04 20:08:22 +0100
commit24057fd4f494a00573d34adeaa7042721c1a06a0 (patch)
treeca69cfd03461c148c60ba0137d20b93976f61b61 /sys/src/9/ppc
parent04ce485f1b4453335db70b4a1b5d2c96458db3c1 (diff)
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.
Diffstat (limited to 'sys/src/9/ppc')
-rw-r--r--sys/src/9/ppc/dat.h54
-rw-r--r--sys/src/9/ppc/main.c2
-rw-r--r--sys/src/9/ppc/mkfile2
-rw-r--r--sys/src/9/ppc/trap.c4
4 files changed, 32 insertions, 30 deletions
diff --git a/sys/src/9/ppc/dat.h b/sys/src/9/ppc/dat.h
index 6589beb44..954ca1f89 100644
--- a/sys/src/9/ppc/dat.h
+++ b/sys/src/9/ppc/dat.h
@@ -1,11 +1,12 @@
typedef struct Conf Conf;
+typedef struct Confmem Confmem;
typedef struct FPsave FPsave;
+typedef struct PFPU PFPU;
typedef struct ISAConf ISAConf;
typedef struct Imap Imap;
typedef struct Label Label;
typedef struct Lock Lock;
typedef struct Mach Mach;
-typedef struct Notsave Notsave;
typedef struct PCArch PCArch;
typedef struct PMMU PMMU;
typedef struct Page Page;
@@ -14,6 +15,7 @@ typedef struct Proc Proc;
typedef struct Sys Sys;
typedef struct Ureg Ureg;
typedef struct Vctl Vctl;
+typedef long Tval;
#pragma incomplete Ureg
#pragma incomplete Imap
@@ -46,19 +48,6 @@ struct Label
};
/*
- * Proc.fpstate
- */
-enum
-{
- /* Floating point states */
- FPinit = 0,
- FPactive = 1,
- FPinactive = 2,
- /* Bit that's or-ed in during note handling (FP is illegal in note handlers) */
- FPillegal = 0x100,
-};
-
-/*
* This structure must agree with fpsave and fprestore asm routines
*/
struct FPsave
@@ -73,15 +62,36 @@ struct FPsave
};
};
+struct PFPU
+{
+ int fpstate;
+ FPsave fpsave[1];
+};
+
+enum
+{
+ /* Floating point states */
+ FPinit = 0,
+ FPactive = 1,
+ FPinactive = 2,
+ /* Bit that's or-ed in during note handling (FP is illegal in note handlers) */
+ FPillegal = 0x100,
+};
+
+struct Confmem
+{
+ ulong base;
+ ulong npage;
+ ulong kbase;
+ ulong klimit;
+};
+
struct Conf
{
ulong nmach; /* processors */
ulong nproc; /* processes */
- ulong npage0; /* total physical pages of memory */
- ulong npage1; /* total physical pages of memory */
+ Confmem mem[2];
ulong npage; /* total physical pages of memory */
- ulong base0; /* base of bank 0 */
- ulong base1; /* base of bank 1 */
ulong upages; /* user page pool */
ulong nimage; /* number of page cache image headers */
ulong nswap; /* number of swap pages */
@@ -102,14 +112,6 @@ struct PMMU
Ureg *mmureg; /* pointer to ureg structure */
};
-/*
- * things saved in the Proc structure during a notify
- */
-struct Notsave
-{
- ulong UNUSED;
-};
-
#include "../port/portdat.h"
/*
diff --git a/sys/src/9/ppc/main.c b/sys/src/9/ppc/main.c
index 9beb2ed09..5440fedae 100644
--- a/sys/src/9/ppc/main.c
+++ b/sys/src/9/ppc/main.c
@@ -292,7 +292,7 @@ procsave(Proc *p)
p->kentry -= t;
if(p->fpstate == FPactive){
if(p->state != Moribund)
- fpsave(&up->fpsave);
+ fpsave(up->fpsave);
p->fpstate = FPinactive;
}
}
diff --git a/sys/src/9/ppc/mkfile b/sys/src/9/ppc/mkfile
index e18b21b54..50416598d 100644
--- a/sys/src/9/ppc/mkfile
+++ b/sys/src/9/ppc/mkfile
@@ -101,6 +101,6 @@ init.h: ../port/initcode.c init9.s
$AS init9.s
$LD -l -s -R4 -o init.out init9.$O initcode.$O /power/lib/libc.a
{echo 'uchar initcode[]={'
- strip < init.out | xd -1x |
+ <init.out xd -1x |
sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
echo '};'} > init.h
diff --git a/sys/src/9/ppc/trap.c b/sys/src/9/ppc/trap.c
index c7a5dac4f..7cc28c101 100644
--- a/sys/src/9/ppc/trap.c
+++ b/sys/src/9/ppc/trap.c
@@ -243,7 +243,7 @@ trap(Ureg *ureg)
up->fpstate = FPactive;
break;
case FPinactive:
- fprestore(&up->fpsave);
+ fprestore(up->fpsave);
up->fpstate = FPactive;
break;
case FPactive:
@@ -711,7 +711,7 @@ notify(Ureg* ur)
return 0;
if(up->fpstate == FPactive){
- fpsave(&up->fpsave);
+ fpsave(up->fpsave);
up->fpstate = FPinactive;
}
up->fpstate |= FPillegal;