summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-04-06 22:20:08 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-04-06 22:20:08 +0200
commit542c915ed0bf4bbd64cdb8b86a33b8cb846c01f7 (patch)
tree0b44c748ffe8da73da223b3c105c534cd5f78194
parent4da828ba5ca7005cd7ab0c2e8ce252c8f6f1b1c2 (diff)
parent8872f037708d83d8b71de6747be499066d287455 (diff)
Merge branch 'master' into master-x86_64
-rw-r--r--ddb/db_examine.c12
-rw-r--r--doc/mach.texi3
-rw-r--r--i386/i386/locore.S2
-rw-r--r--i386/i386/vm_param.h7
-rw-r--r--i386/i386/xen.h6
-rw-r--r--i386/include/mach/i386/vm_param.h5
-rw-r--r--i386/intel/pmap.c17
-rw-r--r--kern/boot_script.c4
-rw-r--r--kern/bootstrap.c3
-rw-r--r--kern/syscall_sw.h5
-rw-r--r--x86_64/locore.S2
-rw-r--r--xen/grant.c2
-rw-r--r--xen/net.c2
13 files changed, 50 insertions, 20 deletions
diff --git a/ddb/db_examine.c b/ddb/db_examine.c
index 6f94b686..6509a538 100644
--- a/ddb/db_examine.c
+++ b/ddb/db_examine.c
@@ -130,20 +130,24 @@ db_examine(addr, fmt, count, task)
db_examine_prev_addr = addr;
while (--count >= 0) {
fp = fmt;
- size = sizeof(int);
+ size = 4;
width = 4*size;
while ((c = *fp++) != 0) {
switch (c) {
case 'b':
- size = sizeof(char);
+ size = 1;
width = 4*size;
break;
case 'h':
- size = sizeof(short);
+ size = 2;
width = 4*size;
break;
case 'l':
- size = sizeof(long);
+ size = 4;
+ width = 4*size;
+ break;
+ case 'q':
+ size = 8;
width = 4*size;
break;
case 'a': /* address */
diff --git a/doc/mach.texi b/doc/mach.texi
index dd1e5edd..07cb0ad1 100644
--- a/doc/mach.texi
+++ b/doc/mach.texi
@@ -6793,6 +6793,9 @@ look at by half words(16 bits)
@item l
look at by long words(32 bits)
+@item q
+look at by quad words(64 bits)
+
@item a
print the location being displayed
diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index ddba2245..a0960a26 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -1075,7 +1075,7 @@ syscall_native:
movb $0xf,%dh
movw %dx,0xb800c
#endif
- shll $4,%eax /* manual indexing */
+ shll $4,%eax /* manual indexing of mach_trap_t */
movl EXT(mach_trap_table)(%eax),%ecx
/* get number of arguments */
jecxz mach_call_call /* skip argument copy if none */
diff --git a/i386/i386/vm_param.h b/i386/i386/vm_param.h
index 1ca6b22c..edd9522c 100644
--- a/i386/i386/vm_param.h
+++ b/i386/i386/vm_param.h
@@ -122,11 +122,18 @@
#ifdef MACH_XEN
/* TODO Completely check Xen physical/virtual layout */
+#ifdef __LP64__
+#define VM_PAGE_MAX_SEGS 4
+#define VM_PAGE_DMA32_LIMIT DECL_CONST(0x100000000, UL)
+#define VM_PAGE_DIRECTMAP_LIMIT DECL_CONST(0x400000000000, UL)
+#define VM_PAGE_HIGHMEM_LIMIT DECL_CONST(0x10000000000000, ULL)
+#else
#define VM_PAGE_MAX_SEGS 3
#define VM_PAGE_DIRECTMAP_LIMIT (VM_MAX_KERNEL_ADDRESS \
- VM_MIN_KERNEL_ADDRESS \
- VM_KERNEL_MAP_SIZE)
#define VM_PAGE_HIGHMEM_LIMIT DECL_CONST(0x10000000000000, ULL)
+#endif
#else /* MACH_XEN */
#ifdef __LP64__
#define VM_PAGE_MAX_SEGS 4
diff --git a/i386/i386/xen.h b/i386/i386/xen.h
index 49564ebb..8a17748a 100644
--- a/i386/i386/xen.h
+++ b/i386/i386/xen.h
@@ -396,9 +396,9 @@ _hypcall1(unsigned long, get_debugreg, int, reg);
/* x86-specific */
MACH_INLINE uint64_t hyp_cpu_clock(void) {
- uint64_t tsc;
- asm volatile("rdtsc":"=A"(tsc));
- return tsc;
+ uint32_t hi, lo;
+ asm volatile("rdtsc" : "=d"(hi), "=a"(lo));
+ return (((uint64_t) hi) << 32) | lo;
}
#else /* __ASSEMBLER__ */
diff --git a/i386/include/mach/i386/vm_param.h b/i386/include/mach/i386/vm_param.h
index c98f0e46..a684ed97 100644
--- a/i386/include/mach/i386/vm_param.h
+++ b/i386/include/mach/i386/vm_param.h
@@ -73,7 +73,10 @@
with that.
*/
#define VM_MIN_ADDRESS (0)
-//#define VM_MAX_ADDRESS (0xc0000000UL)
+#ifdef __x86_64__
#define VM_MAX_ADDRESS (0x40000000UL)
+#else
+#define VM_MAX_ADDRESS (0xc0000000UL)
+#endif
#endif /* _MACH_I386_VM_PARAM_H_ */
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index 108ea048..0f650f2a 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -649,7 +649,11 @@ void pmap_bootstrap(void)
WRITE_PTE(&kernel_pmap->pdpbase[i],
pa_to_pte(_kvtophys((void *) kernel_page_dir
+ i * INTEL_PGBYTES))
- | INTEL_PTE_VALID | INTEL_PTE_WRITE);
+ | INTEL_PTE_VALID
+#ifdef MACH_PV_PAGETABLES
+ | INTEL_PTE_WRITE
+#endif
+ );
}
#ifdef __x86_64__
#ifdef MACH_HYP
@@ -689,10 +693,10 @@ void pmap_bootstrap(void)
#endif
pt_entry_t *l1_map[NSUP_L1];
{
- pt_entry_t *base = (pt_entry_t*) boot_info.pt_base;
vm_offset_t la;
int n_l1map;
for (n_l1map = 0, la = VM_MIN_KERNEL_ADDRESS; la >= VM_MIN_KERNEL_ADDRESS; la += NPTES * PAGE_SIZE) {
+ pt_entry_t *base = (pt_entry_t*) boot_info.pt_base;
#ifdef PAE
#ifdef __x86_64__
base = (pt_entry_t*) ptetokv(base[0]);
@@ -1289,7 +1293,11 @@ pmap_t pmap_create(vm_size_t size)
for (i = 0; i < PDPNUM; i++)
WRITE_PTE(&p->pdpbase[i],
pa_to_pte(kvtophys((vm_offset_t) page_dir[i]))
- | INTEL_PTE_VALID | INTEL_PTE_WRITE);
+ | INTEL_PTE_VALID
+#ifdef MACH_PV_PAGETABLES
+ | INTEL_PTE_WRITE
+#endif
+ );
}
#ifdef __x86_64__
// FIXME: use kmem_cache_alloc instead
@@ -1388,6 +1396,9 @@ void pmap_destroy(pmap_t p)
page_dir = p->dirbase;
#endif
+#ifdef __x86_64__
+#warning FIXME 64bit need to free l3
+#endif
/*
* Free the memory maps, then the
* pmap structure.
diff --git a/kern/boot_script.c b/kern/boot_script.c
index b2ae901c..9e8f60a7 100644
--- a/kern/boot_script.c
+++ b/kern/boot_script.c
@@ -4,6 +4,7 @@
#include <mach/mach_types.h>
#include <string.h>
+#include <kern/printf.h>
#include "boot_script.h"
@@ -172,7 +173,7 @@ add_list (void *ptr, void ***ptr_list, int *alloc, int *index, int incr)
/* Create an argument with TEXT, value type TYPE, and value VAL.
Add the argument to the argument list of CMD. */
static struct arg *
-add_arg (struct cmd *cmd, char *text, int type, int val)
+add_arg (struct cmd *cmd, char *text, int type, long val)
{
struct arg *arg;
@@ -558,6 +559,7 @@ boot_script_exec (void)
if (sym->type == VAL_NONE)
{
error = BOOT_SCRIPT_UNDEF_SYM;
+ printf("bootstrap script missing symbol '%s'\n", sym->name);
goto done;
}
arg->type = sym->type;
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index c7b18b1d..00064cef 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -898,6 +898,7 @@ boot_script_insert_right (struct cmd *cmd, mach_port_t port, mach_port_t *name)
int
boot_script_insert_task_port (struct cmd *cmd, task_t task, mach_port_t *name)
{
- *name = task_insert_send_right (cmd->task, task->itk_sself);
+ *name = task_insert_send_right (cmd->task,
+ ipc_port_make_send(task->itk_sself));
return 0;
}
diff --git a/kern/syscall_sw.h b/kern/syscall_sw.h
index 9d28281a..80b1810b 100644
--- a/kern/syscall_sw.h
+++ b/kern/syscall_sw.h
@@ -31,6 +31,8 @@
* mach_trap_stack indicates the trap may discard
* its kernel stack. Some architectures may need
* to save more state in the pcb for these traps.
+ *
+ * Note: this is indexed manually by locore.S!
*/
typedef struct {
@@ -38,9 +40,6 @@ typedef struct {
int (*mach_trap_function)();
boolean_t mach_trap_stack;
const char *mach_trap_name;
-#ifdef __x86_64__
- long unused;
-#endif
} mach_trap_t;
extern mach_trap_t mach_trap_table[];
diff --git a/x86_64/locore.S b/x86_64/locore.S
index 3a2b3963..fd3617c5 100644
--- a/x86_64/locore.S
+++ b/x86_64/locore.S
@@ -1134,7 +1134,7 @@ syscall_native:
movb $0xf,%dh
movw %dx,0xb800c
#endif
- shll $5,%eax /* manual indexing */
+ shll $5,%eax /* manual indexing of mach_trap_t */
xorq %r10,%r10
movl EXT(mach_trap_table)(%eax),%r10d
/* get number of arguments */
diff --git a/xen/grant.c b/xen/grant.c
index 6715a374..1d6e607b 100644
--- a/xen/grant.c
+++ b/xen/grant.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <model_dep.h>
+#include <machine/model_dep.h>
#include <sys/types.h>
#include <mach/vm_param.h>
#include <machine/spl.h>
diff --git a/xen/net.c b/xen/net.c
index 4507ead3..ac8c9b1f 100644
--- a/xen/net.c
+++ b/xen/net.c
@@ -184,7 +184,7 @@ static void hyp_net_intr(int unit) {
simple_lock(&nd->lock);
if ((nd->rx.sring->rsp_prod - nd->rx.rsp_cons) >= (WINDOW*3)/4)
- printf("window %ld a bit small!\n", WINDOW);
+ printf("window %ld a bit small!\n", (long) WINDOW);
more = RING_HAS_UNCONSUMED_RESPONSES(&nd->rx);
while (more) {