[haiku-commits] Re: BRANCH xyzzy-github.x86_64 - src/system/kernel/arch/x86 src/system/kernel/arch/x86/64 src/system/kernel/arch/x86/32 headers/private/kernel/arch/x86 headers/private/kernel/arch/x86/32

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 04 Jul 2012 21:44:51 +0200

On 2012-07-04 at 15:49:11 [+0200], xyzzy-github.x86_64 
<community@xxxxxxxxxxxx> wrote:
> added 1 changeset to branch 'refs/remotes/xyzzy-github/x86_64'
> old head: 4e8fbfb2d158de7b1cadd1c060acee51a7d67309
> new head: 4304bb9894335fe5e5bd667a1f27dc7605c2e5b9
> 
> ----------------------------------------------------------------------------
> 
> 4304bb9: Added arch_cpu.cpp to the x86_64 build.
>   
>   * Some things are currently ifndef'd out completely for x86_64 because
>     they aren't implemented, there's a few other ifdef's to handle x86_64
>     differences but most of the code works unchanged.
>   * Renamed some i386_* functions to x86_*.
>   * Added a temporary method for setting the current thread on x86_64
>     (a global variable, not SMP safe). This will be changed to be done
>     via the GS segment but I've not implemented that yet.

A relatively simple (and even quite portable) method would be to align the 
kernel stack areas to a power of two at least >= the stack size and put a 
pointer to the thread structure (or even the thread structure itself) at the 
top of the stack. This way the thread pointer can be derived quickly from the 
stack pointer.

[...]
> diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h
> index 1f921f9..c3fe2b0 100644
> --- a/headers/os/kernel/OS.h
> +++ b/headers/os/kernel/OS.h
> @@ -645,7 +645,7 @@ typedef enum cpu_types {
>  
>  #define B_CPU_x86_VENDOR_MASK    0xff00
>  
> -#ifdef __INTEL__
> +#if defined(__INTEL__) || defined(__x86_64)

Not sure, if this is just a typo or if both macros are defined, but you 
usually use "__x86_64__".

CU, Ingo

Other related posts: