aboutsummaryrefslogtreecommitdiff
path: root/i386
Commit message (Collapse)AuthorAgeFilesLines
* i386: enable assertionsJustus Winter2015-08-201-8/+4
| | | | | * i386/intel/pmap.c (pmap_page_protect): Enable assertions. (phys_attribute_clear, phys_attribute_test): Likewise.
* i386: fix panic messageJustus Winter2015-08-181-1/+1
| | | | | * i386/intel/pmap.c (pmap_page_protect): Fix function name in panic message.
* i386: fix typoJustus Winter2015-07-151-1/+1
| | | | * i386/intel/pmap.c: Fix typo.
* i386: fix line wrapping in the immediate consoleJustus Winter2015-07-091-1/+1
| | | | * i386/i386at/immc.c (immc_cnputc): Fix line wrapping.
* i386: improve the immediate consoleJustus Winter2015-06-288-14/+119
| | | | | | | | | | | | | | | | | | | Improve the immediate console to the point that it can be enabled and display e.g. assertion failures from very early on (i.e. from `c_boot_entry'). * device/cons.h (romgetc, romputc): New declarations. * i386/configfrag.ac: Add configuration variable. * i386/i386at/conf.c (dev_name_list): Add entry. * i386/i386at/cons_conf.c (constab): Add entry. * i386/i386at/immc.c: Add missing includes. (immc_cnprobe, immc_cninit, immc_cngetc, immc_romputc): New functions. (immc_cnputc): Fix signature, use virtual addresses. * i386/i386at/immc.h: New file. * i386/i386at/kd.c: Use `#if ENABLE_IMMEDIATE_CONSOLE'. * i386/i386at/kd.h (kd_setpos): Add missing declaration. * i386/i386at/model_dep.c (c_boot_entry): Install immediate console as early boot console.
* i386: add commentJustus Winter2015-06-261-0/+1
| | | | * i386/i386at/model_dep.c (rebootflag): Explain flag.
* i386: avoid breaking the strict-aliasing rulesJustus Winter2015-05-231-1/+7
| | | | * i386/i386/pcb.c (switch_ktss): Cleanly convert the value.
* kern: import `macros.h' from x15Justus Winter2015-05-193-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* i386: avoid compiler warningJustus Winter2015-05-171-10/+15
| | | | | | * i386/i386/phys.c (pmap_zero_page, pmap_copy_page, copy_to_phys, copy_from_phys): Avoid compiler warning about `map' being used uninitialized.
* i386: use macro to compute address of saved registersJustus Winter2015-05-141-2/+2
| | | | | * i386/i386/pcb.c (stack_attach): Use `USER_REGS'. (stack_handoff): Likewise.
* Fix warningSamuel Thibault2015-05-021-2/+4
| | | | | * i386/i386at/rtc.c (rtcget, rtcput): Make functions take an rtc_st structure which it casts to char * itself.
* Prepend 0x to hexadecimal offsetSamuel Thibault2015-04-231-1/+1
| | | | * i386/i386/db_trace.c (db_i386_stack_trace): Prepend 0x to hexadecimal offset.
* Remove spl debugging in Xen caseSamuel Thibault2015-03-081-4/+4
| | | | | | xen cli/sti doesn't use IF * i386/i386/spl.S [MACH_XEN]: Disable IF check.
* Use printf_once instead of recoding itSamuel Thibault2015-02-262-16/+2
| | | | | * i386/i386at/kd_event.c: Call printf_once instead of recoding it. * i386/i386at/kd_mouse.c: Likewise.
* Limit printing "queue full" messagesSamuel Thibault2015-02-262-2/+16
| | | | | | * i386/i386at/kd_event.c (kbd_enqueue): Print "queue full" warning only once. * i386/i386at/kd_mouse.c (mouse_enqueue): Likewise.
* i386: specialize `copyinmsg' and `copyoutmsg'Justus Winter2015-02-201-4/+79
| | | | | | | | | | | | 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.
* i386: drop needless instruction from `copyout'Justus Winter2015-02-201-3/+2
| | | | | * i386/i386/locore.S (copyout): Do not needlessly copy length to %eax first.
* i386: Fix typos in comments (found by codespell)Stefan Weil2015-01-026-8/+8
| | | | Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Handle kernel traps happening before starting userlandSamuel Thibault2015-01-021-3/+3
| | | | | * i386/i386/trap.c (kernel_trap): When current_thread is null, assume that we are in kernel land.
* Make spl7 just clear IF instead of setting the PIC maskSamuel Thibault2014-12-152-3/+39
| | | | | | | | | | * 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.
* Only set debug registers when they are usedSamuel Thibault2014-11-161-6/+17
| | | | | | | | * 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.
* ddb: add support for ELF symbol tablesJustus Winter2014-09-171-0/+27
| | | | | | | | | | | | * ddb/db_elf.c: New file. * ddb/db_elf.h: Likewise. * Makefrag.am (libkernel_a_SOURCES): Add db_elf.{c,h}. * ddb/db_sym.c (dummy_db_sym_init): New stub db_sym_init function. (db_sym_switch): Add ELF functions. * ddb/db_sym.h (SYMTAB_ELF): New macro. (elf_db_sym_init): New declaration. * i386/i386at/model_dep.c (c_boot_entry): Get ELF section header information from the multiboot structure, and call elf_db_sym_init.
* Report DR6 to userlandSamuel Thibault2014-09-171-0/+5
| | | | | * i386/i386/trap.c (user_trap): On T_DEBUG, record the content of dr6 in PCB, and clear it.
* Fix computationSamuel Thibault2014-08-221-1/+1
| | | | * i386/i386at/com.c (comintr): Fix computation of '@'.
* Even less magic-looking control valueNeal H. Walfield2014-08-221-1/+1
| | | | * i386/i386at/com.c (comintr): Use 'A'-1 instead of '@'.
* Support invoking the debugger over the serial consoleJustus Winter2014-08-222-1/+30
| | | | | | * i386/i386at/com.c (comintr): Invoke the debugger if ctrl-alt-d is pressed. * i386/i386at/com.h (kdb_kintr): Add declaration.
* Drop debugging printsSamuel Thibault2014-07-251-3/+0
| | | | | * i386/i386at/acpi.c (grub_machine_acpi_get_rsdpv2): Drop debugging prints.
* Do not unmap page 0 when not neededSamuel Thibault2014-07-063-0/+8
| | | | | | | | | | | Since we need it to access some BIOS information, e.g. at ACPI shutdown. When the kernel VM is not starting at 0, there is already nothing mapped there in user tasks, anyway. * i386/i386at/model_dep.c (machine_init) [VM_MIN_KERNEL_ADDRESS != 0]: Do not call pmap_unmap_page_zero. * i386/intel/pmap.c (pmap_unmap_page_zero): Warn that unmapping page zero may break some BIOS functions.
* Document that io_map_cached leaks memorySamuel Thibault2014-07-062-0/+5
|
* Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/gnumachSamuel Thibault2014-07-063-21/+44
|\
| * i386: remap some keysJustus Winter2014-06-111-0/+33
| | | | | | | | | | | | | | As a convenience for the nice people using our debugger, remap some keys to the readline-like shortcuts supported by dde. * i386/i386at/kd.c (kdcnmaygetc): Remap some keys.
| * i386: reformat the key mapJustus Winter2014-06-111-18/+9
| | | | | | | | | | | | * i386/i386at/kd.c (key_map): Remove superfluous newlines so that every entry fits into one line. This way line numbers can be used as an index into the map.
| * ddb: print task names if availableJustus Winter2014-06-112-3/+2
| | | | | | | | | | | | * 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.
* | i386: use ACPI to power off the machineJustus Winter2014-07-0619-0/+2196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a mostly verbatim copy of acpihalt.c from GRUB2 with a little bit of glue code. * i386/Makefrag.am (libkernel_a_SOURCES): Add the new files. * i386/grub/acpi.h: Verbatim copy from GRUB2. * i386/grub/compiler.h: Likewise. * i386/grub/cpu/io.h: Likewise. * i386/grub/cpu/time.h: Likewise. * i386/grub/cpu/types.h: Likewise. * i386/grub/err.h: Likewise. * i386/grub/misc.h: Likewise. * i386/grub/mm.h: Likewise. * i386/grub/symbol.h: Likewise. * i386/grub/time.h: Likewise. * i386/grub/types.h: Likewise. * i386/i386at/acpi.c: Likewise. * i386/i386at/acpihalt.c: Likewise. (grub_acpi_halt): Map physical addresses. * i386/i386at/acpihalt.h: New file. * i386/grub/glue.h: Some glue macros. * i386/grub/i18n.h: Stub out i18n. * i386/i386at/grub_glue.c: Some glue code. * i386/i386at/model_dep.c (halt_all_cpus): Use grub_acpi_halt.
* | i386: add io_map_cachedJustus Winter2014-07-061-0/+29
| | | | | | | | | | | | | | 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.
* | Add missing memory clobberSamuel Thibault2014-05-271-1/+1
|/ | | | * i386/i386/xen.h (mb, rmb, wmb): Add memory clobber.
* Rewrite old-style #endif FOO directivesJustus Winter2014-05-251-1/+1
| | | | | | | | | | | | | | | | * i386/include/mach/i386/cthreads.h: Rewrite old-style #endif FOO directives. * include/device/tape_status.h: Likewise. * include/mach/alert.h: Likewise. * include/mach/boot.h: Likewise. * include/mach/default_pager_types.defs: Likewise. * include/mach/default_pager_types.h: Likewise. * include/mach/multiboot.h: Likewise. * include/mach/notify.defs: Likewise. * include/mach_debug/pc_info.h: Likewise. * kern/act.h: Likewise. * kern/refcount.h: Likewise. * kern/shuttle.h: Likewise.
* ddb: add "halt" commandJustus Winter2014-05-032-0/+7
| | | | | | * 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.
* i386: fix MACHINE_SERVER_HEADERJustus Winter2014-04-301-1/+1
| | | | | | | | | | | 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.
* kern: include the MIG-generated server headers for MACHINE_SERVERJustus Winter2014-04-301-0/+1
| | | | | | | | | | | | | | 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.
* Convert from K&R to ANSIMarin Ramesa2014-04-0419-390/+319
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use explicit prototypes for struct dev_ops fieldsMarin Ramesa2014-04-0415-51/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * device/conf.h: Include <sys/types.h>, <mach/port.h>, <mach/vm_prot.h>. Predefine struct io_req, io_req_t and io_return_t. (dev_ops): Add explicit prototypes for d_open, d_close, d_read, d_write, d_getstat, d_setstat, d_mmap, d_port_death. (nulldev_open, nulldev_close, nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath): Add prototypes. (nomap): Fix prototype. * device/dev_name.c (nulldev_open, nulldev_close, nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath): New functions. (nomap): Fix prototype. * device/ds_routines.c (dev_close): Pass 0 as flag parameter. * device/kmsg.c (kmsgclose): Drop return value. * device/kmsg.h (kmsgclose): Fix prototype. * i386/i386at/com.c (comopen): Fix prototype. (comclose): Fix prototype, drop return value. (comread, comwrite): Fix prototype. * i386/i386at/com.h (comopen, comclose, comread, comwrite): Fix prototype. * i386/i386at/conf.c (dev_ops): Use nulldev_open, nulldev_close, nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath where appropriate. * i386/i386at/kd.c (kdclose, kdread, kdwrite, kdmmap): Fix prototype. * i386/i386at/kd.h (kdclose, kdread, kdwrite, kdmmap): Likewise. * i386/i386at/kd_event.c (kbdopen): Likewise. * i386/i386at/kd_event.h (kbdopen): Likewise. * i386/i386at/kd_mouse.c (mouseopen): Likewise. * i386/i386at/kd_mouse.h (mouseopen): Likewise. * i386/i386at/lpr.c (lpropen, lprclose, lprread, lprwrite): Likewise. * i386/i386at/lpr.h (lpropen, lprclose, lprread, lprwrite): Likewise. * i386/i386at/mem.c (memmmap): Likewise. * i386/i386at/mem.h (memmmap): Likewise. * i386/i386at/model_dep.c (timemmap): Likewise. * i386/i386at/model_dep.h (timemmap): Likewise. * kern/mach_clock.c (timeopen, timeclose): Likewise. * kern/mach_clock.h: Include <sys/types.h>, predefine struct io_req and io_req_t. (timeopen, timeclose): Fix prototype.
* Assume EGA/VGA cardSamuel Thibault2014-03-281-0/+3
| | | | | | | | CGA and MONO cards are more than hard to find nowadays, and some buggy BIOSes claim running them nowadays... * i386/i386at/kd.c (kd_xga_init): Do not handle CGA and MONO cases any more, which thus default to EGA/VGA.
* Really default to EGA/VGA on unknown CMOS valuesSamuel Thibault2014-03-281-2/+3
| | | | | * i386/i386at/kd.c (kd_xga_init): Use CM_EGA_VGA behavior as default case for unknown values of CMOS data.
* Fix overflowSamuel Thibault2014-03-221-1/+1
| | | | | | | | We were filling much more than the mapwindows array, thus overwriting in at least debugger variables. * i386/intel/pmap.c (pmap_bootstrap): Make sure to limit mapwindows initialization within PMAP_NMAPWINDOWS.
* Keep two virtual pages as mapping windows to access physical memorySamuel Thibault2014-03-033-5/+127
| | | | | | | | | | | | | | | | | | 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.
* Fix comstart when the queue is emptySamuel Thibault2014-02-041-1/+3
| | | | | | | Found by Coverity * i386/i386at/com.c (comstart): Make `nch' an int. When `getc' returns -1, just return.
* Fix potential NULL dereferenceSamuel Thibault2014-02-041-1/+2
| | | | | | | Found by Coverity * i386/i386/user_ldt.c (i386_get_ldt): Fetch `pcb' field of `thread' only after looking for `thread' being NULL.
* Fix potential NULL dereferenceSamuel Thibault2014-02-041-0/+2
| | | | | | Found by Coverity * i386/i386/db_trace.c (db_find_kthread): Handle case when task is NULL.
* Fix potential NULL dereferenceSamuel Thibault2014-02-041-0/+2
| | | | | | | Found by Coverity. * i386/i386at/com.c (comopen): On com_reprobe() returning success, check for `isai' again.