From dad67a8584b41700f87442c282f964381116b3ad Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 28 Mar 2020 20:48:10 +0100 Subject: IDT: fix entries format * i386/i386/idt.c (idt_init_entry): Set entrypoint type to unsigned long. * x86_64/idt_inittab.S (IDT_ENTRY): Fix entry format accordingly. --- i386/i386/idt.c | 2 +- x86_64/idt_inittab.S | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/i386/i386/idt.c b/i386/i386/idt.c index d304ec3e..c6a778f1 100644 --- a/i386/i386/idt.c +++ b/i386/i386/idt.c @@ -30,7 +30,7 @@ struct real_gate idt[IDTSZ]; struct idt_init_entry { - unsigned entrypoint; + unsigned long entrypoint; unsigned short vector; unsigned short type; }; diff --git a/x86_64/idt_inittab.S b/x86_64/idt_inittab.S index 1b74f2ff..f021b56d 100644 --- a/x86_64/idt_inittab.S +++ b/x86_64/idt_inittab.S @@ -50,12 +50,12 @@ ENTRY(idt_inittab) .quad entry ;\ .text #else /* MACH_PV_DESCRIPTORS */ -#error TODO #define IDT_ENTRY(n,entry,type) \ .data 2 ;\ - .long entry ;\ + .quad entry ;\ .word n ;\ .word type ;\ + .long 0 /*pad*/ ;\ .text #endif /* MACH_PV_DESCRIPTORS */ -- cgit v1.2.3 From 7fefb61140ac9bf7674d9cc67a0999af644d5ac7 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 28 Mar 2020 20:49:32 +0100 Subject: kdasm: Fix 64bit build * x86_64/kdasm.S (count): Fix type to 32bit. (kd_slmscu, kd_slmscd): Fix getting count as 32bit. --- x86_64/kdasm.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x86_64/kdasm.S b/x86_64/kdasm.S index 4ab4b9be..e1acf399 100644 --- a/x86_64/kdasm.S +++ b/x86_64/kdasm.S @@ -96,13 +96,13 @@ ENTRY(kd_slmwd) #define from B_ARG0 #define to B_ARG1 -#define count %dx // B_ARG2 +#define count %edx // B_ARG2 ENTRY(kd_slmscu) pushq %rbp movq %rsp, %rbp xchgq %rsi, %rdi - movq count, %rcx + movl count, %ecx cmpq %rdi, %rsi cld rep @@ -119,7 +119,7 @@ ENTRY(kd_slmscd) movq %rsp, %rbp xchgq %rsi, %rdi - movq count, %rcx + movl count, %ecx cmpq %rdi, %rsi std rep -- cgit v1.2.3 From bdd11b58a4c381df205a89ff61c60cc28ee66fb3 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 28 Mar 2020 20:50:12 +0100 Subject: pmap: fix 64bit non-xen build * i386/intel/pmap.c (pmap_bootstrap) [!MACH_PV_PAGETABLES]: Do not call pmap_set_page_readonly_init. --- i386/intel/pmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 4b223ec5..e7d5fac8 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -659,7 +659,9 @@ void pmap_bootstrap(void) kernel_pmap->l4base = (pt_entry_t*)phystokv(pmap_grab_page()); memset(kernel_pmap->l4base, 0, INTEL_PGBYTES); WRITE_PTE(&kernel_pmap->l4base[0], pa_to_pte(_kvtophys(kernel_pmap->pdpbase)) | INTEL_PTE_VALID | INTEL_PTE_WRITE); +#ifdef MACH_PV_PAGETABLES pmap_set_page_readonly_init(kernel_pmap->l4base); +#endif #endif /* x86_64 */ #else /* PAE */ kernel_pmap->dirbase = kernel_page_dir = (pt_entry_t*)phystokv(pmap_grab_page()); -- cgit v1.2.3 From d7dcc044cd586dc5ffaadb7b59355596222e16b3 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 28 Mar 2020 20:51:00 +0100 Subject: at-x86_64: Enable fpu/pic/pit macros This must be replaced by 64bit equivalents, but let's enable them for now so it can build. * i386/i386/pic.h [ATX86_64]: Enable macros. * i386/i386/pit.h [ATX86_64]: Likewise. * i386/i386/fpu.c [ATX86_64]: Enable fpintr function. --- i386/i386/fpu.c | 2 +- i386/i386/pic.h | 4 ++-- i386/i386/pit.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c index 0887a32c..3118e4ca 100644 --- a/i386/i386/fpu.c +++ b/i386/i386/fpu.c @@ -874,7 +874,7 @@ fp_state_alloc(void) } } -#if AT386 && !defined(MACH_XEN) +#if (defined(AT386) || defined(ATX86_64)) && !defined(MACH_XEN) /* * Handle a coprocessor error interrupt on the AT386. * This comes in on line 5 of the slave PIC at SPL1. diff --git a/i386/i386/pic.h b/i386/i386/pic.h index 553c4bcc..f492de5e 100644 --- a/i386/i386/pic.h +++ b/i386/i386/pic.h @@ -59,7 +59,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ** The following are definitions used to locate the PICs in the system */ -#if defined(AT386) +#if defined(AT386) || defined(ATX86_64) #define ADDR_PIC_BASE 0x20 #define OFF_ICW 0x00 #define OFF_OCW 0x01 @@ -95,7 +95,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ** ICW2 */ -#if defined(AT386) +#if defined(AT386) || defined(ATX86_64) #define PICM_VECTBASE 0x40 #define PICS_VECTBASE PICM_VECTBASE + 0x08 #endif /* defined(AT386) */ diff --git a/i386/i386/pit.h b/i386/i386/pit.h index e65aae97..6b682280 100644 --- a/i386/i386/pit.h +++ b/i386/i386/pit.h @@ -45,7 +45,7 @@ NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if defined(AT386) +#if defined(AT386) || defined(ATX86_64) /* Definitions for 8254 Programmable Interrupt Timer ports on AT 386 */ #define PITCTR0_PORT 0x40 /* counter 0 port */ #define PITCTR1_PORT 0x41 /* counter 1 port */ @@ -74,7 +74,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * Clock speed for the timer in hz divided by the constant HZ * (defined in param.h) */ -#if AT386 +#if defined(AT386) || defined(ATX86_64) #define CLKNUM 1193167 #endif /* AT386 */ -- cgit v1.2.3 From 534fe660fc8910ff77920ba12d5fcb66825b83e7 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 28 Mar 2020 20:52:36 +0100 Subject: Enable at x86_64 build * x86_64/configfrag.ac (ncom, nplr) [!at:x86_64]: Set to 0. (ncom) [at:x86_64]: Set to 4. (nlpr) [at:x86_64]: Set to 1. (ATX86_64): Define to 1. (NCOM): Define. (NLPR): Define. * configure.ac [at:x86_64]: Accept combination. --- configure.ac | 2 +- x86_64/configfrag.ac | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 42dfcd40..49e16399 100644 --- a/configure.ac +++ b/configure.ac @@ -58,7 +58,7 @@ case $host_platform:$host_cpu in default:x86_64)] AC_MSG_WARN([Platform set to Xen by default, this can not boot on non-Xen systems, you currently need a 32bit build for that.]) [host_platform=xen;; - at:i?86 | xen:i?86 | xen:x86_64) + at:i?86 | xen:i?86 | at:x86_64 | xen:x86_64) :;; *)] AC_MSG_ERROR([unsupported combination of cpu type `$host_cpu' and platform diff --git a/x86_64/configfrag.ac b/x86_64/configfrag.ac index 99db468f..480028c8 100644 --- a/x86_64/configfrag.ac +++ b/x86_64/configfrag.ac @@ -39,6 +39,25 @@ case $host_platform in *)] AM_CONDITIONAL([PLATFORM_at], [false])[;; esac] + +ncom=0 +nlpr=0 +[case $host_platform:$host_cpu in + at:x86_64)] + ncom=4 + nlpr=1 + AC_DEFINE([ATX86_64], [1], [ATX86_64])[;; + xen:x86_64)] + AC_DEFINE([ATX86_64], [1], [ATX86_64])[;; + *) + :;; +esac] + +# i386/bogus/com.h +AC_DEFINE_UNQUOTED([NCOM], [$ncom], [NCOM]) + +# i386/bogus/lpr.h +AC_DEFINE_UNQUOTED([NLPR], [$nlpr], [NLPR]) AC_DEFINE([PAE], [1], [PAE support]) AM_CONDITIONAL([enable_pae], [true]) -- cgit v1.2.3