aboutsummaryrefslogtreecommitdiff
path: root/i386/include
Commit message (Collapse)AuthorAgeFilesLines
* add xfloat thread state interfaceLuca Dariz2024-09-082-0/+19
| | | | | | | | | | | | | | | | | * i386/i386/fpu.c: extend current getter and setter to support the extended state; move the struct casting here to reuse the locking and allocation logic for the thread state; make sure the new state is set as valid, otherwise it won't be applied; add i386_get_xstate_size() to dynamically retrieve the FPU state size. * i386/i386/fpu.h: update prototypes to accept generic thread state * i386/i386/pcb.c: forward raw thread state to getter and setter, only checking for minimum size and use the new i386_get_xstate_size() helper. * i386/include/mach/i386/mach_i386.defs: expose the new helper i386_get_xstate_size(). * i386/include/mach/i386/thread_status.h: add interface definition for I386_XFLOAT_STATE and the corresponding data structure. Message-ID: <20240904201806.510082-1-luca@orpolo.org>
* fpu: Drop conflicting alignmentSamuel Thibault2024-07-311-1/+1
| | | | | struct i386_xfp_xstate_header header is at offset 440 of struct i386_xfp_save, so not a multiple of 64 anyway.
* Add vm_pages_physSamuel Thibault2024-01-302-0/+2
| | | | | | | | For rumpdisk to efficiently determine the physical address, both for checking whether it is below 4GiB, and for giving it to the disk driver, we need a gnumach primitive (and that is not conditioned by MACH_VM_DEBUG like mach_vm_region_info and mach_vm_object_pages_phys are).
* x86_64: Drop segments from thread statusSamuel Thibault2023-09-281-5/+5
| | | | They are useless on x86_64.
* i386_btop/ptob/trunc/round_page: Fix PAE caseSamuel Thibault2023-08-281-4/+4
| | | | We need to extend to 64bit (or keep the 64bits) before shifting.
* elf64: Update namesSamuel Thibault2023-08-121-2/+1
| | | | | | | | | Apparently the ELF world changed their mind on the naming of integers, let's get coherent with it. Elf64_Quarter (16b) disappeared, replaced by Elf64_Half (now 16b instead of Elf64_32b). And previous Elf64_Half (16b) thus now need to be Elf64_Word (16b).
* x86_64: push user's VM_MAX_ADDRESSLuca Dariz2023-05-211-8/+16
| | | | | | | * i386/include/mach/i386/vm_param.h: check for both KERNEL and USER32 to differentiate between user/kernel on x86_64, and push the upper limit of user address space to 128 TB. Message-Id: <20230521204524.492700-1-luca@orpolo.org>
* x86_64: add 64-bit syscall entry pointLuca Dariz2023-05-011-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | While theoretically we could still use the same call gate as for 32-bit userspace, it doesn't seem very common, and gcc seems to not encode properly the instruction. Instead we use syscall/sysret as other kernels (e.g. XNU,Linux). This version still has some limitations, but should be enough to start working on the 64-bit user space. * i386/i386/i386asm.sym: add more constants to fill pcb->iss * i386/i386/ldt.c: configure 64-bit syscall entry point. We can just check for the SEP bit as MSR are always available on x86_64. * i386/i386/ldt.h: swap CS/DS segments order if !USER32 as required by sysret * i386/i386/locore.h: add syscall64 prototype * i386/i386/msr.h: add MSR definitions and C read/write helpers * i386/include/mach/i386/syscall_sw.h: remove old BSD_TRAP * x86_64/Makefrag.am: selectively install syscall_sw.h depending on USER32 * x86_64/include/syscall_sw.h: add entry point template from user space * x86_64/locore.S: implement syscall64 entry point and use it when a 64-bit user-space is configured Message-Id: <20230419194703.410575-4-luca@orpolo.org>
* Add i386_fsgs_base_stateSergey Bugaev2023-04-031-0/+8
| | | | Message-Id: <20230319151017.531737-2-bugaevc@gmail.com>
* x86_64: load Elf64 bootstrap modules if ! USER32Luca Dariz2023-02-161-1/+19
| | | | | | | | | * i386/include/mach/i386/exec/elf.h: add Elf64 definitions and define common Elf structures, corresponding to 32/64 bit variants at compile time. * include/mach/exec/elf.h: add Elf64 definitions * kern/elf-load.c: use common Elf structures Message-Id: <20230216213318.2048699-2-luca@orpolo.org>
* x86_64: fix some compiler warningsLuca Dariz2023-02-161-2/+2
| | | | | | | * i386/include/mach/i386/vm_param.h: extend the vm constants to ULL on x86_64 to avoid a shift overflow warning * i386/intel/pmap.c: fix cast and unused variables Message-Id: <20230216213318.2048699-1-luca@orpolo.org>
* Rename efl to rfl for x86_64 in struct i386_thread_stateFlavio Cruz2023-02-151-1/+1
| | | | Message-Id: <Y+xwZ63X1PHDJwTX@jupiter.tail36e24.ts.net>
* Add x86_64 registers to i386_thread_stateFlavio Cruz2023-02-121-0/+28
| | | | | This is required to implement ptrace. Message-Id: <Y+kvVSoC+5bvsazl@jupiter.tail36e24.ts.net>
* move kernel virtual address space to upper addressesLuca Dariz2023-02-121-1/+1
| | | | | | | | | | | | | | | | | | * i386/i386/vm_param.h: adjust constants to the new kernel map - the boothdr.S code already sets up a temporary map to higher addresses, so we can use INIT_VM_MIN_KERNEL_ADDRESS as in xen - increase the kernel map size to accomodate for bigger structures and more memory - adjust kernel max address and directmap limit * i386/i386at/biosmem.c: enable directmap check also on x86_64 * i386/include/mach/i386/vm_param.h: increase user virtual memory limit as it's not conflicting with the kernel's anymore * i386/intel/pmap.h: adjust lin2pdenum_cont() and INTEL_PTE_PFN to the new kernel map * x86_64/Makefrag.am: change KERNEL_MAP_BASE to be above 4G, and according to mcmodel=kernel. This will allow to use the full memory address space. Message-Id: <20230212172818.1511405-10-luca@orpolo.org>
* Define rpc_vm_size_array_t and rpc_vm_offset_array_tFlavio Cruz2023-01-311-0/+3
| | | | | | | | | | When generating stubs, Mig will will take the vm_size_array_t and define the input request struct using rpc_vm_size_t since the size is variable. This will turn cause a mismatch between types (vm_size_t* vs rpc_vm_size_t*). We could also ask Mig to produce a prototype by using rpc_vm_size_t*, however we would need to change the implementation of the RPC to use rpc_* types anyway since we want to avoid another allocation of the array. Message-Id: <Y9iwScHpmsgY3V0N@jupiter.tail36e24.ts.net>
* Delete unused header cthreads.hFlavio Cruz2023-01-281-56/+0
| | | | Message-Id: <Y9S7YJWUKVEHS5CM@jupiter.tail36e24.ts.net>
* Change i386 RPC subsystem to include descriptor instead of real_descriptorFlavio Cruz2023-01-272-43/+8
| | | | | | | | | This should avoid issues with glibc and hurd as introduced in https://git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/?id=b379d5afdf65cce11426ab0349a3778b3fd632f5 since we are changing the types of the parameters when implementing the RPCs to match the previous declaration using `struct descriptor`. Message-Id: <Y9Nx/qCRtVruxGwb@jupiter.tail36e24.ts.net>
* Fix several warnings for -Wmissing-prototypes (part 2)Flavio Cruz2023-01-252-13/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | * i386/i386/io_map.c: code is unused. * i386/i386/io_perm.c: include mig prototypes. * i386/i386/mp_desc.c: Deleted interrupt_stack_alloc since it is not used. * i386/i386/seg.h: Moved descriptor structs to i386/include/mach/i386/mach_i386_types.h as that represents the interface types for RPCs. Defined aliases for real_descriptor since those are used by the i386 RPCs. Inlined many functions here too and removed seg.c. * i386/i386/seg.c: Removed. All the functions are inline now. * i386/i386/trap.c: Use static. * i386/i386/trap.h: Define missing prototypes. * i386/i386/tss.h: Use static inline for ltr. * i386/i386/user_ldt.c: Include mig prototypes. * i386/include/mach/i386/mach_i386.defs: Define real_descriptor_t types since those are used in the RPC definition. Now both prototypes and definitions will match. * i386/include/mach/i386/mach_i386_types.h: Move struct descriptor from seg.h since we need those for the RPC interfaces. Removed include of io_perm.h since it generates circular includes otherwise. * i386/intel/pmap.c: pmap_map is unused. Added static qualifier for several functions. * i386/intel/pmap.h: pmap_update_interrupt declared for non-SMP and SMP. Message-Id: <Y89+R2VekOQK4IUo@jupiter.lan>
* Use rpc_uintptr_t for protected payloads.Flavio Cruz2023-01-131-0/+2
| | | | | | | Not only is uintptr_t more accurate for what protected payloads are but we also provide compatibility for 64 + 32 bits. Also the use of natural_t in the RPC definition is wrong since it is always 32 bits. Message-Id: <Y7+LHVbmYxO/cSKs@jupiter.tail36e24.ts.net>
* Remove custom stdint.h and rely on freestanding headersFlavio Cruz2022-12-192-71/+18
| | | | | GCC already provides this so we don't need to have our own. Message-Id: <Y5+02FVA6jf4GPgA@mars>
* Use long_natural_t for recnum_tFlavio Cruz2022-12-182-21/+52
| | | | | | | | | | | | For 64 bits, device operations will provide an addressing space of 64 bits. Also define the translation functions if long_natural_t or long_integer_t are ever used in RPCs. Note that MIG does not implicitly inherit the translation functions from types hence the need to redefine them for recnum_t. Message-Id: <Y59MFzekEA0YUXIw@mars>
* Use struct for time_value_t and define seconds as long_integer_t.Flavio Cruz2022-12-172-2/+22
| | | | | | | On 64 bit kernels, seconds will be 64 bits long and won't suffer from the 2038 problem. We also add a new type rpc_time_value_t to handle the conversion between 32 bit userland and 64 bit kernel. Message-Id: <Y50kIaIgaIdGjDAk@mars>
* Define vm_size_t and vm_offset_t as __mach_uintptr_t.Flavio Cruz2022-12-061-2/+2
| | | | | | | | | | This allows *printf to use %zd/%zu/%zx to print vm_size_t and vm_offset_t. Warnings using the incorrect specifiers were fixed. Note that MACH_PORT_NULL became just 0 because GCC thinks that we were comparing a pointer to a character (due to it being an unsigned int) so I removed the explicit cast. Message-Id: <Y47UNdcUF35Ag4Vw@reue>
* Make task_info.h structs more portableFlavio Cruz2022-12-062-29/+32
| | | | | | | | | | Changed vm_size_t to rpc_size_t so that both userland and kernel agree on the same size. Also changed the denominator for the maximum struct sizes to be integer_t to match the other declarations. Introduced long_natural_t and rpc_long_natural_t to represent large counters. Replaced rpc_unsigned_long with rpc_long_natural_t. Message-Id: <Y47UhaOzKnqhgYq4@reue>
* Update mach_debug interfaces to use struct.Flavio Cruz2022-11-252-0/+16
| | | | | | | | | | | | | | | | | | | | | | The new interfaces will be compatible both with a 64 bits kernel and userland and 64 bits kernel and 32 bit userland. Also removed many of the uses of natural_t where an unsigned int suffices. Ideally we should replace natural_t with something more portable such as uintptr_t or a basic int type for counters since for the most part we don't need counters to have the same width as the pointer type. * i386/include/mach/i386/vm_types.h: Define rpc_unsigned_long. * include/mach/mach_types.defs: Define type rpc_vm_offset_t. * include/mach_debug/hash_info.h: Use unsigned int instead of natural_t. * include/mach_debug/mach_debug_types.defs: Update cache_info_t, hash_info_bucket_t, vm_region_info_t, vm_object_info_t and vm_page_info_t to use struct. * include/mach_debug/slab_info.h: Use rpc_vm_size_t and rpc_unsigned_long for compatibility with 32 bits userland. * include/mach_debug/vm_info.h: Update struct fields to use the correct types and avoid natural_t whenever we just want to keep a count of something. Message-Id: <Y32lp1SuV01ImCx9@viriathus>
* Fix inclusability of <mach/mach_types.h>Samuel Thibault2022-08-282-8/+63
| | | | | Now that mach/machine/vm_types.h uses stdint types, we have to ship a header that defines them.
* add rpc_versions for vm typesLuca Dariz2022-08-271-4/+33
| | | | | | | | | | | | | | | * vm_types.h: add new types and conversion functions * mach_types.defs: adapt vm types depending on kernel user/server * vm_info.h: adapt rpc structure to have uniformly-sized members also on 64-bit * x86_64/configfrag.c: add new option to select the user-space variant. Note that with this change the user-space interface is somehow fixed, i.e. it can't support 32-bit and 64-bit tasks at the same time. If this would be needed at some point, this change needs to be reworked. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220403145955.120742-3-luca@orpolo.org>
* cleanup multibootLuca Dariz2022-08-271-108/+2
| | | | | | | | | * use _raw_ structs where we refer to the bootloader-provided data * remove unused structures * fix 64 bit boot Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220205175129.309469-3-luca@orpolo.org>
* mach_i386: include MACH_I386_IMPORTSSamuel Thibault2022-01-011-0/+4
| | | | Like other defs header do, to allow e.g. including libports/ports.h
* memory_object_create_proxy: Make len parameter vm_size_array_tSamuel Thibault2021-10-171-0/+1
| | | | | | | | | | | This is a no-op on i386. * i386/include/mach/i386/vm_types.h (vm_size_array_t): New type. * include/mach/mach4.defs (vm_size_array_t): New type. (memory_object_create_proxy): Turn len parameter from vm_offset_array_t to vm_size_array_t. * vm/memory_object_proxy.c (memory_object_create_proxy): Turn len parameter from const vm_offset_t * to const vm_size_t *.
* x86: Move fp_reg.h static assertions to .c fileSamuel Thibault2020-12-011-2/+0
| | | | | | | | Since fp_reg.h is installed on the system, and compilers may not even support _Static_assert. * i386/include/mach/i386/fp_reg.h: Move _Static_assert to... * i386/i386/fpu.c: ... c file.
* x86: Keep fp_regs.h standaloneSamuel Thibault2020-12-011-6/+4
| | | | | | | | | We cannot include stdint.h in fp_regs.h since this is included by mach_types.h for bootstrapping, before we have stdint.h from glibc. * i386/include/mach/i386/fp_reg.h: Do not include <stdint.h> (XSAVE_XCOMP_BV_COMPACT, struct i386_xfp_xstate_header): Use unsigned long long instead of uint64_t.
* x86: Fix initialization of new threadsSamuel Thibault2020-11-291-0/+1
| | | | | | | | | | | | | | | | | | | fninit does not clear MMX/SSE/AVX registers, so we have to use rstor to clear them when starting a new thread. Along the way, we can as well just have a default state to be loaded in each new thread. * i386/include/mach/i386/fp_reg.h (XSAVE_XCOMP_BV_COMPACT): New macro. * i386/i386/fpu.h (fp_default_state): New variable declaration. * i386/i386/fpu.c (fp_default_state): New variable. (MXCSR_DEFAULT, CWD_DEFAULT): New macros. (fpu_module_init): Allocate and initialize fp_default_state. (fpinit): rstor from fp_default_state instead of setting FPU state by hand. (fp_load): Copy initial state from fp_default_state instead of setting it to 0. This is more future-proof since this is the exact state that we are loading in fpinit. (fp_state_alloc): fp_state_alloc: Copy initial state from fp_default_state.
* x86: Extend XSAVE support to unbound stateSamuel Thibault2020-11-281-5/+2
| | | | | | | | | | | | * i386/i386/fpu.c (fp_xsave_size): New variable. (init_fpu): Save XSAVE size to fp_xsave_size. (fpu_module_init): Pass fp_xsave_size as size to kmem_cache_init. (fpu_set_state, fp_load, fp_state_alloc): Use fp_xsave_size to clear ifps. * i386/include/mach/i386/fp_reg.h (struct i386_xfp_save): Replace static fp_yreg_word with extended field. * i386/i386/thread.h (struct i386_fpsave_state): Make fp_valid field first in the structure to let the extended finish the structure.
* x86: Add XSAVE supportSamuel Thibault2020-11-281-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | * i386/i386/fpu.h (CPU_XCR0_X87, CPU_XCR0_SSE, CPU_XCR0_AVX, CPU_XCR0_MPX, CPU_XCR0_AVX512): New macros. (xsave): Pass fp_xsave_support to xsave. (fpu_save_context): When fp_kind is FP_387X, use xsave. (fp_xsave_support): New variable declaration. * i386/i386/proc_reg.h (cpuid): New macro. * linux/src/include/asm-i386/processor.h (cpuid): Disable macro. * i386/include/mach/i386/fp_reg.h: Include <stdint.h> (i386_xfp_xstate_header): New structure. (i386_xfp_save): Add xsave fields. * i386/i386/fpu.c (fp_xsave_support): New variable. (init_fpu): Look for XSAVE feature; if available, get the supported parts and set fp_kind to FP_387X. (fpu_module_init): Set ifps_cache alignment to alignof(struct i386_fpsave_state). (fpu_set_state): Make sure to clear all the ifps structure. Reuse the FP_387FX for the FP_387X case. (fpu_get_state, fpexterrflt, fpastintr, fp_state_alloc): Reuse the FP_387FX for the FP_387X case. (fp_save): When fp_kind is FP_387X, use xsave. (fp_load): When fp_kind is FP_387X, use xrstor. Reuse the FP_387FX for the FP_387X case.
* fpu: Rename FP_387X to FP_387FXSamuel Thibault2020-11-281-1/+2
| | | | | | | | | | | To leave FP_387X for XSAVE-supporting CPU (as opposed to FXSAVE-supporting CPU) * i386/include/mach/i386/fp_reg.h (FP_387X): Rename to FP_387FX. (FP_387X): New macro. * i386/i386/fpu.c (init_fpu, fpu_set_state, fpu_get_state, fpexterrflt, fpastintr, fp_save, fp_load, fp_state_alloc): Update accordingly. * i386/i386/fpu.h (fpu_save_context): Likewise.
* fp_reg: update to latest SSE supported by FXSAVESamuel Thibault2020-11-281-3/+4
| | | | | | * i386/include/mach/i386/fp_reg.h (struct i386_xfp_save): Extend fp_xreg_word to 16 registers. (sizeof(struct i386_xfp_save)): Assert that it is equal to 512.
* Add vm_allocate_contiguous RPCSamuel Thibault2020-07-092-0/+10
| | | | | | | | | | | | | | | | | This allows privileged userland drivers to allocate buffers for e.g. DMA, and thus need them to be physically contiguous and get their physical address. Initial work by Zheng Da, reworked by Richard Braun, Damien Zammit, and myself. * doc/mach.texi (vm_allocate_contiguous): New RPC. * i386/include/mach/i386/machine_types.defs (rpc_phys_addr_t): New type. * i386/include/mach/i386/vm_types.h [!MACH_KERNEL] (phys_addr_t): Set type to 64bits. (rpc_phys_addr_t): New type, always 64bits. * include/mach/gnumach.defs (vm_allocate_contiguous):New RPC. * vm/vm_user.c (vm_allocate_contiguous): New function.
* x86_64: Fix userland max addressSamuel Thibault2020-04-061-0/+4
| | | | | * i386/include/mach/i386/vm_param.h (VM_MAX_ADDRESS) [__x86_64__]: Set to 0x40000000UL.
* Restore vm_size_t to natural_tSamuel Thibault2020-03-311-0/+4
| | | | | | | | | | | Plenty of places such as glibc RPC uses currently assume that vm_size_t is a natural_t (thus int on 32bit), not an unsigned long. * i386/include/mach/i386/vm_types.h (vm_size_t) [!__x86_64__]: Set type to natural_t. * device/dev_page.c (device_pager_data_request): Cast vm_size_t to unsigned long. * i386/i386at/model_dep.c (c_boot_entry): Likewise.
* 64bit: Fix vm_size_t sizeSamuel Thibault2020-03-291-1/+4
| | | | | | | | | | It needs to be able to hold > 4G size. * i386/include/mach/i386/vm_types.h (vm_size_t): Set type to unsigned long. * vm/vm_user.c (vm_read, vm_write): Fix type according to RPC. * i386/i386at/model_dep.c (c_boot_entry): Fix format. * device/dev_pager.c (device_pager_data_request): Fix format.
* multiboot.h: Add 64bit variantSamuel Thibault2020-03-281-0/+17
| | | | | * i386/include/mach/i386/multiboot.h (multiboot32_module): New structure.
* asm.h: Add 64bit variantSamuel Thibault2020-03-281-0/+27
| | | | | | * i386/include/mach/i386/asm.h (S_ARG0, S_ARG1, S_ARG2, S_ARG3, S_ARG4, S_ARG5, FRAME, EMARF, B_ARG0, B_ARG1, B_ARG2, B_ARG3, INT_FIX): Add 64bit variants.
* Restrict access to PCI cfg io ports to one processDamien Zammit2018-12-051-2/+0
| | | | | | | | | | | | | * i386/i386/io_perm.c (PCI_CFG1_START, PCI_CFG1_END, PCI_CFG2_START, PCI_CFG2_END, IS_IN_PROTECTED_RANGE): New macros. (taken_pci_cfg): New variable. (io_perm_deallocate): New function. (i386_io_perm_create): Return KERN_PROTECTION_FAILURE if requested port range contains PCI config registers and that is already taken. Set taken_pci_cfg to true when taking them. * i386/i386/io_perm.h (io_perm_deallocate): New declaration. * i386/include/mach/i386/mach_i386.defs (io_perm_t): Add io_perm_deallocate destructor.
* Add const MIG typesSamuel Thibault2018-01-281-0/+1
| | | | | | * i386/include/mach/i386/mach_i386_types.h (const_descriptor_list_t): New type. * include/mach/port.h (const_mach_port_array_t): New type.
* Set function type on symbols created by ENTRY macroSamuel Thibault2016-09-111-7/+7
| | | | | * i386/include/mach/i386/asm.h (ENTRY, ENTRY2, ASENTRY, Entry): Use .type @function on created entries.
* Use uint32_t instead of unsigned32_t.Flavio Cruz2016-04-042-26/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement stdint.h and use it in gnumach. Remove old type definitions such as signed* and unsigned*. * Makefile.am: Add -ffreestanding. * i386/i386/xen.h: Use uint64_t. * i386/include/mach/i386/machine_types.defs: Use uint32_t and int32_t. * i386/include/mach/i386/vm_types.h: Remove definitions of int*, uint*, unsigned* and signed* types. * i386/xen/xen.c: Use uint64_t. * include/device/device_types.defs: Use uint32_t. * include/mach/std_types.defs: Use POSIX types. * include/mach/std_types.h: Include stdint.h. * include/stdint.h: New file with POSIX types. * include/sys/types.h: Include stdint.h. * ipc/ipc_kmsg.c: Use uint64_t. * kern/exception.c: Use uint32_t. * linux/dev/include/linux/types.h: Remove POSIX types. * xen/block.c: Use uint64_t. * xen/net.c: Do not use removed unsigned*_t types. * xen/ring.h: Use uint32_t instead. * xen/store.c: Use uint32_t. * xen/store.h: Use uint32_t. * xen/time.c: Use POSIX types only. * xen/time.h: Use uint64_t.
* Fix early page allocation on XenRichard Braun2016-01-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | The Xen target was completely ignored when porting the biosmem and vm_page physical memory allocators. Let's fix this. * i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386at/biosmem.{c,h}. * i386/i386/vm_page.h (VM_PAGE_MAX_SEGS, VM_PAGE_DIRECTMAP_LIMIT, VM_PAGE_HIGHMEM_LIMIT): Define for Xen. * i386/i386at/biosmem.c: Include mach/xen.h. (biosmem_panic_setup_msg): Comment out for Xen since it's unused. (biosmem_map_build, biosmem_map_build_simple, biosmem_save_cmdline_sizes, biosmem_find_boot_data_update, biosmem_find_boot_data, biosmem_setup_allocator): Likewise. (biosmem_bootstrap_common): New function. (biosmem_xen_bootstrap): Likewise, for Xen. (biosmem_bootalloc): Perform bottom-up allocations for Xen. * i386/i386at/biosmem.h (biosmem_xen_bootstrap): New prototype, for Xen. * i386/i386at/model_dep.c (i386at_init): Call biosmem_xen_bootstrap instead of biosmem_bootstrap on Xen. * i386/include/mach/i386/vm_types.h (phys_addr_t): Define as an unsigned 64-bits integer when PAE is enabled.
* Use vm_page as the physical memory allocatorRichard Braun2016-01-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change replaces the historical page allocator with a buddy allocator implemented in vm/vm_page.c. This allocator allows easy contiguous allocations and also manages memory inside segments. In a future change, these segments will be used to service requests with special constraints, such as "usable for 16-bits DMA" or "must be part of the direct physical mapping". * Makefrag.am (libkernel_a_SOURCES): Add vm/vm_page.c. * i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386at/biosmem.{c,h}. * i386/i386/vm_param.h: Include kern/macros.h. (VM_PAGE_DMA_LIMIT, VM_PAGE_MAX_SEGS, VM_PAGE_DMA32_LIMIT, VM_PAGE_DIRECTMAP_LIMIT, VM_PAGE_HIGHMEM_LIMIT, VM_PAGE_SEG_DMA, VM_PAGE_SEG_DMA32, VM_PAGE_SEG_DIRECTMAP, VM_PAGE_SEG_HIGHMEM): New macros. * i386/i386at/model_dep.c: Include i386at/biosmem.h. (avail_next, avail_remaining): Remove variables. (mem_size_init): Remove function. (i386at_init): Initialize and use the biosmem module for early physical memory management. (pmap_free_pages): Return phys_last_addr instead of avail_remaining. (init_alloc_aligned): Turn into a wrapper for biosmem_bootalloc. (pmap_grab_page): Directly call init_alloc_aligned instead of pmap_next_page. * i386/include/mach/i386/vm_types.h (phys_addr_t): New type. * kern/bootstrap.c (free_bootstrap_pages): New function. (bootstrap_create): Call free_bootstrap_pages instead of vm_page_create. * kern/cpu_number.h (CPU_L1_SIZE): New macro. * kern/slab.h: Include kern/cpu_number.h. (CPU_L1_SIZE): Remove macro, moved to kern/cpu_number.h. * kern/startup.c (setup_main): Change the value of machine_info.memory_size. * linux/dev/glue/glue.h (alloc_contig_mem, free_contig_mem): Update prototypes. * linux/dev/glue/kmem.c (linux_kmem_init): Don't use defunct page queue. * linux/dev/init/main.c (linux_init): Don't free unused memory. (alloc_contig_mem, free_contig_mem): Turn into wrappers for the vm_page allocator. * linux/pcmcia-cs/glue/ds.c (PAGE_SHIFT): Don't undefine. * vm/pmap.h (pmap_startup, pmap_next_page): Remove prototypes. * vm/vm_fault.c (vm_fault_page): Update calls to vm_page_convert. * vm/vm_init.c (vm_mem_init): Call vm_page_info_all. * vm/vm_object.c (vm_object_page_map): Update call to vm_page_init. * vm/vm_page.h (vm_page_queue_free): Remove variable declaration. (vm_page_create, vm_page_release_fictitious, vm_page_release): Remove declarations. (vm_page_convert, vm_page_init): Update prototypes. (vm_page_grab_contig, vm_page_free_contig): New prototypes. * vm/vm_resident.c (vm_page_template, vm_page_queue_free, vm_page_big_pagenum): Remove variables. (vm_page_bootstrap): Update and call vm_page_setup. (pmap_steal_memory): Update and call vm_page_bootalloc. (pmap_startup, vm_page_create, vm_page_grab_contiguous_pages): Remove functions. (vm_page_init_template, vm_page_grab_contig, vm_page_free_contig): New functions. (vm_page_init): Update and call vm_page_init_template. (vm_page_release_fictitious): Make static. (vm_page_more_fictitious): Update call to vm_page_init. (vm_page_convert): Rewrite to comply with vm_page. (vm_page_grab): Update and call vm_page_alloc_pa. (vm_page_release): Update and call vm_page_free_pa.
* Import the multiboot module from X15 and relicense to GPLv2+Richard Braun2016-01-231-0/+105
| | | | * i386/include/mach/i386/multiboot.h: Merge multiboot.h from X15.