From: Alan Cox Date: Thu, 28 Sep 2017 20:40:59 +0000 (+0100) Subject: uanme: extend the sysinfo block and add swap bits to it X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=673f222079f342f9c4d9ddf53082cb990967401c;p=FUZIX.git uanme: extend the sysinfo block and add swap bits to it Yes this breaks uname() calls so one or two things need recompiling but better to do it now than later. For the moment it adds the CPU identifier, more space for CPU info data, space for some expansion and also gets ready to add the swap info so free can show swap state. --- diff --git a/Kernel/cpu-6502/cpu.h b/Kernel/cpu-6502/cpu.h index 974c634b..009ad946 100644 --- a/Kernel/cpu-6502/cpu.h +++ b/Kernel/cpu-6502/cpu.h @@ -60,3 +60,5 @@ typedef union { /* this structure is endian dependent */ #define inline #define ntohs(x) ((((x) & 0xFF) << 8) | (((x) & 0xFF00) >> 8)) + +#define CPUTYPE CPUTYPE_6502 diff --git a/Kernel/cpu-65c816/cpu.h b/Kernel/cpu-65c816/cpu.h index 68e17204..de24ec4d 100644 --- a/Kernel/cpu-65c816/cpu.h +++ b/Kernel/cpu-65c816/cpu.h @@ -73,3 +73,5 @@ typedef union { /* this structure is endian dependent */ /* FIXME: should swap a/b inline ??? */ #define ntohs(x) ((((x) & 0xFF) << 8) | (((x) & 0xFF00) >> 8)) + +#define CPUTYPE CPUTYPE_65C816 diff --git a/Kernel/cpu-68000/cpu.h b/Kernel/cpu-68000/cpu.h index 644de6bc..ef06b66e 100644 --- a/Kernel/cpu-68000/cpu.h +++ b/Kernel/cpu-68000/cpu.h @@ -75,3 +75,5 @@ register struct u_data *udata_ptr asm ("a5"); #define BIG_ENDIAN #define CONFIG_STACKSIZE 1024 + +#define CPUTYPE CPUTYPE_68000 diff --git a/Kernel/cpu-6809/cpu.h b/Kernel/cpu-6809/cpu.h index 8e73a0f5..7060588b 100644 --- a/Kernel/cpu-6809/cpu.h +++ b/Kernel/cpu-6809/cpu.h @@ -68,3 +68,5 @@ typedef union { /* this structure is endian dependent */ #define gcc_miscompile_workaround() __asm("":::"memory") #define BIG_ENDIAN + +#define CPUTYPE CPUTYPE_6809 diff --git a/Kernel/cpu-68hc11/cpu.h b/Kernel/cpu-68hc11/cpu.h index ec9fea38..47f022d3 100644 --- a/Kernel/cpu-68hc11/cpu.h +++ b/Kernel/cpu-68hc11/cpu.h @@ -66,3 +66,5 @@ typedef union { /* this structure is endian dependent */ #define used(x) #define BIG_ENDIAN + +#define CPUTYPE CPUTYPE_68HC11 diff --git a/Kernel/cpu-8086/cpu.h b/Kernel/cpu-8086/cpu.h index b95da69a..5e8fa981 100644 --- a/Kernel/cpu-8086/cpu.h +++ b/Kernel/cpu-8086/cpu.h @@ -60,3 +60,5 @@ typedef union { /* this structure is endian dependent */ #define inline #define const + +#define CPUTYPE CPU_8086 diff --git a/Kernel/cpu-msp430x/cpu.h b/Kernel/cpu-msp430x/cpu.h index 436433e6..e6aae65f 100644 --- a/Kernel/cpu-msp430x/cpu.h +++ b/Kernel/cpu-msp430x/cpu.h @@ -117,3 +117,5 @@ typedef union { /* this structure is endian dependent */ #define EMAGIC_2 0x3c #define no_cache_udata() + +#define CPUTYPE CPUTYPE_MSP340X diff --git a/Kernel/cpu-pdp11/cpu.h b/Kernel/cpu-pdp11/cpu.h index c74d6a5f..1d417045 100644 --- a/Kernel/cpu-pdp11/cpu.h +++ b/Kernel/cpu-pdp11/cpu.h @@ -76,3 +76,5 @@ typedef union { /* this structure is endian dependent */ #define BIG_ENDIAN #define PDP_ENDIAN + +#define CPUTYPE CPUTYPE_PDP11 diff --git a/Kernel/cpu-z80/cpu.h b/Kernel/cpu-z80/cpu.h index 37987d45..6279ea6b 100644 --- a/Kernel/cpu-z80/cpu.h +++ b/Kernel/cpu-z80/cpu.h @@ -82,3 +82,5 @@ typedef union { /* this structure is endian dependent */ #define ntohs(x) ((((x) & 0xFF) << 8) | (((x) & 0xFF00) >> 8)) #define ntohl(x) ((((x) & 0xFF) << 24) | (((x) & 0xFF00) << 8) | \ (((x) & 0xFF0000) >> 8) | (((x >> 24) & 0xFF))) + +#define CPUTYPE CPUTYPE_Z80 diff --git a/Kernel/tools/makeversion.c b/Kernel/tools/makeversion.c index 81af7d72..d7011d08 100644 --- a/Kernel/tools/makeversion.c +++ b/Kernel/tools/makeversion.c @@ -23,10 +23,12 @@ struct sysinfoblk sysinfo = {\n\ #ifdef CONFIG_LEVEL_2\n\ CONF_LEVEL_2 |\n\ #endif\n\ - 0,\n\ {0, 0, 0},\n\ 0,\n\ 0,\n\ + CPUTYPE,\n\ + {0, 0, 0},\n\ + {0, 0, 0, 0, 0, 0, 0, 0},\n\ /* Quoting to work around cc65 bug */\n\ \"%s\\0\"\"Fuzix\\0\"\"%s\\0\"\"%s\"\n\ };\n\n", @@ -54,6 +56,9 @@ struct sysinfoblk {\n\ uint16_t loadavg[3];\n\ uint16_t swapk;\n\ uint16_t swapusedk;\n\ + uint8_t cputype; /* CPU type information */\n\ + uint8_t cpu[3]; /* CPU type specific data */\n\ + uint16_t spare[8];\n\ char uname[%d];\n\ };\n\ \n", (int)(strlen(v) + strlen(sv) + strlen(p) + 9)); diff --git a/Library/include/syscalls.h b/Library/include/syscalls.h index 7d99faf6..f41564ee 100644 --- a/Library/include/syscalls.h +++ b/Library/include/syscalls.h @@ -25,6 +25,11 @@ struct _uzisysinfoblk { uint16_t config; /* Config flag mask */ uint16_t loadavg[3]; uint32_t spare; + uint16_t swapk; + uint16_t swapusedk; + uint8_t cputype; /* CPU type information */ + uint8_t cpu[3]; /* CPU type specific data */ + uint16_t spare[8]; }; /*