Changeset 3b0f1b9a in mainline


Ignore:
Timestamp:
2016-04-12T05:57:00Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0f792c28, d84398a7
Parents:
8844e70
Message:

amd64: use asmtool.h macros for defining symbols

Files:
14 edited
3 moved

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/asm.S

    r8844e70 r3b0f1b9a  
    2727 */
    2828
     29#include <abi/asmtool.h>
    2930#include <arch/pm.h>
    3031#include <arch/mm/page.h>
     
    3233
    3334.text
    34 .global interrupt_handlers
    35 .global syscall_entry
    36 .global cpuid
    37 .global has_cpuid
    38 .global read_efer_flag
    39 .global set_efer_flag
    40 .global memcpy_from_uspace
    41 .global memcpy_to_uspace
    42 .global memcpy_from_uspace_failover_address
    43 .global memcpy_to_uspace_failover_address
    44 .global early_putchar
    4535
    4636#define MEMCPY_DST   %rdi
     
    6454 *
    6555 */
    66 memcpy_from_uspace:
    67 memcpy_to_uspace:
     56FUNCTION_BEGIN(memcpy_from_uspace)
     57FUNCTION_BEGIN(memcpy_to_uspace)
    6858        movq MEMCPY_DST, %rax
    6959       
     
    8171        0:
    8272                ret                 /* return MEMCPY_SRC, success */
    83 
    84 memcpy_from_uspace_failover_address:
    85 memcpy_to_uspace_failover_address:
     73FUNCTION_END(memcpy_from_uspace)
     74FUNCTION_END(memcpy_to_uspace)
     75
     76SYMBOL(memcpy_from_uspace_failover_address)
     77SYMBOL(memcpy_to_uspace_failover_address)
    8678        xorl %eax, %eax         /* return 0, failure */
    8779        ret
     
    9284*
    9385*/
    94 has_cpuid:
     86FUNCTION_BEGIN(has_cpuid)
    9587        /* Load RFLAGS */
    9688        pushfq
     
    114106        xorl %edx, %eax
    115107        ret
    116 
    117 cpuid:
     108FUNCTION_END(has_cpuid)
     109
     110FUNCTION_BEGIN(cpuid)
    118111        /* Preserve %rbx across function calls */
    119112        movq %rbx, %r10
     
    130123        movq %r10, %rbx
    131124        ret
    132 
    133 set_efer_flag:
     125FUNCTION_END(cpuid)
     126
     127FUNCTION_BEGIN(set_efer_flag)
    134128        movl $0xc0000080, %ecx
    135129        rdmsr
     
    137131        wrmsr
    138132        ret
    139 
    140 read_efer_flag:
     133FUNCTION_END(set_efer_flag)
     134
     135FUNCTION_BEGIN(read_efer_flag)
    141136        movl $0xc0000080, %ecx
    142137        rdmsr
    143138        ret
     139FUNCTION_END(read_efer_flag)
    144140
    145141/*
     
    157153
    158154.macro handler i
    159 .global int_\i
    160 int_\i:
     155SYMBOL(int_\i)
    161156
    162157        /*
     
    249244        53,54,55,56,57,58,59,60,61,62,63
    250245
    251 interrupt_handlers:
     246SYMBOL(interrupt_handlers)
    252247.irp cnt, LIST_0_63
    253248        handler \cnt
     
    273268 *
    274269 */
    275 syscall_entry:
     270SYMBOL(syscall_entry)
    276271        /* Switch to hidden %gs */
    277272        swapgs
     
    396391 *
    397392 */
    398 early_putchar:
    399        
     393FUNCTION_BEGIN(early_putchar)
    400394#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
    401395       
     
    525519       
    526520        ret
    527 
     521FUNCTION_END(early_putchar)
     522
  • kernel/arch/amd64/src/boot/multiboot.S

    r8844e70 r3b0f1b9a  
    2929 */
    3030
     31#include <abi/asmtool.h>
    3132#include <arch/boot/boot.h>
    3233#include <arch/mm/page.h>
     
    6465
    6566.align 4
    66 .global multiboot_image_start
    6767multiboot_header:
    6868        .long MULTIBOOT_HEADER_MAGIC
     
    7575        .long multiboot_image_start
    7676
    77 multiboot_image_start:
     77SYMBOL(multiboot_image_start)
    7878        cli
    7979        cld
     
    640640
    641641.align 4096
    642 .global ptl_0
    643 ptl_0:
     642SYMBOL(ptl_0)
    644643        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
    645644        .fill 510, 8, 0
     
    648647.section K_DATA_START, "aw", @progbits
    649648
    650 .global bootstrap_idtr
    651 bootstrap_idtr:
     649SYMBOL(bootstrap_idtr)
    652650        .word 0
    653651        .long 0
    654652
    655 .global bootstrap_gdtr
    656 bootstrap_gdtr:
     653SYMBOL(bootstrap_gdtr)
    657654        .word GDT_SELECTOR(GDT_ITEMS)
    658655        .long KA2PA(gdt)
    659656
    660 .global multiboot_eax
    661 multiboot_eax:
     657SYMBOL(multiboot_eax)
    662658        .long 0
    663659
    664 .global multiboot_ebx
    665 multiboot_ebx:
     660SYMBOL(multiboot_ebx)
    666661        .long 0
    667662
  • kernel/arch/amd64/src/boot/multiboot2.S

    r8844e70 r3b0f1b9a  
    2727 */
    2828
     29#include <abi/asmtool.h>
    2930#include <arch/boot/boot.h>
    3031#include <arch/mm/page.h>
     
    4142
    4243.align 8
    43 .global multiboot2_image_start
    4444multiboot2_header_start:
    4545        .long MULTIBOOT2_HEADER_MAGIC
     
    122122multiboot2_header_end:
    123123
    124 multiboot2_image_start:
     124SYMBOL(multiboot2_image_start)
    125125        cli
    126126        cld
  • kernel/arch/amd64/src/context.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
     30#include <arch/context_struct.h>
     31
    2932.text
    30 
    31 .global context_save_arch
    32 .global context_restore_arch
    33 
    34 #include <arch/context_struct.h>
    3533
    3634## Save current CPU context
     
    3937# pointed by the 1st argument. Returns 1 in EAX.
    4038#
    41 context_save_arch:
     39FUNCTION_BEGIN(context_save_arch)
    4240        movq (%rsp), %rdx     # the caller's return %eip
    4341       
     
    5654        incl %eax
    5755        ret
     56FUNCTION_END(context_save_arch)
    5857
    5958
     
    6362# pointed by the 1st argument. Returns 0 in EAX.
    6463#
    65 context_restore_arch:
     64FUNCTION_BEGIN(context_restore_arch)
    6665        movq CONTEXT_OFFSET_R15(%rdi), %r15
    6766        movq CONTEXT_OFFSET_R14(%rdi), %r14
     
    7978        xorl %eax, %eax       # context_restore returns 0
    8079        ret
     80FUNCTION_END(context_restore_arch)
    8181
  • kernel/arch/amd64/src/debug/stacktrace_asm.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
     30
    2931.text
    3032
    31 .global frame_pointer_get
    32 .global program_counter_get
    33 
    34 frame_pointer_get:
     33FUNCTION_BEGIN(frame_pointer_get)
    3534        movq %rbp, %rax
    3635        ret
     36FUNCTION_END(frame_pointer_get)
    3737
    38 program_counter_get:
     38FUNCTION_BEGIN(program_counter_get)
    3939        movq (%rsp), %rax
    4040        ret
     41FUNCTION_END(program_counter_get)
  • kernel/arch/amd64/src/delay.S

    r8844e70 r3b0f1b9a  
    3131#
    3232
     33#include <abi/asmtool.h>
     34
    3335.text
    3436
    35 .global asm_delay_loop
    36 .global asm_fake_loop
    37 
    38 asm_delay_loop:
     37FUNCTION_BEGIN(asm_delay_loop)
    3938        0:
    4039                dec %rdi
     
    4241       
    4342        ret
     43FUNCTION_END(asm_delay_loop)
    4444
    45 asm_fake_loop:
     45FUNCTION_BEGIN(asm_fake_loop)
    4646        0:
    4747                dec %rdi
     
    4949       
    5050        ret
     51FUNCTION_END(asm_fake_loop)
     52
  • kernel/arch/amd64/src/smp/ap.S

    r8844e70 r3b0f1b9a  
    3232#
    3333
     34#include <abi/asmtool.h>
    3435#include <arch/boot/boot.h>
    3536#include <arch/boot/memmap.h>
     
    4344#ifdef CONFIG_SMP
    4445
    45 .global unmapped_ap_boot
    46 
    4746# This piece of code is real-mode and is meant to be alligned at 4K boundary.
    4847# The requirement for such an alignment comes from MP Specification's STARTUP
     
    5049
    5150.align 4096
    52 unmapped_ap_boot:
     51SYMBOL(unmapped_ap_boot)
    5352.code16
    5453        cli
     
    113112#ifdef CONFIG_SMP
    114113
    115 .global unmapped_ap_gdtr
    116 unmapped_ap_gdtr:
     114SYMBOL(unmapped_ap_gdtr)
    117115        .word 0
    118116        .long 0
  • uspace/lib/c/arch/amd64/Makefile.inc

    r8844e70 r3b0f1b9a  
    2828
    2929ARCH_SOURCES = \
    30         arch/$(UARCH)/src/entry.s \
    31         arch/$(UARCH)/src/entryjmp.s \
    32         arch/$(UARCH)/src/thread_entry.s \
     30        arch/$(UARCH)/src/entry.S \
     31        arch/$(UARCH)/src/entryjmp.S \
     32        arch/$(UARCH)/src/thread_entry.S \
    3333        arch/$(UARCH)/src/syscall.S \
    3434        arch/$(UARCH)/src/fibril.S \
  • uspace/lib/c/arch/amd64/src/entry.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
     30
    2931.section .init, "ax"
    3032
    3133.org 0
    32 
    33 .globl __entry
    3434
    3535## User-space task entry point
     
    3737# %rdi contains the PCB pointer
    3838#
    39 __entry:
     39SYMBOL(__entry)
    4040        #
    4141        # Create the first stack frame.
  • uspace/lib/c/arch/amd64/src/entryjmp.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
    29 .globl entry_point_jmp
     29#include <abi/asmtool.h>
    3030
    3131## void entry_point_jmp(void *entry_point, void *pcb);
     
    3535#
    3636# Jump to program entry point
    37 entry_point_jmp:
     37SYMBOL(entry_point_jmp)
    3838        # use standard amd32 prologue not to confuse anybody
    3939        push %rbp
  • uspace/lib/c/arch/amd64/src/fibril.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
     30#include <libarch/fibril_context.h>
     31
    2932.text
    30 
    31 .global context_save
    32 .global context_restore
    33 
    34 #include <libarch/fibril_context.h>
    3533
    3634## Save current CPU context
     
    3937# pointed by the 1st argument. Returns 1 in EAX.
    4038#
    41 context_save:
     39FUNCTION_BEGIN(context_save)
    4240        movq (%rsp), %rdx     # the caller's return %eip
    4341       
     
    6058        incl %eax
    6159        ret
     60FUNCTION_END(context_save)
    6261
    6362## Restore current CPU context
     
    6665# pointed by the 1st argument. Returns 0 in EAX.
    6766#
    68 context_restore:
    69        
     67FUNCTION_BEGIN(context_restore)
    7068        movq CONTEXT_OFFSET_R15(%rdi), %r15
    7169        movq CONTEXT_OFFSET_R14(%rdi), %r14
     
    8886        xorl %eax, %eax                      # context_restore returns 0
    8987        ret
     88FUNCTION_END(context_restore)
    9089
  • uspace/lib/c/arch/amd64/src/stacktrace_asm.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
     30
    2931.text
    3032
    31 .global stacktrace_prepare
    32 .global stacktrace_fp_get
    33 .global stacktrace_pc_get
     33FUNCTION_BEGIN(stacktrace_prepare)
     34        ret
     35FUNCTION_END(stacktrace_prepare)
    3436
    35 stacktrace_prepare:
    36         ret
    37 
    38 stacktrace_fp_get:
     37FUNCTION_BEGIN(stacktrace_fp_get)
    3938        movq %rbp, %rax
    4039        ret
     40FUNCTION_END(stacktrace_fp_get)
    4141
    42 stacktrace_pc_get:
     42FUNCTION_BEGIN(stacktrace_pc_get)
    4343        movq (%rsp), %rax
    4444        ret
     45FUNCTION_END(stacktrace_pc_get)
     46
  • uspace/lib/c/arch/amd64/src/syscall.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
     30
    2931.text
    30        
    31 .global __syscall
    3232       
    3333## Make a system call.
     
    4343# @return               The return value will be stored in RAX.
    4444#
    45 __syscall:
     45FUNCTION_BEGIN(__syscall)
    4646        #
    4747        # Move the syscall number into RAX.
     
    5555        syscall
    5656        ret
     57FUNCTION_END(__syscall)
    5758
  • uspace/lib/c/arch/amd64/src/thread_entry.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
     30
    2931.text
    30 
    31 .globl __thread_entry
    3232
    3333## User-space thread entry point for all but the first threads.
    3434#
    3535#
    36 __thread_entry:
     36SYMBOL_BEGIN(__thread_entry)
    3737        #
    3838        # Create the first stack frame.
     
    4747        movq %rax, %rdi
    4848        call __thread_main
    49        
    50 .end __thread_entry
     49SYMBOL_END(__thread_entry)
  • uspace/lib/math/arch/amd64/src/cos.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
    2930#include <libarch/x87.h>
    3031
    3132.text
    3233
    33 .global cos_f64
    34 
    35 cos_f64:
     34FUNCTION_BEGIN(cos_f64)
    3635        pushq %rbp
    3736        movq %rsp, %rbp
     
    7776        leave
    7877        retq
     78FUNCTION_END(cos_f64)
  • uspace/lib/math/arch/amd64/src/sin.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
    2930#include <libarch/x87.h>
    3031
    3132.text
    3233
    33 .global sin_f64
    34 
    35 sin_f64:
     34FUNCTION_BEGIN(sin_f64)
    3635        pushq %rbp
    3736        movq %rsp, %rbp
     
    7776        leave
    7877        retq
     78FUNCTION_END(sin_f64)
     79
  • uspace/lib/math/arch/amd64/src/trunc.S

    r8844e70 r3b0f1b9a  
    2727#
    2828
     29#include <abi/asmtool.h>
    2930#include <libarch/x87.h>
    3031
    3132.text
    3233
    33 .global trunc_f64
    34 
    35 trunc_f64:
     34FUNCTION_BEGIN(trunc_f64)
    3635        pushq %rbp
    3736        movq %rsp, %rbp
     
    6362        leave
    6463        retq
     64FUNCTION_END(trunc_f64)
Note: See TracChangeset for help on using the changeset viewer.