Changeset 281b607 in mainline for arch/amd64


Ignore:
Timestamp:
2006-03-23T10:29:39Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a0bb10ef
Parents:
9aa72b4
Message:

Added basic kernel infrastructure for ThreadLocalStorage(TLS) for
ia32(complete),amd64(complete),mips32(missing emulation of rdhwr instruction).

Location:
arch/amd64
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/include/cpu.h

    r9aa72b4 r281b607  
    4343#define AMD_MSR_LSTAR   0xc0000082
    4444#define AMD_MSR_SFMASK  0xc0000084
     45#define AMD_MSR_FS      0xc0000100
    4546#define AMD_MSR_GS      0xc0000101
    4647
  • arch/amd64/include/thread.h

    r9aa72b4 r281b607  
    3030#define __amd64_THREAD_H__
    3131
    32 #define ARCH_THREAD_DATA
     32#define ARCH_THREAD_DATA __native tls;
    3333
    3434#endif
  • arch/amd64/src/amd64.c

    r9aa72b4 r281b607  
    3333#include <config.h>
    3434
     35#include <proc/thread.h>
    3536#include <arch/ega.h>
    3637#include <genarch/i8042/i8042.h>
     
    4849#include <arch/syscall.h>
    4950#include <arch/debugger.h>
     51#include <syscall/syscall.h>
     52
    5053
    5154/** Disable I/O on non-privileged levels
     
    160163        i8254_normal_operation();
    161164}
     165
     166/** Set Thread-local-storeage pointer
     167 *
     168 * TLS pointer is set in FS register. Unfortunately the 64-bit
     169 * part can be set only in CPL0 mode.
     170 *
     171 * The specs says, that on %fs:0 there is stored contents of %fs register,
     172 * we need not to go to CPL0 to read it.
     173 */
     174__native sys_tls_set(__native addr)
     175{
     176        THREAD->tls = addr;
     177        write_msr(AMD_MSR_FS, addr);
     178        return 0;
     179}
  • arch/amd64/src/proc/scheduler.c

    r9aa72b4 r281b607  
    4646        swapgs();
    4747
     48        /* TLS support - set FS to thread local storage */
     49        write_msr(AMD_MSR_FS, THREAD->tls);
     50
    4851#ifdef CONFIG_DEBUG_AS_WATCHPOINT
    4952        /* Set watchpoint on AS to ensure that nobody sets it to zero */
Note: See TracChangeset for help on using the changeset viewer.