History log of /haiku/headers/private/kernel/arch/cpu.h
Revision Date Author Comments
# 95e97463 14-Sep-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel: add generic wrapper for accessing user memory

This patch adds user_access() which can be used to gracefully handle
page faults that may happen when accessing user memory. It is used
by arch_cpu_user{memcpy, memset, strlcpy}() to allow using optimized
functions from the standard library.

Currently only x64 uses this, but nothing really is arch specific here.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>


# 8cf8e537 05-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86: Inline atomic functions and memory barriers


# 7db89e8d 25-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Rework cpuidle module

* Create new interface for cpuidle modules (similar to the cpufreq
interface)
* Generic cpuidle module is no longer needed
* Fix and update Intel C-State module


# 0e94a12f 24-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Make CACHE_LINE_ALIGN visible in the whole kernel


# 0edcbd27 26-Aug-2013 Jérôme Duval <jerome.duval@gmail.com>

apic: serialize writes to x2apic MSR...

as required by the specifications (it isn't needed with memory mapped i/o).


# 45bd7bb3 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unnecessary inclusions of <boot/kernel_args.h> in private kernel
headers and respectively added includes in source files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37259 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 807cf76d 26-Apr-2008 François Revol <revol@free.fr>

memory barrier functions available for drivers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25183 a95241bf-73f2-0310-859d-f6bbb57e9c96


# badc7b67 18-Feb-2007 Travis Geiselbrecht <geist@foobox.com>

yet another fix for #1018, which has at this point blossomed into a reorg of how AP cpus are initialized.
the new cpuid stuff was apparently exacerbating an existing problem where various bits of low level
cpu code (specifically get_current_cpu) weren't really initialized before being used. Changed the
order to set up a fake set of threads to point each cpu at really early in boot to make sure that at
all points in code it can get the current 'thread' and thus the current cpu.
A probably better solution would be to have dr3 point to the current cpu which would then point to the
current thread, but that has a race condition that would require an int disable, etc.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20160 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dcdc4f4b 04-Feb-2007 Travis Geiselbrecht <geist@foobox.com>

pulled over some stuff from newos:
at boot, per cpu, detect the cpu, pull down all the relevant cpuid bits and
save them into the per-cpu structure. Changed most of the code scattered here
and there that reads the cpuid to use a new api, x86_check_feature, which looks
at the saved bits.
Also changed the system_info stuff to read from these bits.
While i was at it, refreshed all the bits to be current.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20072 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e0e9a3e6 14-Dec-2005 Axel Dörfler <axeld@pinc-software.de>

* We now support the global page feature of x86 processors that prevents
kernel TLBs from being flushed on context switch.
* new arch_cpu_user_TLB_invalidate() that now does what arch_cpu_global_TLB_invalidate()
did before.
* arch_cpu_global_TLB_invalidate() will now flush all TLBs, even those from the
kernel.
* some cleanups.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15535 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 51a3c450 13-Dec-2005 Axel Dörfler <axeld@pinc-software.de>

The short story: we now have MTRR support on Intel and AMD CPUs (the latter
has not yet been tested, though - I'll do this after this commit):
* Removed the arch_memory_type stuff from vm_area; since there are only 8 memory
ranges on x86, it's simply overkill. The MTRR code now remembers the area ID
and finds the MTRR that way (it could also iterate over the existing MTRRs).
* Introduced some post_modules() init functions.
* If the other x86 CPUs out there don't differ a lot, MTRR functionality might
be put back into the kernel.
* x86_write_msr() was broken, it wrote the 64 bit number with the 32 bit words
switched - it took me some time (and lots of #GPs) to figure that one out.
* Removed the macro read_ebp() and introduced a function x86_read_ebp()
(it's not really a time critical call).
* Followed the Intel docs on how to change MTRRs (symmetrically on all CPUs
with caches turned off).
* Asking for memory types will automatically change the requested length to
a power of two - note that BeOS seems to behave in the same, although that's
not really very clean.
* fixed MTRRs are ignored for now - we should make sure at least, though,
that they are identical on all CPUs (or turn them off, even though I'd
prefer the BIOS stuff to be uncacheable, which we don't enforce yet, though).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15528 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4cf23177 19-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Replaced reboot() by arch_cpu_shutdown().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10043 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0d8e689 20-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Renamed some more init2 routines to init_post_vm() to make it clearer when
and why they are called.
Introduced a cpu_init_post_vm() that will now call arch_init_post_vm() instead
of letting main() doing it.
Fixed some return types (mostly from int to status_t).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9438 a95241bf-73f2-0310-859d-f6bbb57e9c96


# afad65de 19-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Replaced all remaining PAGE_SIZE with B_PAGE_SIZE, addr with addr_t.
Removed the definition of PAGE_SIZE and addr.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9433 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ac526351 22-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

Removed user_strncpy()/strcpy() and backends.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6699 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 57c39182 16-Oct-2003 Axel Dörfler <axeld@pinc-software.de>

Added the arch_cpu_sync_icache() function from NewOS.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5061 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f432eca4 07-Oct-2003 Axel Dörfler <axeld@pinc-software.de>

Now use the new kernel_args.h header file.
Added C++ guards.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4958 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c0f56724 13-May-2003 Axel Dörfler <axeld@pinc-software.de>

Removed unused functions, the C++ extern "C" now spans over all functions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3236 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c17f45d1 03-May-2003 Axel Dörfler <axeld@pinc-software.de>

Some header cleanups.
Renamed dbg_save_registers() to arch_...() since it's arch dependent.
Removed unnecessary dependencies to stage2.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3138 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 11fe0cb8 07-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for the sys_/user_ attribute calls.
Changed the file_descriptor structure (more status_t, name removed).
Changed "extern inline" to "static inline" in thread.h/arch_thread.h as those
also work with -O0 -g.
Added prototypes for [arch_cpu_]user_strlcpy().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1454 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4635c565 18-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Added the arch_cpu_idle() call.
Updated stage2_priv.h to reflect geist's, and freston's changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@306 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 95e97463d265c9f4a6e43265ef0f1f63a0825b21 14-Sep-2014 Paweł Dziepak <pdziepak@quarnos.org>

kernel: add generic wrapper for accessing user memory

This patch adds user_access() which can be used to gracefully handle
page faults that may happen when accessing user memory. It is used
by arch_cpu_user{memcpy, memset, strlcpy}() to allow using optimized
functions from the standard library.

Currently only x64 uses this, but nothing really is arch specific here.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>


# 8cf8e537740789b1b103f0aa0736dbfcf55359c2 05-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86: Inline atomic functions and memory barriers


# 7db89e8dc395db73368479fd9817b2b67899f3f6 25-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Rework cpuidle module

* Create new interface for cpuidle modules (similar to the cpufreq
interface)
* Generic cpuidle module is no longer needed
* Fix and update Intel C-State module


# 0e94a12f8e0e5fe5ff5b2e3f83384f3586396c92 24-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Make CACHE_LINE_ALIGN visible in the whole kernel


# 0edcbd2754bbde71864f6ec2578a05084d4dc23d 26-Aug-2013 Jérôme Duval <jerome.duval@gmail.com>

apic: serialize writes to x2apic MSR...

as required by the specifications (it isn't needed with memory mapped i/o).


# 45bd7bb3db9d9e4dcb02b89a3e7c2bf382c0a88c 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unnecessary inclusions of <boot/kernel_args.h> in private kernel
headers and respectively added includes in source files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37259 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 807cf76df012895d6de2cea198c9c3b0558948b1 26-Apr-2008 François Revol <revol@free.fr>

memory barrier functions available for drivers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25183 a95241bf-73f2-0310-859d-f6bbb57e9c96


# badc7b674eca3e33d1c5f865a626966110790f8f 18-Feb-2007 Travis Geiselbrecht <geist@foobox.com>

yet another fix for #1018, which has at this point blossomed into a reorg of how AP cpus are initialized.
the new cpuid stuff was apparently exacerbating an existing problem where various bits of low level
cpu code (specifically get_current_cpu) weren't really initialized before being used. Changed the
order to set up a fake set of threads to point each cpu at really early in boot to make sure that at
all points in code it can get the current 'thread' and thus the current cpu.
A probably better solution would be to have dr3 point to the current cpu which would then point to the
current thread, but that has a race condition that would require an int disable, etc.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20160 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dcdc4f4b435491550377a93954df5e1f8c5a384e 04-Feb-2007 Travis Geiselbrecht <geist@foobox.com>

pulled over some stuff from newos:
at boot, per cpu, detect the cpu, pull down all the relevant cpuid bits and
save them into the per-cpu structure. Changed most of the code scattered here
and there that reads the cpuid to use a new api, x86_check_feature, which looks
at the saved bits.
Also changed the system_info stuff to read from these bits.
While i was at it, refreshed all the bits to be current.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20072 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e0e9a3e69f18220cf21cd2fa8ba2d9fb794b922b 14-Dec-2005 Axel Dörfler <axeld@pinc-software.de>

* We now support the global page feature of x86 processors that prevents
kernel TLBs from being flushed on context switch.
* new arch_cpu_user_TLB_invalidate() that now does what arch_cpu_global_TLB_invalidate()
did before.
* arch_cpu_global_TLB_invalidate() will now flush all TLBs, even those from the
kernel.
* some cleanups.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15535 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 51a3c450bebefa32a5636bc6078bdd648818da41 13-Dec-2005 Axel Dörfler <axeld@pinc-software.de>

The short story: we now have MTRR support on Intel and AMD CPUs (the latter
has not yet been tested, though - I'll do this after this commit):
* Removed the arch_memory_type stuff from vm_area; since there are only 8 memory
ranges on x86, it's simply overkill. The MTRR code now remembers the area ID
and finds the MTRR that way (it could also iterate over the existing MTRRs).
* Introduced some post_modules() init functions.
* If the other x86 CPUs out there don't differ a lot, MTRR functionality might
be put back into the kernel.
* x86_write_msr() was broken, it wrote the 64 bit number with the 32 bit words
switched - it took me some time (and lots of #GPs) to figure that one out.
* Removed the macro read_ebp() and introduced a function x86_read_ebp()
(it's not really a time critical call).
* Followed the Intel docs on how to change MTRRs (symmetrically on all CPUs
with caches turned off).
* Asking for memory types will automatically change the requested length to
a power of two - note that BeOS seems to behave in the same, although that's
not really very clean.
* fixed MTRRs are ignored for now - we should make sure at least, though,
that they are identical on all CPUs (or turn them off, even though I'd
prefer the BIOS stuff to be uncacheable, which we don't enforce yet, though).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15528 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4cf23177674850edead94cec6b384748dfe966b6 19-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Replaced reboot() by arch_cpu_shutdown().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10043 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0d8e689acb4ec1fbe798773cfb066277c7d4f9b 20-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Renamed some more init2 routines to init_post_vm() to make it clearer when
and why they are called.
Introduced a cpu_init_post_vm() that will now call arch_init_post_vm() instead
of letting main() doing it.
Fixed some return types (mostly from int to status_t).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9438 a95241bf-73f2-0310-859d-f6bbb57e9c96


# afad65ded7a1258fc91659fb456f1a90d08e0598 19-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Replaced all remaining PAGE_SIZE with B_PAGE_SIZE, addr with addr_t.
Removed the definition of PAGE_SIZE and addr.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9433 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ac526351a84bf0d645984c6805a73f6fc4ca122d 22-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

Removed user_strncpy()/strcpy() and backends.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6699 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 57c391825864ccda83dacaa285998e0c6d5830ef 16-Oct-2003 Axel Dörfler <axeld@pinc-software.de>

Added the arch_cpu_sync_icache() function from NewOS.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5061 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f432eca4409efd2c3e52a198da77f11f0d3ec307 07-Oct-2003 Axel Dörfler <axeld@pinc-software.de>

Now use the new kernel_args.h header file.
Added C++ guards.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4958 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c0f5672484434450a76dc4502b9f86276080b1c5 13-May-2003 Axel Dörfler <axeld@pinc-software.de>

Removed unused functions, the C++ extern "C" now spans over all functions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3236 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c17f45d123e46467438e56fa001df91db9850917 03-May-2003 Axel Dörfler <axeld@pinc-software.de>

Some header cleanups.
Renamed dbg_save_registers() to arch_...() since it's arch dependent.
Removed unnecessary dependencies to stage2.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3138 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 11fe0cb8de932243324b119e4567e7d5d69c4540 07-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for the sys_/user_ attribute calls.
Changed the file_descriptor structure (more status_t, name removed).
Changed "extern inline" to "static inline" in thread.h/arch_thread.h as those
also work with -O0 -g.
Added prototypes for [arch_cpu_]user_strlcpy().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1454 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4635c565e48b7c83f3e5417610f60066d56bd5a6 18-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Added the arch_cpu_idle() call.
Updated stage2_priv.h to reflect geist's, and freston's changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@306 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96