diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-03-29 12:46:26 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-03-29 12:46:26 +0200 |
commit | b9d4a675c8a9c265c0fe07d467d84c5c9af954b4 (patch) | |
tree | 4eb77bc1a7a70051fbf15a6c7c114c116b3b171f | |
parent | 13c33ac42258f6fff2ffdfb0c5ff46b41f6d11fe (diff) | |
parent | 1e90662dd80c64de27b432c9d6911fad937da804 (diff) |
Merge branch 'master' into master-x86_64
-rw-r--r-- | device/dev_pager.c | 2 | ||||
-rw-r--r-- | i386/i386/db_interface.c | 12 | ||||
-rw-r--r-- | i386/i386/gdt.c | 10 | ||||
-rw-r--r-- | i386/i386/ktss.c | 4 | ||||
-rw-r--r-- | i386/i386/ldt.c | 4 | ||||
-rw-r--r-- | i386/i386/mp_desc.c | 3 | ||||
-rw-r--r-- | i386/i386at/biosmem.c | 5 | ||||
-rw-r--r-- | i386/i386at/com.c | 12 | ||||
-rw-r--r-- | i386/i386at/model_dep.c | 2 | ||||
-rw-r--r-- | i386/include/mach/i386/vm_types.h | 5 | ||||
-rw-r--r-- | include/inttypes.h | 62 | ||||
-rw-r--r-- | ipc/mach_port.c | 4 | ||||
-rw-r--r-- | vm/vm_user.c | 4 |
13 files changed, 108 insertions, 21 deletions
diff --git a/device/dev_pager.c b/device/dev_pager.c index 0680b5aa..84db5ed8 100644 --- a/device/dev_pager.c +++ b/device/dev_pager.c @@ -328,7 +328,7 @@ kern_return_t device_pager_data_request( dev_pager_t ds; if (device_pager_debug) - printf("(device_pager)data_request: pager=%p, offset=0x%lx, length=0x%x\n", + printf("(device_pager)data_request: pager=%p, offset=0x%lx, length=0x%lx\n", pager, offset, length); ds = dev_pager_hash_lookup(pager); diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c index 0acca64f..62fdcf24 100644 --- a/i386/i386/db_interface.c +++ b/i386/i386/db_interface.c @@ -125,7 +125,7 @@ kern_return_t db_set_debug_state( struct i386_saved_state *i386_last_saved_statep; struct i386_saved_state i386_nested_saved_state; -unsigned i386_last_kdb_sp; +uintptr_t i386_last_kdb_sp; extern thread_t db_default_thread; @@ -289,7 +289,7 @@ kdb_trap( #endif /* NCPUS > 1 */ { i386_last_saved_statep = regs; - i386_last_kdb_sp = (unsigned) &type; + i386_last_kdb_sp = (uintptr_t) &type; /* XXX Should switch to ddb`s own stack here. */ @@ -298,7 +298,7 @@ kdb_trap( /* * Kernel mode - esp and ss not saved */ - ddb_regs.uesp = (int)®s->uesp; /* kernel stack pointer */ + ddb_regs.uesp = (uintptr_t)®s->uesp; /* kernel stack pointer */ ddb_regs.ss = KERNEL_DS; } @@ -368,12 +368,12 @@ kdb_kentry( #endif /* NCPUS > 1 */ { if ((is->cs & 0x3) != KERNEL_RING) { - ddb_regs.uesp = ((int *)(is+1))[0]; - ddb_regs.ss = ((int *)(is+1))[1]; + ddb_regs.uesp = *(uintptr_t *)(is+1); + ddb_regs.ss = *(int *)((uintptr_t *)(is+1)+1); } else { ddb_regs.ss = KERNEL_DS; - ddb_regs.uesp= (int)(is+1); + ddb_regs.uesp= (uintptr_t)(is+1); } ddb_regs.efl = is->efl; ddb_regs.cs = is->cs; diff --git a/i386/i386/gdt.c b/i386/i386/gdt.c index bc36031b..fb18360e 100644 --- a/i386/i386/gdt.c +++ b/i386/i386/gdt.c @@ -33,6 +33,7 @@ #include <mach/machine/vm_types.h> #include <mach/xen.h> +#include <kern/assert.h> #include <intel/pmap.h> #include "vm_param.h" @@ -49,6 +50,14 @@ void gdt_init(void) { /* Initialize the kernel code and data segment descriptors. */ +#ifdef __x86_64__ + assert(LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS == 0); + fill_gdt_descriptor(KERNEL_CS, 0, 0, ACC_PL_K|ACC_CODE_R, SZ_64); + fill_gdt_descriptor(KERNEL_DS, 0, 0, ACC_PL_K|ACC_DATA_W, SZ_64); +#ifndef MACH_PV_DESCRIPTORS + fill_gdt_descriptor(LINEAR_DS, 0, 0, ACC_PL_K|ACC_DATA_W, SZ_64); +#endif /* MACH_PV_DESCRIPTORS */ +#else fill_gdt_descriptor(KERNEL_CS, LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS, LINEAR_MAX_KERNEL_ADDRESS - (LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) - 1, @@ -63,6 +72,7 @@ gdt_init(void) 0xffffffff, ACC_PL_K|ACC_DATA_W, SZ_32); #endif /* MACH_PV_DESCRIPTORS */ +#endif #ifdef MACH_PV_DESCRIPTORS unsigned long frame = kv_to_mfn(gdt); diff --git a/i386/i386/ktss.c b/i386/i386/ktss.c index 21d00300..62de2a27 100644 --- a/i386/i386/ktss.c +++ b/i386/i386/ktss.c @@ -51,6 +51,10 @@ ktss_init(void) if (hyp_stack_switch(KERNEL_DS, (unsigned long)(exception_stack+1024))) panic("couldn't register exception stack\n"); #else /* MACH_RING1 */ + +#ifdef __x86_64__ +#warning FIXME +#endif /* Initialize the master TSS descriptor. */ fill_gdt_descriptor(KERNEL_TSS, kvtolin(&ktss), sizeof(struct task_tss) - 1, diff --git a/i386/i386/ldt.c b/i386/i386/ldt.c index 0250ee26..99d2f7fe 100644 --- a/i386/i386/ldt.c +++ b/i386/i386/ldt.c @@ -47,6 +47,10 @@ struct real_descriptor ldt[LDTSZ]; void ldt_init(void) { +#ifdef __x86_64__ +#warning FIXME +#endif + #ifdef MACH_PV_DESCRIPTORS #ifdef MACH_PV_PAGETABLES pmap_set_page_readwrite(ldt); diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c index 6aa8e664..d62d4958 100644 --- a/i386/i386/mp_desc.c +++ b/i386/i386/mp_desc.c @@ -146,6 +146,9 @@ mp_desc_init(int mycpu) #ifdef MACH_RING1 panic("TODO %s:%d\n",__FILE__,__LINE__); #else /* MACH_RING1 */ +#ifdef __x86_64__ +#warning FIXME +#endif fill_descriptor(&mpt->gdt[sel_idx(KERNEL_LDT)], (unsigned)&mpt->ldt, LDTSZ * sizeof(struct real_descriptor) - 1, diff --git a/i386/i386at/biosmem.c b/i386/i386at/biosmem.c index 28b6fb83..9f86b66a 100644 --- a/i386/i386at/biosmem.c +++ b/i386/i386at/biosmem.c @@ -16,6 +16,7 @@ */ #include <string.h> +#include <inttypes.h> #include <i386/model_dep.h> #include <i386at/biosmem.h> #include <kern/assert.h> @@ -829,7 +830,7 @@ biosmem_map_show(void) for (entry = biosmem_map, end = entry + biosmem_map_size; entry < end; entry++) - printf("biosmem: %018llx:%018llx, %s\n", entry->base_addr, + printf("biosmem: %018"PRIx64":%018"PRIx64", %s\n", entry->base_addr, entry->base_addr + entry->length, biosmem_type_desc(entry->type)); @@ -857,7 +858,7 @@ biosmem_load_segment(struct biosmem_segment *seg, uint64_t max_phys_end) return; } - printf("biosmem: warning: segment %s truncated to %#llx\n", + printf("biosmem: warning: segment %s truncated to %#"PRIx64"\n", vm_page_seg_name(seg_index), max_phys_end); phys_end = max_phys_end; } diff --git a/i386/i386at/com.c b/i386/i386at/com.c index 4689e30d..2bdbc0d0 100644 --- a/i386/i386at/com.c +++ b/i386/i386at/com.c @@ -368,7 +368,7 @@ io_return_t comopen( /*rvb tp->t_state |= TS_WOPEN; */ if ((tp->t_state & TS_ISOPEN) == 0) comparam(unit); - addr = (int)tp->t_addr; + addr = (uintptr_t)tp->t_addr; s = spltty(); if (!comcarrier[unit]) /* not originating */ @@ -405,7 +405,7 @@ dev_t dev; int flag; { struct tty *tp = &com_tty[minor(dev)]; - u_short addr = (int)tp->t_addr; + u_short addr = (uintptr_t)tp->t_addr; ttyclose(tp); if (tp->t_state&TS_HUPCLS || (tp->t_state&TS_ISOPEN)==0) { @@ -572,7 +572,7 @@ static void comparam(int unit) { struct tty *tp = &com_tty[unit]; - u_short addr = (int)tp->t_addr; + u_short addr = (uintptr_t)tp->t_addr; spl_t s = spltty(); int mode; @@ -672,7 +672,7 @@ comst_3++; comst_4++; return(0); } - outb(TXRX((int)tp->t_addr), nch); + outb(TXRX((uintptr_t)tp->t_addr), nch); } #else nch = getc(&tp->t_outq); @@ -684,7 +684,7 @@ comst_4++; comst_4++; return; } - outb(TXRX((int)tp->t_addr), nch); + outb(TXRX((uintptr_t)tp->t_addr), nch); tp->t_state |= TS_BUSY; #endif } @@ -709,7 +709,7 @@ comtimer(void * param) /* Its stuck */ printf("Tty %p was stuck\n", tp); nch = getc(&tp->t_outq); - outb(TXRX((int)tp->t_addr), nch); + outb(TXRX((uintptr_t)tp->t_addr), nch); } splx(s); diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index 02adec17..72798fd4 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -574,7 +574,7 @@ void c_boot_entry(vm_offset_t bi) strtab_size = (vm_offset_t)phystokv(boot_info.syms.a.strsize); kern_sym_end = kern_sym_start + 4 + symtab_size + strtab_size; - printf("kernel symbol table at %08lx-%08lx (%d,%d)\n", + printf("kernel symbol table at %08lx-%08lx (%ld,%ld)\n", kern_sym_start, kern_sym_end, symtab_size, strtab_size); } diff --git a/i386/include/mach/i386/vm_types.h b/i386/include/mach/i386/vm_types.h index 4e259f9b..78fb805b 100644 --- a/i386/include/mach/i386/vm_types.h +++ b/i386/include/mach/i386/vm_types.h @@ -48,6 +48,9 @@ * a port in user space as an integer and * in kernel space as a pointer. */ +#ifdef __x86_64__ +// unsigned long ? +#endif typedef unsigned int natural_t; /* @@ -80,7 +83,7 @@ typedef unsigned long phys_addr_t; * expressing the difference between two * vm_offset_t entities. */ -typedef natural_t vm_size_t; +typedef unsigned long vm_size_t; #endif /* __ASSEMBLER__ */ diff --git a/include/inttypes.h b/include/inttypes.h new file mode 100644 index 00000000..ebafb67a --- /dev/null +++ b/include/inttypes.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Mach. + * + * GNU Mach is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _INTTYPES_H_ +#define _INTTYPES_H_ + +#include <stdint.h> + +#ifdef __x86_64__ +#define __64PREFIX "l" +#else +#define __64PREFIX "ll" +#endif + +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 __64PREFIX"d" +#define PRIdPTR __64PREFIX"d" + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 __64PREFIX"i" +#define PRIiPTR __64PREFIX"i" + +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 __64PREFIX"u" +#define PRIuPTR __64PREFIX"u" + +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 __64PREFIX"x" +#define PRIxPTR __64PREFIX"x" + +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 __64PREFIX"x" +#define PRIxPTR __64PREFIX"x" + +#endif /* _INTTYPES_H_ */ diff --git a/ipc/mach_port.c b/ipc/mach_port.c index b1379b79..0757bb84 100644 --- a/ipc/mach_port.c +++ b/ipc/mach_port.c @@ -550,7 +550,7 @@ mach_port_destroy( kr = ipc_right_lookup_write(space, name, &entry); if (kr != KERN_SUCCESS) { if (MACH_PORT_VALID (name) && space == current_space()) { - printf("task %.*s destroying a bogus port %lu, most probably a bug.\n", sizeof current_task()->name, current_task()->name, (unsigned long) name); + printf("task %.*s destroying a bogus port %lu, most probably a bug.\n", (int) sizeof current_task()->name, current_task()->name, (unsigned long) name); if (mach_port_deallocate_debug) SoftDebugger("mach_port_deallocate"); } @@ -594,7 +594,7 @@ mach_port_deallocate( kr = ipc_right_lookup_write(space, name, &entry); if (kr != KERN_SUCCESS) { if (MACH_PORT_VALID (name) && space == current_space()) { - printf("task %.*s deallocating a bogus port %lu, most probably a bug.\n", sizeof current_task()->name, current_task()->name, (unsigned long) name); + printf("task %.*s deallocating a bogus port %lu, most probably a bug.\n", (int) sizeof current_task()->name, current_task()->name, (unsigned long) name); if (mach_port_deallocate_debug) SoftDebugger("mach_port_deallocate"); } diff --git a/vm/vm_user.c b/vm/vm_user.c index b6a069a5..92b1e494 100644 --- a/vm/vm_user.c +++ b/vm/vm_user.c @@ -242,7 +242,7 @@ kern_return_t vm_read( vm_address_t address, vm_size_t size, pointer_t *data, - vm_size_t *data_size) + mach_msg_type_number_t *data_size) { kern_return_t error; vm_map_copy_t ipc_address; @@ -265,7 +265,7 @@ kern_return_t vm_write( vm_map_t map, vm_address_t address, pointer_t data, - vm_size_t size) + mach_msg_type_number_t size) { if (map == VM_MAP_NULL) return KERN_INVALID_ARGUMENT; |