Commit graph

2920 commits

Author SHA1 Message Date
Erik van der Kouwe ff835e0e35 use the verbose=2 boot monitor setting to get extensive output for debugging 2010-02-13 22:11:16 +00:00
Kees van Reeuwijk df60646f98 Undo the use of #include <...> because it caused some errors. 2010-02-12 14:43:18 +00:00
Tomas Hruby b5e7af96c9 top update
- it works with the new TSC based time accounting
2010-02-10 15:38:27 +00:00
Tomas Hruby 1b56fdb33c Time accounting based on TSC
- as thre are still KERNEL and IDLE entries, time accounting for
  kernel and idle time works the same as for any other process

- everytime we stop accounting for the currently running process,
  kernel or idle, we read the TSC counter and increment the p_cycles
  entry.

- the process cycles inherently include some of the kernel cycles as
  we can stop accounting for the process only after we save its
  context and we start accounting just before we restore its context

- this assumes that the system does not scale the CPU frequency which
  will be true for ... long time ;-)
2010-02-10 15:36:54 +00:00
Ben Gras f08f2bd88c new free_contig() and changes to make drivers use it; so now we
have malloc/free, alloc_contig/free_contig and mmap/munmap nicely
paired up.

memory uses malloc/free instead of mmap/munmap as it doesn't have
to be contiguous for the ramdisks (and it might help if it doesn't!).
2010-02-10 13:56:26 +00:00
Tomas Hruby 49284caf2a Fixes broken orinoco compilation in r6119 2010-02-09 16:43:34 +00:00
Tomas Hruby d845891a50 And of course, as much as I've tried to be careful I forgot to add this file in
r6116 :(
2010-02-09 15:36:29 +00:00
Tomas Hruby c9da61022b intr_disabled() tests removed
- we don't need to test this in kernel as we always have interrupts
  disabled

- if interrupts are enabled in kernel, it is only at very carefully
  chosen places. There are no such places now.
2010-02-09 15:29:58 +00:00
Tomas Hruby c6fec6866f No locking in kernel code
- No locking in RTS_(UN)SET macros

- No lock_notify()

- Removed unused lock_send()

- No lock/unlock macros anymore
2010-02-09 15:26:58 +00:00
Kees van Reeuwijk 064cb7583a Lots of small code cleanup: make symbols local, remove unused symbols,
fixed a typo, removed a now unused header file.
Use #include <..> for header files that represent libraries.
2010-02-09 15:23:38 +00:00
Tomas Hruby 391fd926ff TASK_PRIVILEGE and level0() removed
- there are no tasks running, we don't need TASK_PRIVILEGE priviledge anymore

- as there is no ring 1 anymore, there is no need for level0() to call sensitive
  code from ring 1 in ring 0

- 286 related macros removed as clean up
2010-02-09 15:23:31 +00:00
Tomas Hruby ebba20a65d No CLOCK task
- no kernel tasks are runnable

- clock initialization moved to the end of main()

- the rest of the body of clock_task() is moved to bsp_timer_int_handler() as
  for now we are going to handle this on the bootstrap cpu. A change later is
  possible.
2010-02-09 15:22:43 +00:00
Tomas Hruby 728f0f0c49 Removal of the system task
* Userspace change to use the new kernel calls

	- _taskcall(SYSTASK...) changed to _kernel_call(...)

	- int 32 reused for the kernel calls

	- _do_kernel_call() to make the trap to kernel

	- kernel_call() to make the actuall kernel call from C using
	  _do_kernel_call()

	- unlike ipc call the kernel call always succeeds as kernel is
	  always available, however, kernel may return an error

* Kernel side implementation of kernel calls

	- the SYSTEm task does not run, only the proc table entry is
	  preserved

	- every data_copy(SYSTEM is no data_copy(KERNEL

	- "locking" is an empty operation now as everything runs in
	  kernel

	- sys_task() is replaced by kernel_call() which copies the
	  message into kernel, dispatches the call to its handler and
	  finishes by either copying the results back to userspace (if
	  need be) or by suspending the process because of VM

	- suspended processes are later made runnable once the memory
	  issue is resolved, picked up by the scheduler and only at
	  this time the call is resumed (in fact restarted) which does
	  not need to copy the message from userspace as the message
	  is already saved in the process structure.

	- no ned for the vmrestart queue, the scheduler will restart
	  the system calls

	- no special case in do_vmctl(), all requests remove the
	  RTS_VMREQUEST flag
2010-02-09 15:20:09 +00:00
Tomas Hruby 5e57818431 copy_msg_from_user() and copy_msg_to_user()
- copies a mesage from/to userspace without need of translating
  addresses

- the assumption is that the address space is installed, i.e. ldt and
  cr3 are loaded correctly

- if a pagefault or a general protection occurs while copying from
  userland to kernel (or vice versa) and error is returned which gives
  the caller a chance to respond in a proper way

- error happens _only_ because of a wrong user pointer if the function
  is used correctly

- if the prerequisites of the function do no hold, the function will
  most likely fail as the user address becomes random
2010-02-09 15:15:45 +00:00
Tomas Hruby ad9ba944d1 Early address space switch
- switch_address_space() implements a switch of the user address space
  for the destination process

- this makes memory of this process easily accessible, e.g. a pointer
  valid in the userspace can be used with a little complexity to
  access the process's memory

- the switch does not happed only just before we return to userspace,
  however, it happens right after we know which process we are going
  to schedule. This happens before we start processing the misc flags
  of this process so its memory is available

- if the process becomes not runnable while processing the mics flags
  we pick a new process and we switch the address space again which
  introduces possibly a little bit more overhead, however, it is
  hopefully hidden by reducing the overheads when we actually access
  the memory
2010-02-09 15:13:52 +00:00
Tomas Hruby b14a86ca5c Sys calls are called ipc calls now
- the syscalls are pretty much just ipc calls, however, sendrec() is
  used to implement system task (sys) calls

- sendrec() won't be used anymore for this, therefore ipc calls will
  become pure ipc calls
2010-02-09 15:13:07 +00:00
Tomas Hruby 8a03d497b8 System task initialization moved to main()
- the system task initialization code does not really need to be part
  of the system task process. An earlier initialization in kernel is
  cleaner as it does not only initialize the syscalls but also irq
  hooks etc.
2010-02-09 15:12:20 +00:00
David van Moolenbroek bdd4f5857f Fixes for truncate system calls:
- VFS: check for negative sizes in all truncate calls
- VFS: update file size after truncating with fcntl(F_FREESP)
- VFS: move pos/len checks for F_FREESP with l_len!=0 from FS to VFS
- MFS: do not zero data block for small files when fully truncating
- MFS: do not write out freed indirect blocks after freeing space
- MFS: make truncate work correctly with differing zone/block sizes
- tests: add new test50 for truncate call family
2010-02-09 08:12:37 +00:00
David van Moolenbroek f029b0e0b1 Kernel: fix sys_irqctl(IRQ_RMPOLICY) 2010-02-09 08:07:47 +00:00
David van Moolenbroek 448f4305e2 a.out.h typo (Bug#398, reported by 7shi) 2010-02-07 12:01:37 +00:00
Tomas Hruby c5001b0a5f gas2ack fix
- fixed handling of segment overrides for instruction that may use two
  of them in the long format, e.g. movs
2010-02-05 13:53:10 +00:00
Erik van der Kouwe d70e7ff3b6 Fixes in mkdep.1, suggested by Greg King 2010-02-05 13:07:08 +00:00
Ben Gras 157e82e76a philip's inet tcp fix. 2010-02-04 22:06:10 +00:00
Ben Gras cb2ee95cf9 only check local benchmark dir if it exists 2010-02-04 18:15:10 +00:00
Ben Gras 4876a324ab also be able to run benchmarks from packages. 2010-02-04 17:52:38 +00:00
Arun Thomas 4b02d003db Import NetBSD's make 2010-02-04 16:52:54 +00:00
Tomas Hruby 8f82633fa2 Removed useless global variable sys_call_code
- we have to same information in the message (m_ptr) where needed
2010-02-03 18:17:01 +00:00
Ben Gras 15b0595013 makefile for benchmarks. 2010-02-03 16:49:15 +00:00
Ben Gras d6598cc7cd fix for asmconv - stop translating after .sect .end. 2010-02-03 16:03:00 +00:00
Ben Gras f28a0a5258 remove traces of benchmarks from test/. 2010-02-03 14:32:36 +00:00
Ben Gras ffb97108c9 move benchmarks to their own dir. 2010-02-03 14:30:02 +00:00
Ben Gras 0985235ba0 forget difference between big and small commands - obsolete with vm. 2010-02-03 14:16:51 +00:00
Erik van der Kouwe 7c9fe576a8 Throw out getpack, replace printenv with a link to env 2010-02-03 13:51:26 +00:00
Ben Gras 35b471ad94 removal of unused vm<->vfs code. 2010-02-03 13:35:17 +00:00
Ben Gras 3bcfb76e45 small asmconv cleanups.
- put asmconv in /usr/bin so it can be invoked without absolute path
 - make it ignore .end in gnu output mode so that it can be invoked
   without '|| true' in the gnu lib makefiles and it doesn't produce the
   messy error message
2010-02-03 13:29:14 +00:00
David van Moolenbroek c7f1b547cb Statistical profiling fixes:
- PM: get rid of umap warning
- sprofalyze.pl: update with recently added servers and drivers
- sprofalyze.pl: properly truncate process names for sample matching
2010-02-03 12:27:52 +00:00
Tomas Hruby cca24d06d8 This patch removes the global variables who_p and who_e from the
kernel (sys task).  The main reason is that these would have to become
cpu local variables on SMP.  Once the system task is not a task but a
genuine part of the kernel there is even less reason to have these
extra variables as proc_ptr will already contain all neccessary
information. In addition converting who_e to the process pointer and
back again all the time will be avoided.

Although proc_ptr will contain all important information, accessing it
as a cpu local variable will be fairly expensive, hence the value
would be assigned to some on stack local variable. Therefore it is
better to add the 'caller' argument to the syscall handlers to pass
the value on stack anyway. It also clearly denotes on who's behalf is
the syscall being executed.

This patch also ANSIfies the syscall function headers.

Last but not least, it also fixes a potential bug in virtual_copy_f()
in case the check is disabled. So far the function in case of a
failure could possible reuse an old who_p in case this function had
not been called from the system task.

virtual_copy_f() takes the caller as a parameter too. In case the
checking is disabled, the caller must be NULL and non NULL if it is
enabled as we must be able to suspend the caller.
2010-02-03 09:04:48 +00:00
Erik van der Kouwe 144de8a7b3 Add smallbunzip2 to bzip2 man-page 2010-02-02 15:26:12 +00:00
Erik van der Kouwe c107dbe1d0 Man-pages on mkdep, cdprobe, loadramdisk and newroot; thanks to Antoine Leca 2010-02-02 15:10:00 +00:00
Kees van Reeuwijk 2db33d5c8c Fix some incorrect testing of bit flags. 2010-02-02 12:24:35 +00:00
Erik van der Kouwe 310876dcec Kill processes which ignore signals thatshould not be ignored 2010-01-31 19:13:20 +00:00
Ben Gras 82ce09234b improve behaviour under VPC, fixes from nicolas tittley. 2010-01-31 18:29:51 +00:00
Kees van Reeuwijk 2fe20e5aaf Fix a complaint about a value return from a void function.
Propagate error codes a bit more.
Some code cleanup.
2010-01-29 14:14:22 +00:00
Kees van Reeuwijk 477b616fe8 Fixed a number of complaints about missing return statements.
Some cases were fixed by declaring the function void, others were fixed
by adding a return <value> statement, thereby avoiding potentially
incorrect behavior (usually in error handling).
Some enum correctness in boot.c.
2010-01-28 13:17:07 +00:00
David van Moolenbroek 564e2a4368 HGFS tweaks 2010-01-27 22:59:03 +00:00
Erik van der Kouwe 6959226707 Increase process table size 2010-01-27 18:37:12 +00:00
Ben Gras a36a3766b0 ignore .svn dirs when making binary packages 2010-01-27 16:20:28 +00:00
Ben Gras 75a3d4ebde bump version number to 3.1.6, copyright year to 2010. 2010-01-27 16:19:50 +00:00
Kees van Reeuwijk 2ba237cd4e Fixed a number of uses of uninitialized variables by adding assertions
or other sanity checks, code reshuffling, or fixing broken behavior.
2010-01-27 10:23:58 +00:00
Kees van Reeuwijk c6eb51d66a Rewrite some functions to ANSI style. 2010-01-27 10:19:13 +00:00