summaryrefslogtreecommitdiff
path: root/i386/i386
AgeCommit message (Collapse)Author
2015-05-23i386: avoid breaking the strict-aliasing rulesJustus Winter
* i386/i386/pcb.c (switch_ktss): Cleanly convert the value.
2015-05-19kern: import `macros.h' from x15Justus Winter
Import the macro definitions from the x15 kernel project, and replace all similar definitions littered all over the place with it. Importing this file will make importing code from the x15 kernel easier. We are already using the red-black tree implementation and the slab allocator from it, and we will import even more code in the near future. * kern/list.h: Do not define `structof', include `macros.h' instead. * kern/rbtree.h: Likewise. * kern/slab.c: Do not define `ARRAY_SIZE', include `macros.h' instead. * i386/grub/misc.h: Likewise. * i386/i386/xen.h: Do not define `barrier', include `macros.h' instead. * kern/macro_help.h: Delete file. Replaced by `macros.h'. * kern/macros.h: New file. * Makefrag.am (libkernel_a_SOURCES): Add new file, remove old file. * device/dev_master.h: Adopt accordingly. * device/io_req.h: Likewise. * device/net_io.h: Likewise. * i386/intel/read_fault.c: Likewise. * ipc/ipc_kmsg.h: Likewise. * ipc/ipc_mqueue.h: Likewise. * ipc/ipc_object.h: Likewise. * ipc/ipc_port.h: Likewise. * ipc/ipc_space.h: Likewise. * ipc/ipc_splay.c: Likewise. * ipc/ipc_splay.h: Likewise. * kern/assert.h: Likewise. * kern/ast.h: Likewise. * kern/pc_sample.h: Likewise. * kern/refcount.h: Likewise. * kern/sched.h: Likewise. * kern/sched_prim.c: Likewise. * kern/timer.c: Likewise. * kern/timer.h: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_map.h: Likewise. * vm/vm_object.h: Likewise. * vm/vm_page.h: Likewise.
2015-05-17i386: avoid compiler warningJustus Winter
* i386/i386/phys.c (pmap_zero_page, pmap_copy_page, copy_to_phys, copy_from_phys): Avoid compiler warning about `map' being used uninitialized.
2015-05-14i386: use macro to compute address of saved registersJustus Winter
* i386/i386/pcb.c (stack_attach): Use `USER_REGS'. (stack_handoff): Likewise.
2015-04-23Prepend 0x to hexadecimal offsetSamuel Thibault
* i386/i386/db_trace.c (db_i386_stack_trace): Prepend 0x to hexadecimal offset.
2015-03-08Remove spl debugging in Xen caseSamuel Thibault
xen cli/sti doesn't use IF * i386/i386/spl.S [MACH_XEN]: Disable IF check.
2015-02-20i386: specialize `copyinmsg' and `copyoutmsg'Justus Winter
Previously, `copyinmsg' was the same function as `copyin'. The former is for messages, and the size of messages is a multiple of four. Likewise for `copyoutmsg'. Provide a specialized version of both functions. This shaves off a couple of instructions and improves our IPC performance. * i386/i386/locore.S (copyinmsg): New function. (copyoutmsg): New function.
2015-02-20i386: drop needless instruction from `copyout'Justus Winter
* i386/i386/locore.S (copyout): Do not needlessly copy length to %eax first.
2015-01-02i386: Fix typos in comments (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02Handle kernel traps happening before starting userlandSamuel Thibault
* i386/i386/trap.c (kernel_trap): When current_thread is null, assume that we are in kernel land.
2014-12-15Make spl7 just clear IF instead of setting the PIC maskSamuel Thibault
* i386/i386/spl.S (spl7): Just set curr_ipl and cli. (splx) [MACH_KDB || MACH_TTD]: When curr_ipl is 7, make sure that IF is cleared. (splx): When staying at ipl7, do not enable interrupts. (spl) [MACH_KDB || MACH_TTD]: When curr_ipl is 7, make sure that IF is cleared. (spl): When new ipl is 7, branch to spl7. * i386/i386/locore.S (TIME_TRAP_UENTRY, TIME_TRAP_SENTRY): Save flags, and restore them instead of blindly using sti.
2014-11-16Only set debug registers when they are usedSamuel Thibault
* i386/i386/db_interface.c (zero_dr): New variable (db_load_context): Do not set debug registers to zero when they are already zero. (db_dr): When kernel debug registers get zero, record that the debug registers have been zeroed.
2014-09-17Report DR6 to userlandSamuel Thibault
* i386/i386/trap.c (user_trap): On T_DEBUG, record the content of dr6 in PCB, and clear it.
2014-07-06Document that io_map_cached leaks memorySamuel Thibault
2014-07-06Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/gnumachSamuel Thibault
2014-07-06i386: add io_map_cachedJustus Winter
io_map_cached is like io_map, but reuses the old mapping if it is applicable. * i386/i386/io_map.c: Add io_map_cached.
2014-06-11ddb: print task names if availableJustus Winter
* ddb/db_print.c (db_print_task): Print task name if available. * i386/i386/db_interface.c (db_task_name): Likewise. * i386/i386/db_machdep.h (DB_GNUMACH_TASK_NAME): Remove unused definition.
2014-05-27Add missing memory clobberSamuel Thibault
* i386/i386/xen.h (mb, rmb, wmb): Add memory clobber.
2014-05-03ddb: add "halt" commandJustus Winter
* ddb/db_command.c (db_command_table): Add "halt" command. * i386/i386/db_interface.h (db_halt_cpu): New declaration. * i386/i386at/model_dep.c (db_halt_cpu): New function.
2014-04-30i386: fix MACHINE_SERVER_HEADERJustus Winter
Commit b6dab094 introduced a way to include the MIG-generated server files for the machine specific interface in ipc_kobject.c. This broke out-of-tree builds. Here, 'machine' is a symlink to '../i386/i386', it points into the source tree. The MIG-generated files however are put in the build tree in i386/i386. * i386/i386/machine_routines.h (MACHINE_SERVER_HEADER): Fix path.
2014-04-30kern: include the MIG-generated server headers for MACHINE_SERVERJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the ipc_kobject_server function. * kern/ipc_kobject.c: Include the MIG-generated server headers for the machine-dependent interfaces. (ipc_kobject_server): Drop the simple declaration of MACHINE_SERVER_ROUTINE. * i386/i386/machine_routines.h (MACHINE_SERVER_HEADER): New definition.
2014-04-04Convert from K&R to ANSIMarin Ramesa
Convert from K&R style function definitions to ANSI style function definitions. * ddb/db_access.c: Convert function prototypes from K&R to ANSI. * ddb/db_aout.c: Likewise. * ddb/db_break.c: Likewise. * ddb/db_command.c: Likewise. * ddb/db_cond.c: Likewise. * ddb/db_examine.c: Likewise. * ddb/db_expr.c: Likewise. * ddb/db_ext_symtab.c: Likewise. * ddb/db_input.c: Likewise. * ddb/db_lex.c: Likewise. * ddb/db_macro.c: Likewise. * ddb/db_mp.c: Likewise. * ddb/db_output.c: Likewise. * ddb/db_print.c: Likewise. * ddb/db_run.c: Likewise. * ddb/db_sym.c: Likewise. * ddb/db_task_thread.c: Likewise. * ddb/db_trap.c: Likewise. * ddb/db_variables.c: Likewise. * ddb/db_watch.c: Likewise. * device/blkio.c: Likewise. * device/chario.c: Likewise. * device/dev_lookup.c: Likewise. * device/dev_name.c: Likewise. * device/dev_pager.c: Likewise. * device/ds_routines.c: Likewise. * device/net_io.c: Likewise. * device/subrs.c: Likewise. * i386/i386/db_interface.c: Likewise. * i386/i386/fpu.c: Likewise. * i386/i386/io_map.c: Likewise. * i386/i386/loose_ends.c: Likewise. * i386/i386/mp_desc.c: Likewise. * i386/i386/pcb.c: Likewise. * i386/i386/phys.c: Likewise. * i386/i386/trap.c: Likewise. * i386/i386/user_ldt.c: Likewise. * i386/i386at/com.c: Likewise. * i386/i386at/kd.c: Likewise. * i386/i386at/kd_event.c: Likewise. * i386/i386at/kd_mouse.c: Likewise. * i386/i386at/kd_queue.c: Likewise. * i386/i386at/lpr.c: Likewise. * i386/i386at/model_dep.c: Likewise. * i386/i386at/rtc.c: Likewise. * i386/intel/pmap.c: Likewise. * i386/intel/read_fault.c: Likewise. * ipc/ipc_entry.c: Likewise. * ipc/ipc_hash.c: Likewise. * ipc/ipc_kmsg.c: Likewise. * ipc/ipc_marequest.c: Likewise. * ipc/ipc_mqueue.c: Likewise. * ipc/ipc_notify.c: Likewise. * ipc/ipc_port.c: Likewise. * ipc/ipc_right.c: Likewise. * ipc/mach_debug.c: Likewise. * ipc/mach_msg.c: Likewise. * ipc/mach_port.c: Likewise. * ipc/mach_rpc.c: Likewise. * kern/act.c: Likewise. * kern/exception.c: Likewise. * kern/ipc_mig.c: Likewise. * kern/ipc_tt.c: Likewise. * kern/lock_mon.c: Likewise. * kern/mach_clock.c: Likewise. * kern/machine.c: Likewise. * kern/printf.c: Likewise. * kern/priority.c: Likewise. * kern/startup.c: Likewise. * kern/syscall_emulation.c: Likewise. * kern/syscall_subr.c: Likewise. * kern/thread_swap.c: Likewise. * kern/time_stamp.c: Likewise. * kern/timer.c: Likewise. * kern/xpr.c: Likewise. * vm/memory_object.c: Likewise. * vm/vm_debug.c: Likewise. * vm/vm_external.c: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_kern.c: Likewise. * vm/vm_map.c: Likewise. * vm/vm_pageout.c: Likewise. * vm/vm_user.c: Likewise.
2014-03-03Keep two virtual pages as mapping windows to access physical memorySamuel Thibault
PCI devices expose their memory etc. way beyond last_phys_addr. Userland drivers opening /dev/mem need to open those too, even if phystokv() will not work for them. * i386/intel/pmap.h (pmap_mapwindow_t): New type. (pmap_get_mapwindow, pmap_put_mapwindow): New prototypes. (PMAP_NMAPWINDOWS): New macro. * i386/intel/pmap.c (mapwindows): New array. (pmap_get_mapwindow, pmap_put_mapwindow): New functions. (pmap_bootstrap, pmap_virtual_space): Reserve virtual pages for the mapping windows. * i386/i386/phys.c: Include <i386/model_dep.h> (INTEL_PTE_W, INTEL_PTE_R): New macros (pmap_zero_page, pmap_copy_page, copy_to_phys, copy_from_phys): Use `pmap_get_mapwindow' to temporarily map physical pages beyond last_phys_addr.
2014-02-04Fix potential NULL dereferenceSamuel Thibault
Found by Coverity * i386/i386/user_ldt.c (i386_get_ldt): Fetch `pcb' field of `thread' only after looking for `thread' being NULL.
2014-02-04Fix potential NULL dereferenceSamuel Thibault
Found by Coverity * i386/i386/db_trace.c (db_find_kthread): Handle case when task is NULL.
2014-02-04Fix FPU state copy sizeSamuel Thibault
* i386/i386/fpu.c (fpu_set_state, fpu_get_state): Fix size of `user_fp_regs' access.
2014-02-04Fix FPU state accessSamuel Thibault
Found by coverity. * i386/i386/fpu.c (fpu_set_state, fpu_get_state): Fix out of bound `user_fp_regs' access.
2014-01-01Add comment after endifMarin Ramesa
* i386/i386/io_perm.h (_I386_IO_PERM_H_): Add comment after endif.
2013-12-20Declare void argument lists (part 2)Marin Ramesa
Declare void argument lists that were not declared in the first part of this patch and * kern/sched_prim.h (recompute_priorities): Fix prototype. * kern/startup.c (setup_main) (recompute_priorities): Fix call.
2013-12-17i386: qualify pointers whose dereferenced values are constant with constMarin Ramesa
2013-12-16Quiet GCC warning about uninitialized variableMarin Ramesa
* ddb/db_command.h (db_error): Mark with attribute noreturn. * i386/i386/setjmp.h (_longjmp): Likewise.
2013-12-15i386/i386/db_trace.c: use (long *) instead of an (int *)Marin Ramesa
* i386/i386/db_trace.c (db_lookup_i386_kreg) (kregp): Use (long *) instead of an (int *).
2013-12-15Type definitionMarin Ramesa
* i386/i386/ast_check.c (init_ast_check, cause_ast_check): Define return type. * i386/i386/pic.c (intnull, prtnull): Define argument types. * i386/i386at/com.c (compr_addr): Likewise. (compr): Likewise. (compr_addr): Fix printf format. * i386/i386at/kd.c (kd_cmdreg_write, kd_kbd_magic): Define argument types. * i386/i386at/kd_mouse.c (init_mouse_hw): Likewise. * ipc/mach_port.c (sact_count): Define return type. * ipc/mach_rpc.c (mach_port_rpc_sig): Define argument types. * kern/act.c (dump_act): Define return type. * kern/lock_mon.c (simple_lock, simple_lock_try, simple_unlock, lip, lock_info_sort, lock_info_clear, print_lock_info): Define return type. (time_lock): Define return type and argument type. * kern/timer.c (time_trap_uexit): Define argument type.
2013-12-15i386/i386/ldt.c: remove forward declarationMarin Ramesa
* i386/i386/ldt.c (syscall): Remove forward declaration. Include locore.h. * i386/i386/locore.h (syscall): Add prototype.
2013-12-15Declare void argument listsMarin Ramesa
2013-12-11i386/i386/db_trace.c (db_i386_stack_trace): remove unnecessary castMarin Ramesa
Argument to INKERNEL() is already cast to vm_offset_t in the macro itself. * i386/i386/db_trace.c (db_i386_stack_trace) (INKERNEL) (callpc): Don't cast to unsigned long. (db_i386_stack_trace) (INKERNEL) (frame): Likewise.
2013-12-11i386/i386/db_trace.c: remove forward declarationMarin Ramesa
* i386/Makefrag.am: List i386/i386/db_trace.h. * i386/i386/db_trace.c: Include machine/db_trace.h. (db_i386_stack_trace): Remove forward declaration. * i386/i386/db_trace.h: New file. Add copyright. [_I386_DB_TRACE_H_]: Add ifndef. (i386_frame): Declare forward. (db_i386_stack_trace): Add prototype.
2013-12-11Cleanup of the memcpy(), memmove(), memcmp() and memset() callsMarin Ramesa
Addresses were cast to (void *). Pointers uncasted. * device/ds_routines.c (ds_read_done) (memset) (start_sent): Cast to (void *) instead to (char *). Argument is an address. (ds_read_done) (memset) (end_data): Likewise. * i386/i386/pcb.c (thread_getstatus) (memcpy) (pm): Don't cast. Argument is a pointer. (thread_getstatus) (memcpy) (iopb): Likewise. * i386/i386at/immc.c (immc_cnputc) (memmove): Cast first argument to (void *). Argument is an address. (immc_cnputc) (memmove): Cast second argument to (void *). Argument is an address. (immc_cnputc) (memset): Cast first argument to (void *). Argument is an address. * i386/i386at/model_dep.c (i386at_init) (memcpy) (phystokv): Cast to (void *) instead to (char *). Argument is an address. * i386/intel/pmap.c (pmap_init) (memset) (addr): Likewise. * ipc/mach_debug.c (mach_port_space_info) (memset) (table_addr + size_used): Likewise. (mach_port_space_info) (memset) (tree_addr + size_used): Likewise. * kern/host.c (host_processor_sets) (memcpy) (newaddr): Likewise. (host_processor_sets) (memcpy) (addr): Likewise. * kern/xpr.c (xprbootstrap) (memset) (addr): Likewise. * vm/vm_debug.c (mach_vm_object_pages) (memset) (addr + size_used): Likewise.
2013-12-10i386/i386/db_interface.c: use vm_offset_t instead of an unsigned intMarin Ramesa
This is more in line with how the function db_user_to_kernel_address() is called. In this way there is one cast less and several GCC warnings are silenced. * i386/i386/db_interface.c (db_set_hw_watchpoint) (kern_addr): Use vm_offset_t instead of an unsigned int. (db_user_to_kernel_address) (kaddr): Likewise. (db_user_to_kernel_address) (ptetokv): Don't cast return value. (db_read_bytes) (kern_addr): Use vm_offset_t instead of an unsigned int. (db_write_bytes_user_space) (kern_addr): Likewise. (db_task_name) (vaddr, kaddr): Likewise. * i386/i386/db_interface.h (db_user_to_kernel_address) (kaddr): Likewise.
2013-12-10i386: move prototypes to fix implicit declaration of functionMarin Ramesa
This fixes the implicit declarations in kern/machine.c and kern/debug.c. * i386/i386/model_dep.h (halt_cpu, halt_all_cpus): Add prototypes. * i386/i386at/model_dep.h (halt_cpu, halt_all_cpus): Remove prototypes.
2013-12-09Use db_addr_t instead of db_expr_tMarin Ramesa
In this way everything falls into place and there is one cast less. Function db_task_printsym() is already always called with the cast to db_addr_t in the first argument. * ddb/db_aout.c (aout_db_line_at_pc): Use db_addr_t instead of db_expr_t. (aout_db_search_by_addr): Don't cast to vm_offset_t. Argument is already db_addr_t. * ddb/db_aout.h (aout_db_line_at_pc): Use db_addr_t instead of db_expr_t. * ddb/db_sym.c (db_task_printsym): Likewise. (db_line_at_pc): Likewise. * ddb/db_sym.h (db_task_printsym): Likewise. (db_line_at_pc): Likewise. * i386/i386/db_trace.c (db_task_printsym): Cast to db_addr_t instead of db_expr_t. Member swap_func is a pointer to void.
2013-12-09i386/i386/db_interface.c: remove forward declarationMarin Ramesa
* i386/i386/db_interface.c (db_write_bytes_user_space): Remove forward declaration. * i386/i386/db_interface.h (db_write_bytes_user_space): Add prototype.
2013-12-09i386/i386at/pic_isa.c: remove forward declarationMarin Ramesa
* i386/Makefrag.am: Include i386/i386/hardclock.h. * i386/i386/hardclock.h: New file. Add copyright. [_I386_HARDCLOCK_H_]: Add ifndef. (hardclock): Add prototype. * i386/i386at/pic_isa.c (hardclock): Remove forward declaration. Include i386/hardclock.h.
2013-12-09i386/i386/user_ldt.c: remove unused variableMarin Ramesa
* i386/i386/user_ldt.c (acc_type): Remove unused variable.
2013-12-09i386/i386/trap.c: remove unused variablesMarin Ramesa
* i386/i386/trap.c (v86_assist_on, v86_unsafe_ok, v86_do_sti_cli, v86_do_sti_immediate, cli_count, sti_count): Remove unused variables.
2013-12-08i386/i386/trap.c: remove unused variableMarin Ramesa
* i386/i386/trap.c (brb): Remove unused variable.
2013-12-08i386/i386/pit.c: remove unused variablesMarin Ramesa
* i386/i386/pit.c (pitctr1_port, pitctr2_port): Remove unused variables.
2013-12-08i386/i386/pic.c: remove unused variablesMarin Ramesa
* i386/i386/pic.c (nintr, npics): Remove unused variables.
2013-12-08i386/i386/mp_desc.c: remove unused variableMarin Ramesa
* i386/i386/mp_desc.c (avail_start): Remove unused variable.
2013-12-08i386/i386/ipl.h: remove ifdef and add ifndefMarin Ramesa
This code is used even if KERNEL is not defined. Remove the ifdef. * i386/i386/ipl.h [_I386_IPL_H_]: Add ifndef.