Changeset bd48f4c in mainline for kernel/arch/amd64/include/asm.h


Ignore:
Timestamp:
2010-07-12T10:53:30Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bd11d3e
Parents:
c40e6ef (diff), bee2d4c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/asm.h

    rc40e6ef rbd48f4c  
    3939#include <typedefs.h>
    4040#include <arch/cpu.h>
    41 
    42 extern void asm_delay_loop(uint32_t t);
    43 extern void asm_fake_loop(uint32_t t);
     41#include <trace.h>
    4442
    4543/** Return base address of current stack.
     
    5048 *
    5149 */
    52 static inline uintptr_t get_stack_base(void)
     50NO_TRACE static inline uintptr_t get_stack_base(void)
    5351{
    5452        uintptr_t v;
     
    5755                "andq %%rsp, %[v]\n"
    5856                : [v] "=r" (v)
    59                 : "0" (~((uint64_t) STACK_SIZE-1))
     57                : "0" (~((uint64_t) STACK_SIZE - 1))
    6058        );
    6159       
     
    6361}
    6462
    65 static inline void cpu_sleep(void)
    66 {
    67         asm volatile ("hlt\n");
    68 }
    69 
    70 static inline void __attribute__((noreturn)) cpu_halt(void)
     63NO_TRACE static inline void cpu_sleep(void)
     64{
     65        asm volatile (
     66                "hlt\n"
     67        );
     68}
     69
     70NO_TRACE static inline void __attribute__((noreturn)) cpu_halt(void)
    7171{
    7272        while (true) {
     
    7777}
    7878
    79 
    8079/** Byte from port
    8180 *
     
    8685 *
    8786 */
    88 static inline uint8_t pio_read_8(ioport8_t *port)
     87NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
    8988{
    9089        uint8_t val;
     
    107106 *
    108107 */
    109 static inline uint16_t pio_read_16(ioport16_t *port)
     108NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
    110109{
    111110        uint16_t val;
     
    128127 *
    129128 */
    130 static inline uint32_t pio_read_32(ioport32_t *port)
     129NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
    131130{
    132131        uint32_t val;
     
    149148 *
    150149 */
    151 static inline void pio_write_8(ioport8_t *port, uint8_t val)
     150NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
    152151{
    153152        asm volatile (
    154153                "outb %b[val], %w[port]\n"
    155                 :: [val] "a" (val), [port] "d" (port)
     154                :: [val] "a" (val),
     155                   [port] "d" (port)
    156156        );
    157157}
     
    165165 *
    166166 */
    167 static inline void pio_write_16(ioport16_t *port, uint16_t val)
     167NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
    168168{
    169169        asm volatile (
    170170                "outw %w[val], %w[port]\n"
    171                 :: [val] "a" (val), [port] "d" (port)
     171                :: [val] "a" (val),
     172                   [port] "d" (port)
    172173        );
    173174}
     
    181182 *
    182183 */
    183 static inline void pio_write_32(ioport32_t *port, uint32_t val)
     184NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
    184185{
    185186        asm volatile (
    186187                "outl %[val], %w[port]\n"
    187                 :: [val] "a" (val), [port] "d" (port)
     188                :: [val] "a" (val),
     189                   [port] "d" (port)
    188190        );
    189191}
    190192
    191193/** Swap Hidden part of GS register with visible one */
    192 static inline void swapgs(void)
    193 {
    194         asm volatile("swapgs");
     194NO_TRACE static inline void swapgs(void)
     195{
     196        asm volatile (
     197                "swapgs"
     198        );
    195199}
    196200
     
    203207 *
    204208 */
    205 static inline ipl_t interrupts_enable(void) {
     209NO_TRACE static inline ipl_t interrupts_enable(void) {
    206210        ipl_t v;
    207211       
     
    224228 *
    225229 */
    226 static inline ipl_t interrupts_disable(void) {
     230NO_TRACE static inline ipl_t interrupts_disable(void) {
    227231        ipl_t v;
    228232       
     
    244248 *
    245249 */
    246 static inline void interrupts_restore(ipl_t ipl) {
     250NO_TRACE static inline void interrupts_restore(ipl_t ipl) {
    247251        asm volatile (
    248252                "pushq %[ipl]\n"
     
    259263 *
    260264 */
    261 static inline ipl_t interrupts_read(void) {
     265NO_TRACE static inline ipl_t interrupts_read(void) {
    262266        ipl_t v;
    263267       
     
    276280 *
    277281 */
    278 static inline bool interrupts_disabled(void)
     282NO_TRACE static inline bool interrupts_disabled(void)
    279283{
    280284        ipl_t v;
     
    289293}
    290294
    291 
    292295/** Write to MSR */
    293 static inline void write_msr(uint32_t msr, uint64_t value)
     296NO_TRACE static inline void write_msr(uint32_t msr, uint64_t value)
    294297{
    295298        asm volatile (
     
    301304}
    302305
    303 static inline unative_t read_msr(uint32_t msr)
     306NO_TRACE static inline unative_t read_msr(uint32_t msr)
    304307{
    305308        uint32_t ax, dx;
     
    314317}
    315318
    316 
    317319/** Enable local APIC
    318320 *
     
    320322 *
    321323 */
    322 static inline void enable_l_apic_in_msr()
     324NO_TRACE static inline void enable_l_apic_in_msr()
    323325{
    324326        asm volatile (
     
    328330                "orl $(0xfee00000),%%eax\n"
    329331                "wrmsr\n"
    330                 ::: "%eax","%ecx","%edx"
     332                ::: "%eax", "%ecx", "%edx"
    331333        );
    332334}
     
    337339 *
    338340 */
    339 static inline void invlpg(uintptr_t addr)
     341NO_TRACE static inline void invlpg(uintptr_t addr)
    340342{
    341343        asm volatile (
     
    350352 *
    351353 */
    352 static inline void gdtr_load(ptr_16_64_t *gdtr_reg)
     354NO_TRACE static inline void gdtr_load(ptr_16_64_t *gdtr_reg)
    353355{
    354356        asm volatile (
     
    363365 *
    364366 */
    365 static inline void gdtr_store(ptr_16_64_t *gdtr_reg)
     367NO_TRACE static inline void gdtr_store(ptr_16_64_t *gdtr_reg)
    366368{
    367369        asm volatile (
     
    376378 *
    377379 */
    378 static inline void idtr_load(ptr_16_64_t *idtr_reg)
     380NO_TRACE static inline void idtr_load(ptr_16_64_t *idtr_reg)
    379381{
    380382        asm volatile (
     
    388390 *
    389391 */
    390 static inline void tr_load(uint16_t sel)
     392NO_TRACE static inline void tr_load(uint16_t sel)
    391393{
    392394        asm volatile (
     
    396398}
    397399
    398 #define GEN_READ_REG(reg) static inline unative_t read_ ##reg (void) \
     400#define GEN_READ_REG(reg) NO_TRACE static inline unative_t read_ ##reg (void) \
    399401        { \
    400402                unative_t res; \
     
    406408        }
    407409
    408 #define GEN_WRITE_REG(reg) static inline void write_ ##reg (unative_t regn) \
     410#define GEN_WRITE_REG(reg) NO_TRACE static inline void write_ ##reg (unative_t regn) \
    409411        { \
    410412                asm volatile ( \
     
    436438extern void interrupt_handlers(void);
    437439
     440extern void asm_delay_loop(uint32_t);
     441extern void asm_fake_loop(uint32_t);
     442
    438443#endif
    439444
Note: See TracChangeset for help on using the changeset viewer.