Commit Graph

252 Commits

Author SHA1 Message Date
Axel Dörfler
4fff689f48 Some minor updates:
arch_cpu: could have used the TLS_SIZE macro in one place, removed
a now unused variable, assignments to tss_loaded are now booleans.
thread.c: added the new fields to _dump_thread_info().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2393 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-08 09:27:55 +00:00
Axel Dörfler
20726b7fb1 _create_thread() now correctly allocates the stack with REGION_ADDR_EXACT_ADDRESS
from the USER_STACK_REGION (until B_BASE_ADDRESS is available), made it much better
readable. It now grows from the lower USER_STACK_REGION up to the start of the main
thread's stack location.
Calls arch_thread_tls_init() and accounts for the TLS area in the stack region.
Added some comments, some cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2382 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-07 09:48:01 +00:00
Axel Dörfler
59cbb92fdf team_create_team2() now also allocates a region for TLS in the primary stack
area. It now also calls arch_thread_init_tls(). Cleaned it up to make it more
readable, added some comments.
Some other cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2381 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-07 09:40:59 +00:00
Axel Dörfler
2a6fbb7f88 Removed some hard-coded values with definitions (mostly USER_x_SEG in arch_x86.S,
and TSS_BASE_SEGMENT in i386_set_tss_and_kstack() (thanks Daniel for pointing this
out)).
Added a arch_thread_init_tls() function which fills the reserved slots - the find_thread()
inline asm in OS.h is finally working.
Added some more comments, resolved the ToDo items from last time :-)
arch_thread_context_switch() now calls set_tls_context() at the correct location.
arch_thread_enter_uspace() now calls set_tls_context() as there is no context
switch in this case for the current thread after TLS has been set up, and it
now gets a pointer to the thread structure directly, and calculates the user
stack top itself, rather than the callee.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2380 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-07 09:33:30 +00:00
Axel Dörfler
19321ae5a8 Temporarily removed arch_selector.c from the build - it's currently not used
at all, and assumes a fixed and wrong number of preallocated GDT entries.

Implemented TLS: there is one GDT entry per CPU. If a context switch happens,
the FS register of the new thread is set to the matching GDT, and the GDT is
changed so that it points to the current thread's TLS storage area.
This area currently resides unsafely at the bottom of the user stack - for
some reason I could not figure out, it doesn't even work correctly most of
the time (it segfaults when accessing a slot via FS). I've added a ToDo item
explaining the situation - hopefully I have more ideas when I slept a bit more...

The GDT is now no longer static in arch_cpu.c and has been renamed from gdt to
gGDT. It's now also referenced in arch_thread.c, and it would make sense for
arch_selector.c to use it as well (instead of another local copy).
arch_cpu_init2() now uses the set_tss_descriptor() inline function and the
TSS_BASE_SEGMENT macro to set up the TSS section. It now also sets up the
TLS segment descriptors (as TSS, one entry per CPU).

Since I removed desc_table from the headers (the GDT is now a (segment_descriptor *)),
I added it locally to arch_int.c.
i386_enter_uspace() now don't set the FS register to 0x23 anymore, since it's
now already set correctly at the end of arch_thread_context_switch().

Some clean-ups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2366 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-06 08:25:01 +00:00
Axel Dörfler
722bf47f67 Added some ToDo items.
Smaller cleanup.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2365 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-06 08:10:54 +00:00
Axel Dörfler
1d661e3285 Just slightly changed a comment; there was more, but I removed that, and
I was too lazy to revert that little change back, so that I would be able
to write this short paragraph explaining what I've done.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2364 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-06 08:10:03 +00:00
Axel Dörfler
d703e5451d Removed an XXX comment question, and replaced it with an explanation of the
issue.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2363 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-06 08:08:13 +00:00
Axel Dörfler
50808915da Removed unused file int.c.
Minor style changes in arch_vm*.c


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2352 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-02 13:56:53 +00:00
Axel Dörfler
e8bfc82801 Removed config_manager from the old location (now in src/add-ons/kernel/bus_managers)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2351 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-01-02 13:23:06 +00:00
Axel Dörfler
c893786008 Exported the whole known driver module API - not implemented yet, though.
Removed the probably broken bus module info.
Renamed functions cfdm -> driver, cfbm -> bus.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2341 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-31 18:33:32 +00:00
Axel Dörfler
ed5c11d75a Included NewOS change 1674 - moved architecture dependent part of elf.c
to the correct location.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2319 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-30 13:33:22 +00:00
Axel Dörfler
7747cd8133 Included Travis' change 1687.
Cleanups, added TRACE() debugging macro instead of commented dprintfs.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2318 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-30 11:18:57 +00:00
Axel Dörfler
2d4d170f83 Some cleanups.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2317 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-30 11:17:36 +00:00
Axel Dörfler
ce29ea4e8f Removed it again :-)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2215 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-10 04:27:38 +00:00
Axel Dörfler
796a8651e9 Added a skeleton for the image API. Contains almost no code yet, though, only
some structure definitions (to outline some basic ideas), and the symbols
exported to userland.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-10 03:36:18 +00:00
Axel Dörfler
d768457f49 Included NewOS change 1685 in OpenBeOS; a fix for the VM.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2190 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-08 23:12:09 +00:00
Philippe Houdoin
a4d52d3edf Add missing headers/os/drivers/KernelExport.h functions here and there.
Some int -> cpu_state cleanup on the way, and implement the
B_KDEBUG_CONT and B_KDEBUG_QUIT features in our kernel debugger.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2173 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-07 00:25:50 +00:00
Axel Dörfler
424880282f Fixed a warning.
Replaced "int state" with "cpu_status state" where appropriate.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2160 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-04 16:40:07 +00:00
Axel Dörfler
fb101ff170 Completely rewritten the module iterator code. Fixed many bugs in that
code and made it much simpler (it now just uses a stack of path names
instead of this complex doubly-linked module_iterator_dir list).
Now works together with the rest of the code without making any problems.
Added a module_test() function which iterates over all existing modules.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2149 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 17:54:09 +00:00
Axel Dörfler
ac5b2b4ece bootfs_read_dir() and devfs_read_dir() both returned B_ENTRY_NOT_FOUND
instead of B_OK for the last directory entry.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2148 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 17:49:28 +00:00
Axel Dörfler
744761bf27 Removed the team->path variable. Renamed ioctx to io_context.
Some cleanups, moved user_*() functions to the end of the file.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2144 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 14:17:53 +00:00
Axel Dörfler
1291a19d84 thread->page_faults_allowed is now initialized.
Updated due to the ioctx -> io_context change.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2143 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 14:11:35 +00:00
Axel Dörfler
5cdaa5176e Now panics if page faults are forbidden and happen anyway.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2142 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 14:10:34 +00:00
Axel Dörfler
52bd3fc17c Implemented forbid_page_faults() and permit_page_faults(), added a new
field to the thread structure to keep track of the current state.
forbids/permits can be nested.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2141 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 14:09:43 +00:00
Axel Dörfler
aeb5053982 Added empty (until TLS steps in) function stubs for:
permit_page_faults(), and forbid_page_faults().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2134 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-03 01:50:55 +00:00
beveloper
7d9fdf5918 make sure that the stack page is in place before disabling interrupts.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2125 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-30 02:36:31 +00:00
beveloper
c0d31b20ab Fixed the detection of page faults that happen while interrupts were
disabled. If a page fault happend while a interrupt handler is executed,
or while a section of code is running with interrupts disabled (with the
exception of the initial kernel startup), the page fault handler will
now panic, to give you the chance to fix the bug.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2124 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-30 02:01:29 +00:00
Axel Dörfler
750a82c5d3 Added new debug output macros (TRACE()).
thread_exit() for now prints a warning if it was called with interrupts
disabled.
Fixed a bug in thread_exit2() that restored the interrupts too early,
instead of simply enabling them (and restoring them later) [found by
Marcus O. great debug additions].
Fixes for the khash changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2119 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:42:52 +00:00
Axel Dörfler
14d9bcd728 Fixed two warnings.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2118 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:39:34 +00:00
Axel Dörfler
3ae9bebe33 Fixes for the khash changes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:38:52 +00:00
Axel Dörfler
fc88dc959f Added a missing include (and fixed a warning this way).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2116 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:37:19 +00:00
Axel Dörfler
8a91be0446 Removed two warnings.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2115 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:36:42 +00:00
Axel Dörfler
8a531eeb0a Fixes for the changes in khash.
Now the d_reclen field of struct dirent is correctly calculated in all
file systems (read_dir() function).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2114 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:36:05 +00:00
Axel Dörfler
b9b1c1c4f5 Almost completely rewritten module.c. Locking now works correctly, memory
leak fixed, some other bugs fixed, removed the global queues as there weren't
needed and used at all, moved to the other hash table implementation
(because the new_hash_table stuff was buggy). Should really work okay now :-)

Added the last missing function get_next_loaded_module_name() - I am not
sure the Be version works this way, but we could easily change that after
actually having found out how that one is really working.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2113 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:33:57 +00:00
Axel Dörfler
d92e4b19e4 Completely removed the buggy, inflexible, and incomplete new_hash_table
implementation.
Some cleanups of the other code.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2112 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 08:30:20 +00:00
beveloper
0010bfc64f the new_hash_table code has a larger number of problems
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2108 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-28 17:34:55 +00:00
beveloper
428f0ce25c last cleanup of pool code before rewriting it
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2106 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-28 15:05:58 +00:00
beveloper
9c2992c73b fixed debug function
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2105 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-28 14:41:06 +00:00
beveloper
9eb6ed8082 disable interrupt check when in a panic() context
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2104 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-28 14:11:08 +00:00
beveloper
3b70f94330 added a magic value to check clobbering of the free list
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2103 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-28 14:10:20 +00:00
beveloper
7991b1a031 added a lot of debugging functions that should help fixing bugs
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2099 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-28 02:25:04 +00:00
beveloper
d8dd74308e Optimized (yes, we shouldn't do it now) to consume less power on P4,
and to have better performance on Hyper Threading systems. Should be
backward compatible with all x86 systems, according to Intel documentation.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2068 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-23 17:43:36 +00:00
beveloper
d55c9bd082 moved queue initialization into int_init2()
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2016 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-19 11:53:41 +00:00
Daniel Reinhold
89feafabe5 fixed call to thread_get_current_thread_id()
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2014 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-19 06:44:51 +00:00
Daniel Reinhold
690fa06644 restored SYSCALL_GET_CURRENT_THREAD_ID -- my mistake, it was fine as it was
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2013 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-19 05:51:13 +00:00
Daniel Reinhold
715f76df9e added sys_get_current_thread_id() -- for libroot compatibility
some minor rearrangement (sys_xxx() calls now placed together)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1997 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 02:04:57 +00:00
Daniel Reinhold
898852b6b5 fixed SYSCALL_GET_CURRENT_THREAD_ID (was calling a function that had been removed)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 02:00:38 +00:00
Daniel Reinhold
42bef465fa added sys_send_signal()
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1995 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:58:00 +00:00
Daniel Reinhold
453532db1c moved the string table definition to libroot where it belonged
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1982 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 00:39:41 +00:00