From dc4ef04e7ce88d8a618cd81c0ae875a90ddada4f Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Wed, 22 May 2013 22:06:18 +0200 Subject: [PATCH] Add assembly file symbol sizes. --- libc/x64/crt1.s | 1 + libc/x64/fork.s | 2 +- libc/x64/signal.s | 4 ++-- libc/x64/syscall.s | 3 +-- libc/x86/crt1.s | 1 + libc/x86/fork.s | 2 +- libc/x86/signal.s | 1 + libc/x86/syscall.s | 1 + sortix/x64/base.s | 14 ++++++-------- sortix/x64/boot.s | 10 +++++----- sortix/x64/calltrace.s | 2 +- sortix/x64/gdt.s | 2 ++ sortix/x64/idt.s | 2 +- sortix/x64/interrupt.s | 5 ++++- sortix/x64/kthread.s | 4 ++++ sortix/x64/syscall.s | 2 ++ sortix/x86/base.s | 11 ++++++----- sortix/x86/boot.s | 14 ++++++-------- sortix/x86/calltrace.s | 2 +- sortix/x86/gdt.s | 2 ++ sortix/x86/idt.s | 1 + sortix/x86/interrupt.s | 5 ++++- sortix/x86/kthread.s | 5 +++++ sortix/x86/syscall.s | 2 ++ 24 files changed, 61 insertions(+), 37 deletions(-) diff --git a/libc/x64/crt1.s b/libc/x64/crt1.s index 48eb9f7e..bd1e7deb 100644 --- a/libc/x64/crt1.s +++ b/libc/x64/crt1.s @@ -52,3 +52,4 @@ _start: # Terminate the process with main's exit code. movl %eax, %edi call exit +.size _start, .-_start diff --git a/libc/x64/fork.s b/libc/x64/fork.s index 783b81b5..4a2d9e29 100644 --- a/libc/x64/fork.s +++ b/libc/x64/fork.s @@ -64,4 +64,4 @@ after_fork: # which does that for us. leaveq retq - +.size __call_tfork_with_regs, . - __call_tfork_with_regs diff --git a/libc/x64/signal.s b/libc/x64/signal.s index a859e122..28e090ed 100644 --- a/libc/x64/signal.s +++ b/libc/x64/signal.s @@ -22,10 +22,9 @@ *******************************************************************************/ -.globl SignalHandlerAssembly - .section .text +.global SignalHandlerAssembly .type SignalHandlerAssembly, @function SignalHandlerAssembly: @@ -34,3 +33,4 @@ SignalHandlerAssembly: # Return control to the kernel, so normal execution can continue. int $131 +.size SignalHandlerAssembly, . - SignalHandlerAssembly diff --git a/libc/x64/syscall.s b/libc/x64/syscall.s index b21149bc..422bb08f 100644 --- a/libc/x64/syscall.s +++ b/libc/x64/syscall.s @@ -31,8 +31,6 @@ # clobbered: %rdi, %rsi, %r8, %r9, %r10, %r11 # preserved: %rbx, %rsp, %rbp, %r12, %r13, %r14, %r15 -.section .text - .global asm_syscall asm_syscall: /* syscall num in %rax. */ push %rbp @@ -58,3 +56,4 @@ asm_syscall: /* syscall num in %rax. */ pop %rbx pop %rbp ret +.size asm_syscall, .-asm_syscall diff --git a/libc/x86/crt1.s b/libc/x86/crt1.s index c66a7946..98bf2422 100644 --- a/libc/x86/crt1.s +++ b/libc/x86/crt1.s @@ -52,3 +52,4 @@ _start: # Terminate the process with main's exit code. push %eax call exit +.size _start, .-_start diff --git a/libc/x86/fork.s b/libc/x86/fork.s index 7d7da628..74b6ef91 100644 --- a/libc/x86/fork.s +++ b/libc/x86/fork.s @@ -59,4 +59,4 @@ after_fork: # which does that for us. leavel retl - +.size __call_tfork_with_regs, . - __call_tfork_with_regs diff --git a/libc/x86/signal.s b/libc/x86/signal.s index bf262c3f..5126b7f1 100644 --- a/libc/x86/signal.s +++ b/libc/x86/signal.s @@ -38,3 +38,4 @@ SignalHandlerAssembly: # Return control to the kernel, so normal execution can continue. int $131 +.size SignalHandlerAssembly, . - SignalHandlerAssembly diff --git a/libc/x86/syscall.s b/libc/x86/syscall.s index baede451..1b42c469 100644 --- a/libc/x86/syscall.s +++ b/libc/x86/syscall.s @@ -62,3 +62,4 @@ asm_syscall: /* syscall num in %eax. */ pop %ebx pop %ebp ret +.size asm_syscall, .-asm_syscall diff --git a/sortix/x64/base.s b/sortix/x64/base.s index ab401ac3..cb9f1342 100644 --- a/sortix/x64/base.s +++ b/sortix/x64/base.s @@ -23,14 +23,11 @@ ******************************************************************************/ -.globl beginkernel, _beginkernel -.globl start, _start - .section .text -.type _beginkernel, @function +.global beginkernel +.type beginkernel, @function beginkernel: -_beginkernel: movw $0x736, 0xB83E8 movw $0x734, 0xB83EA movw $0x753, 0xB83EE @@ -54,16 +51,17 @@ _beginkernel: mov %rax, %rdi call KernelInit +.size beginkernel, . - beginkernel -.globl HaltKernel +.global HaltKernel HaltKernel: cli hlt jmp HaltKernel +.size HaltKernel, . - HaltKernel -.globl WaitForInterrupt +.global WaitForInterrupt .type WaitForInterrupt, @function # void WaitForInterrupt(); WaitForInterrupt: hlt ret - diff --git a/sortix/x64/boot.s b/sortix/x64/boot.s index 636a4b83..19a71e62 100644 --- a/sortix/x64/boot.s +++ b/sortix/x64/boot.s @@ -23,13 +23,12 @@ ******************************************************************************/ -.globl start, _start - .section .text -.text 0x100000 +.text 0x100000 + +.global _start .type _start, @function .code32 -start: _start: jmp prepare_kernel_execution @@ -145,6 +144,7 @@ Realm64: # Alright, that was the bootstrap code. Now begin preparing to run the # actual 64-bit kernel. jmp Main +.size _start, . - _start .section .data GDT64: # Global Descriptor Table (64-bit). @@ -194,4 +194,4 @@ Main: mov 0x100004, %eax jmp beginkernel - +.size Main, . - Main diff --git a/sortix/x64/calltrace.s b/sortix/x64/calltrace.s index 85302d0b..114759d2 100644 --- a/sortix/x64/calltrace.s +++ b/sortix/x64/calltrace.s @@ -49,4 +49,4 @@ calltrace_done: popq %rbx popq %rbp retq - +.size calltrace, . - calltrace diff --git a/sortix/x64/gdt.s b/sortix/x64/gdt.s index eaf0fa76..ce439bcb 100644 --- a/sortix/x64/gdt.s +++ b/sortix/x64/gdt.s @@ -43,6 +43,7 @@ gdt_flush: ljmp *(%rax) gdt_flush_postjmp: ret +.size gdt_flush, . - gdt_flush .global tss_flush .type tss_flush, @function @@ -55,6 +56,7 @@ tss_flush: # Load the task state register. ltr %ax ret +.size tss_flush, . - tss_flush .section .data GDT_FLUSH_POSTJMP: diff --git a/sortix/x64/idt.s b/sortix/x64/idt.s index c3365514..f64ec0b9 100644 --- a/sortix/x64/idt.s +++ b/sortix/x64/idt.s @@ -30,4 +30,4 @@ idt_flush: # Load the IDT pointer. lidt (%rdi) ret - +.size idt_flush, . - idt_flush diff --git a/sortix/x64/interrupt.s b/sortix/x64/interrupt.s index 7f3af21d..44d88c7f 100644 --- a/sortix/x64/interrupt.s +++ b/sortix/x64/interrupt.s @@ -486,11 +486,13 @@ load_interrupted_registers: # Return to where we came from. iretq +.size interrupt_handler_prepare, . - interrupt_handler_prepare .global interrupt_handler_null .type interrupt_handler_null, @function interrupt_handler_null: iretq +.size interrupt_handler_null, . - interrupt_handler_null .global asm_interrupts_are_enabled .type asm_interrupts_are_enabled, @function @@ -499,6 +501,7 @@ asm_interrupts_are_enabled: popq %rax andq $0x000200, %rax # FLAGS_INTERRUPT retq +.size asm_interrupts_are_enabled, . - asm_interrupts_are_enabled .global load_registers .type load_registers, @function @@ -506,4 +509,4 @@ load_registers: # Let the register struct become our temporary stack movq %rdi, %rsp jmp load_interrupted_registers - +.size load_registers, . - load_registers diff --git a/sortix/x64/kthread.s b/sortix/x64/kthread.s index 3921e9bd..20d8ddde 100644 --- a/sortix/x64/kthread.s +++ b/sortix/x64/kthread.s @@ -34,6 +34,7 @@ kthread_mutex_trylock: not %eax leaveq retq +.size kthread_mutex_trylock, . - kthread_mutex_trylock .global kthread_mutex_lock .type kthread_mutex_lock, @function @@ -50,6 +51,7 @@ kthread_mutex_lock_retry: kthread_mutex_lock_failed: int $0x81 # Yield the CPU. jmp kthread_mutex_lock_retry +.size kthread_mutex_lock, . - kthread_mutex_lock .global kthread_mutex_lock_signal .type kthread_mutex_lock_signal, @function @@ -74,6 +76,7 @@ kthread_mutex_lock_signal_failed: kthread_mutex_lock_signal_pending: xorl %eax, %eax jmp kthread_mutex_lock_signal_out +.size kthread_mutex_lock_signal, . - kthread_mutex_lock_signal .global kthread_mutex_unlock .type kthread_mutex_unlock, @function @@ -83,3 +86,4 @@ kthread_mutex_unlock: movl $0, (%rdi) leaveq retq +.size kthread_mutex_unlock, . - kthread_mutex_unlock diff --git a/sortix/x64/syscall.s b/sortix/x64/syscall.s index 9c6b27a7..73df53a3 100644 --- a/sortix/x64/syscall.s +++ b/sortix/x64/syscall.s @@ -93,3 +93,5 @@ call_signal_dispatcher: # If we end up here, it means that the signal didn't override anything and # that we should just go ahead and return to userspace ourselves. iretq + +.size syscall_handler, .-syscall_handler diff --git a/sortix/x86/base.s b/sortix/x86/base.s index 6c2a71ce..db6c3748 100644 --- a/sortix/x86/base.s +++ b/sortix/x86/base.s @@ -23,11 +23,9 @@ ******************************************************************************/ -.globl beginkernel, _beginkernel - .section .text -.text 0x100000 +.global beginkernel .type beginkernel, @function beginkernel: # Initialize the stack pointer. The magic value is from kernel.cpp. @@ -47,15 +45,18 @@ beginkernel: cli call KernelInit +.size beginkernel, . - beginkernel -.globl HaltKernel +.global HaltKernel HaltKernel: cli hlt jmp HaltKernel +.size HaltKernel, . - HaltKernel -.globl WaitForInterrupt +.global WaitForInterrupt .type WaitForInterrupt, @function # void WaitForInterrupt(); WaitForInterrupt: hlt ret +.size WaitForInterrupt, . - WaitForInterrupt diff --git a/sortix/x86/boot.s b/sortix/x86/boot.s index 63a990ba..b65c3d22 100644 --- a/sortix/x86/boot.s +++ b/sortix/x86/boot.s @@ -23,27 +23,25 @@ ******************************************************************************/ -.globl start, _start - .section .text +.text 0x100000 -.text 0x100000 +.global _start .type _start, @function -start: _start: jmp prepare_kernel_execution # Align 32 bits boundary. - .align 4 + .align 4 # Multiboot header. multiboot_header: # Magic. - .long 0x1BADB002 + .long 0x1BADB002 # Flags. - .long 0x00000003 + .long 0x00000003 # Checksum. - .long -(0x1BADB002 + 0x00000003) + .long -(0x1BADB002 + 0x00000003) prepare_kernel_execution: # Enable the floating point unit. diff --git a/sortix/x86/calltrace.s b/sortix/x86/calltrace.s index d9a8f219..414b2f68 100644 --- a/sortix/x86/calltrace.s +++ b/sortix/x86/calltrace.s @@ -51,4 +51,4 @@ calltrace_done: popl %ebx popl %ebp retl - +.size calltrace, . - calltrace diff --git a/sortix/x86/gdt.s b/sortix/x86/gdt.s index bb020982..eceb9f04 100644 --- a/sortix/x86/gdt.s +++ b/sortix/x86/gdt.s @@ -44,6 +44,7 @@ gdt_flush: ljmp *(%eax) gdt_flush_postjmp: ret +.size gdt_flush, . - gdt_flush .global tss_flush .type tss_flush, @function @@ -56,6 +57,7 @@ tss_flush: # Load the task state register. ltr %ax ret +.size tss_flush, . - tss_flush .section .data GDT_FLUSH_POSTJMP: diff --git a/sortix/x86/idt.s b/sortix/x86/idt.s index 39ee2fb7..cffddb3c 100644 --- a/sortix/x86/idt.s +++ b/sortix/x86/idt.s @@ -31,3 +31,4 @@ idt_flush: mov 4(%esp), %eax lidt (%eax) ret +.size idt_flush, . - idt_flush diff --git a/sortix/x86/interrupt.s b/sortix/x86/interrupt.s index bcc1ae1f..7b8551cd 100644 --- a/sortix/x86/interrupt.s +++ b/sortix/x86/interrupt.s @@ -572,11 +572,13 @@ fixup_switch_stack: mov -20(%esp), %ecx # restore interrupted ecx value jmp fixup_switch_stack_complete +.size interrupt_handler_prepare, . - interrupt_handler_prepare .global interrupt_handler_null .type interrupt_handler_null, @function interrupt_handler_null: iret +.size interrupt_handler_null, . - interrupt_handler_null .global asm_interrupts_are_enabled .type asm_interrupts_are_enabled, @function @@ -585,6 +587,7 @@ asm_interrupts_are_enabled: popl %eax andl $0x000200, %eax # FLAGS_INTERRUPT retl +.size asm_interrupts_are_enabled, . - asm_interrupts_are_enabled .global load_registers .type load_registers, @function @@ -592,4 +595,4 @@ load_registers: # Let the register struct become our temporary stack movl 4(%esp), %esp jmp load_interrupted_registers - +.size load_registers, . - load_registers diff --git a/sortix/x86/kthread.s b/sortix/x86/kthread.s index 9d311ecb..301b1881 100644 --- a/sortix/x86/kthread.s +++ b/sortix/x86/kthread.s @@ -35,6 +35,7 @@ kthread_mutex_trylock: not %eax leavel retl +.size kthread_mutex_trylock, . - kthread_mutex_trylock .global kthread_mutex_lock .type kthread_mutex_lock, @function @@ -52,6 +53,7 @@ kthread_mutex_lock_retry: kthread_mutex_lock_failed: int $0x81 # Yield the CPU. jmp kthread_mutex_lock_retry +.size kthread_mutex_lock, . - kthread_mutex_lock .global kthread_mutex_lock_signal .type kthread_mutex_lock_signal, @function @@ -87,6 +89,7 @@ kthread_mutex_unlock: movl $0, (%edx) leavel retl +.size kthread_mutex_lock_signal, . - kthread_mutex_lock_signal .global asm_call_BootstrapKernelThread .type asm_call_BootstrapKernelThread, @function @@ -95,6 +98,7 @@ asm_call_BootstrapKernelThread: pushl %edi call BootstrapKernelThread # BootstrapKernelThread is noreturn, no need for code here. +.size asm_call_BootstrapKernelThread, . - asm_call_BootstrapKernelThread .global asm_call_Thread__OnSigKill .type asm_call_Thread__OnSigKill, @function @@ -102,3 +106,4 @@ asm_call_Thread__OnSigKill: pushl %edi call Thread__OnSigKill # Thread__OnSigKill is noreturn, no need for code here. +.size asm_call_Thread__OnSigKill, . - asm_call_Thread__OnSigKill diff --git a/sortix/x86/syscall.s b/sortix/x86/syscall.s index 4c321968..0f412152 100644 --- a/sortix/x86/syscall.s +++ b/sortix/x86/syscall.s @@ -95,3 +95,5 @@ call_signal_dispatcher: # If we end up here, it means that the signal didn't override anything and # that we should just go ahead and return to userspace ourselves. iretl + +.size syscall_handler, .-syscall_handler