Changeset 8844e70 in mainline


Ignore:
Timestamp:
2016-04-11T17:03:47Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3b0f1b9a
Parents:
3a34852
Message:

ia32: use asmtool.h macros for defining symbols

Files:
13 edited
3 moved

Legend:

Unmodified
Added
Removed
  • abi/include/abi/asmtool.h

    r3a34852 r8844e70  
    3636#define ABI_ASMTOOL_H_
    3737
     38#define SYMBOL(sym) \
     39        .global sym; \
     40        sym:
     41#define SYMBOL_BEGIN(sym) \
     42        SYMBOL(sym)
     43#define SYMBOL_END(sym) \
     44        .size sym, . - sym
     45
     46#define OBJECT_BEGIN(obj) \
     47        .type obj, @object; \
     48        SYMBOL_BEGIN(obj)
     49#define OBJECT_END(obj) \
     50        SYMBOL_END(obj)
     51
    3852#define FUNCTION_BEGIN(func) \
    39         .global func; \
    4053        .type func, @function; \
    41         func:   
    42 
     54        SYMBOL_BEGIN(func)     
    4355#define FUNCTION_END(func) \
    44         .size func, . - func
     56        SYMBOL_END(func)
    4557
    4658#endif
  • kernel/arch/ia32/Makefile.inc

    r3a34852 r8844e70  
    7575        arch/$(KARCH)/src/debug/stacktrace.c \
    7676        arch/$(KARCH)/src/debug/stacktrace_asm.S \
    77         arch/$(KARCH)/src/delay.s \
     77        arch/$(KARCH)/src/delay.S \
    7878        arch/$(KARCH)/src/asm.S \
    7979        arch/$(KARCH)/src/proc/scheduler.c \
  • kernel/arch/ia32/src/asm.S

    r3a34852 r8844e70  
    3131 */
    3232
     33#include <abi/asmtool.h>
    3334#include <arch/pm.h>
    3435#include <arch/cpu.h>
     
    3738
    3839.text
    39 .global paging_on
    40 .global enable_l_apic_in_msr
    41 .global memcpy_from_uspace
    42 .global memcpy_from_uspace_failover_address
    43 .global memcpy_to_uspace
    44 .global memcpy_to_uspace_failover_address
    45 .global early_putchar
    4640
    4741#define MEMCPY_DST   4
     
    6458 *
    6559 */
    66 memcpy_from_uspace:
    67 memcpy_to_uspace:
     60FUNCTION_BEGIN(memcpy_from_uspace)
     61FUNCTION_BEGIN(memcpy_to_uspace)
    6862        movl %edi, %edx  /* save %edi */
    6963        movl %esi, %eax  /* save %esi */
     
    9387                movl MEMCPY_DST(%esp), %eax
    9488                ret
     89FUNCTION_END(memcpy_from_uspace)
     90FUNCTION_END(memcpy_to_uspace)
    9591
    9692/*
     
    9894 * above had caused a page fault.
    9995 */
    100 memcpy_from_uspace_failover_address:
    101 memcpy_to_uspace_failover_address:
     96SYMBOL(memcpy_from_uspace_failover_address)
     97SYMBOL(memcpy_to_uspace_failover_address)
    10298        movl %edx, %edi
    10399        movl %eax, %esi
     
    112108 *
    113109 */
    114 paging_on:
     110FUNCTION_BEGIN(paging_on)
    115111        movl %cr0, %edx
    116112        orl $(1 << 31), %edx  /* paging on */
     
    123119        0:
    124120                ret
     121FUNCTION_END(paging_on)
    125122
    126123/** Enable local APIC
     
    129126 *
    130127 */
    131 enable_l_apic_in_msr:
     128FUNCTION_BEGIN(enable_l_apic_in_msr)
    132129        movl $0x1b, %ecx
    133130        rdmsr
     
    136133        wrmsr
    137134        ret
     135FUNCTION_END(enable_l_apic_in_msr)
    138136
    139137/*
     
    152150 * entirely in registers.
    153151 */
    154 .global sysenter_handler
    155 sysenter_handler:
     152SYMBOL(sysenter_handler)
    156153
    157154        /*
     
    232229 * This is the legacy syscall handler using the interrupt mechanism.
    233230 */
    234 .global int_syscall
    235 int_syscall:
     231SYMBOL(int_syscall)
    236232        subl $(ISTATE_SOFT_SIZE + 4), %esp
    237233
     
    319315
    320316.macro handler i
    321 .global int_\i
    322 int_\i:
     317SYMBOL(int_\i)
    323318        /*
    324319         * This macro distinguishes between two versions of ia32
     
    462457 *
    463458 */
    464 early_putchar:
     459FUNCTION_BEGIN(early_putchar)
    465460       
    466461#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
     
    594589       
    595590        ret
    596 
     591FUNCTION_END(early_putchar)
     592
  • kernel/arch/ia32/src/atomic.S

    r3a34852 r8844e70  
    2727#
    2828
     29#include <abi/asmtool.h>
     30
    2931.text
    3032
    3133#ifdef CONFIG_SMP
    3234
    33 .global spinlock_arch
    34 
    3535#
    3636# This is a bus-and-hyperthreading-friendly implementation of spinlock
    3737#
    38 spinlock_arch:
     38FUNCTION_BEGIN(spinlock_arch)
    3939        pushl %eax
    4040        pushl %ebx
     
    5555        popl %eax
    5656        ret
     57FUNCTION_END(spinlock_arch)
    5758       
    5859#endif
  • kernel/arch/ia32/src/boot/multiboot.S

    r3a34852 r8844e70  
    2929 */
    3030
     31#include <abi/asmtool.h>
    3132#include <arch/boot/boot.h>
    3233#include <arch/mm/page.h>
     
    6162
    6263.align 4
    63 .global multiboot_image_start
    6464multiboot_header:
    6565        .long MULTIBOOT_HEADER_MAGIC
     
    7272        .long multiboot_image_start
    7373
    74 multiboot_image_start:
     74SYMBOL(multiboot_image_start)
    7575        cli
    7676        cld
     
    162162 *
    163163 */
    164 .global map_kernel_pse
     164FUNCTION_BEGIN(map_kernel_pse)
    165165map_kernel_pse:
    166166        /* Paging features */
     
    194194        movl %ebx, %cr0
    195195        ret
     196FUNCTION_END(map_kernel_pse)
    196197
    197198/** Setup mapping for the kernel (non-PSE variant).
     
    201202 *
    202203 */
    203 .global map_kernel_non_pse
    204 map_kernel_non_pse:
     204FUNCTION_BEGIN(map_kernel_non_pse)
    205205        /* Paging features */
    206206        movl %cr4, %ecx
     
    281281               
    282282                ret
     283FUNCTION_END(map_kernel_non_pse)
    283284
    284285/** Calculate unmapped address of the end of the kernel. */
     
    707708        .space 4096, 0
    708709
    709 .global bootstrap_idtr
    710 bootstrap_idtr:
     710SYMBOL(bootstrap_idtr)
    711711        .word 0
    712712        .long 0
    713713
    714 .global bootstrap_gdtr
    715 bootstrap_gdtr:
     714SYMBOL(bootstrap_gdtr)
    716715        .word GDT_SELECTOR(GDT_ITEMS)
    717716        .long KA2PA(gdt)
    718717
    719 .global multiboot_eax
    720 multiboot_eax:
     718SYMBOL(multiboot_eax)
    721719        .long 0
    722720
    723 .global multiboot_ebx
    724 multiboot_ebx:
     721SYMBOL(multiboot_ebx)
    725722        .long 0
    726723
  • kernel/arch/ia32/src/boot/multiboot2.S

    r3a34852 r8844e70  
    2727 */
    2828
     29#include <abi/asmtool.h>
    2930#include <arch/boot/boot.h>
    3031#include <arch/pm.h>
     
    3940
    4041.align 8
    41 .global multiboot2_image_start
    4242multiboot2_header_start:
    4343        .long MULTIBOOT2_HEADER_MAGIC
     
    120120multiboot2_header_end:
    121121
    122 multiboot2_image_start:
     122SYMBOL(multiboot2_image_start)
    123123        cli
    124124        cld
  • kernel/arch/ia32/src/context.S

    r3a34852 r8844e70  
    2727#
    2828
     29#include <abi/asmtool.h>
    2930#include <arch/context_struct.h>
    3031
    3132.text
    32 
    33 .global context_save_arch
    34 .global context_restore_arch
    35 
    3633
    3734## Save current CPU context
     
    4037# pointed by the 1st argument. Returns 1 in EAX.
    4138#
    42 context_save_arch:
     39FUNCTION_BEGIN(context_save_arch)
    4340        movl 0(%esp), %eax      # save pc value into eax       
    4441        movl 4(%esp), %edx      # address of the context variable to save context to
     
    5552        incl %eax
    5653        ret
     54FUNCTION_END(context_save_arch)
    5755
    5856
     
    6260# pointed by the 1st argument. Returns 0 in EAX.
    6361#
    64 context_restore_arch:
     62FUNCTION_BEGIN(context_restore_arch)
    6563        movl 4(%esp), %eax      # address of the context variable to restore context from
    6664
     
    7674        xorl %eax, %eax         # context_restore returns 0
    7775        ret
    78 
     76FUNCTION_END(context_restore_arch)
  • kernel/arch/ia32/src/debug/stacktrace_asm.S

    r3a34852 r8844e70  
    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        movl %ebp, %eax
    3635        ret
     36FUNCTION_END(frame_pointer_get)
    3737
    38 program_counter_get:
     38FUNCTION_BEGIN(program_counter_get)
    3939        movl (%esp), %eax
    4040        ret
     41FUNCTION_END(program_counter_get)
  • kernel/arch/ia32/src/delay.S

    r3a34852 r8844e70  
    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        movl 4(%esp),%ecx       # move argument to %ecx
    40390:      lahf
     
    4241        jnz 0b
    4342        ret
     43FUNCTION_END(asm_delay_loop)
    4444
    45 asm_fake_loop:
     45FUNCTION_BEGIN(asm_fake_loop)
    4646        movl 4(%esp),%ecx       # move argument to %ecx
    47470:      lahf
     
    4949        jz 0b
    5050        ret
     51FUNCTION_END(asm_fake_loop)
     52
  • kernel/arch/ia32/src/smp/ap.S

    r3a34852 r8844e70  
    3232 */
    3333
     34#include <abi/asmtool.h>
    3435#include <arch/boot/boot.h>
    3536#include <arch/boot/memmap.h>
     
    4041
    4142#ifdef CONFIG_SMP
    42 
    43 .global unmapped_ap_boot
    4443
    4544KTEXT=8
     
    5352
    5453.align 4096
    55 unmapped_ap_boot:
     54SYMBOL(unmapped_ap_boot)
    5655.code16
    5756        cli
     
    9998#ifdef CONFIG_SMP
    10099
    101 .global unmapped_ap_gdtr
    102 
    103 unmapped_ap_gdtr:
     100SYMBOL(unmapped_ap_gdtr)
    104101        .word 0
    105102        .long 0
  • uspace/lib/c/arch/ia32/Makefile.inc

    r3a34852 r8844e70  
    2929ARCH_SOURCES = \
    3030        arch/$(UARCH)/src/entry.S \
    31         arch/$(UARCH)/src/entryjmp.s \
    32         arch/$(UARCH)/src/thread_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/ia32/src/entry.S

    r3a34852 r8844e70  
    2727#
    2828
     29#include <abi/asmtool.h>
     30
    2931INTEL_CPUID_STANDARD = 1
    3032INTEL_SEP = 11
     
    3436.org 0
    3537
    36 .globl __entry
    37 
    3838## User-space task entry point
    3939#
    4040# %edi contains the PCB pointer
    4141#
    42 __entry:
     42SYMBOL(__entry)
    4343        mov %ss, %ax
    4444        mov %ax, %ds
  • uspace/lib/c/arch/ia32/src/entryjmp.S

    r3a34852 r8844e70  
    2727#
    2828
    29 .globl entry_point_jmp
     29#include <abi/asmtool.h>
    3030
    3131## void entry_point_jmp(void *entry_point, void *pcb);
    3232#
    3333# Jump to program entry point
    34 entry_point_jmp:
     34SYMBOL(entry_point_jmp)
    3535        # Use standard ia32 prologue not to confuse anybody
    3636        push %ebp
  • uspace/lib/c/arch/ia32/src/stacktrace_asm.S

    r3a34852 r8844e70  
    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        movl %ebp, %eax
    4039        ret
     40FUNCTION_END(stacktrace_fp_get)
    4141
    42 stacktrace_pc_get:
     42FUNCTION_BEGIN(stacktrace_pc_get)
    4343        movl (%esp), %eax
    4444        ret
     45FUNCTION_END(stacktrace_pc_get)
  • uspace/lib/c/arch/ia32/src/syscall.S

    r3a34852 r8844e70  
    2727#
    2828
     29#include <abi/asmtool.h>
     30
    2931.data
    3032
    31 .global __syscall_fast_func
    32 __syscall_fast_func:
     33OBJECT_BEGIN(__syscall_fast_func)
    3334        .long __syscall_slow
    34         .size __syscall_fast_func, . - __syscall_fast_func
     35OBJECT_END(__syscall_fast_func)
    3536
    3637.text
     
    4243 * could benefit from this and not save unused registers on the stack.
    4344 */
    44 .global __syscall_slow
    45 __syscall_slow:
     45FUNCTION_BEGIN(__syscall_slow)
    4646        pushl %ebx
    4747        pushl %esi
     
    6161        popl %ebx
    6262        ret
     63FUNCTION_END(__syscall_slow)
    6364
    6465
     
    7172 * segment, otherwise the SYSENTER wouldn't work in the first place).
    7273 */
    73 .global __syscall_fast
    74         .type __syscall_fast, @function
    75 
    76 __syscall_fast:
     74FUNCTION_BEGIN(__syscall_fast)
    7775        pushl %ebx
    7876        pushl %esi
     
    9896        popl %ebx
    9997        ret
    100 
    101         .size __syscall_fast, . - __syscall_fast
     98FUNCTION_END(__syscall_fast)
  • uspace/lib/c/arch/ia32/src/thread_entry.S

    r3a34852 r8844e70  
    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        mov %ss, %dx
    3838        mov %dx, %ds
     
    5757        # Not reached.
    5858        #
    59        
    60 .end __thread_entry
     59SYMBOL_END(__thread_entry)
Note: See TracChangeset for help on using the changeset viewer.