Changeset a5c78a18 in mainline for uspace/lib/c/arch/amd64


Ignore:
Timestamp:
2019-02-03T14:35:44Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b4f1171
Parents:
67ca359
Message:

Rename context_t to context_t

<libarch/fibril_context.h> is included from <setjmp.h> where it can interfere
with identifiers used in third-party code.
The simplest solution here is just to prefix the names with double underscore
which is reserved for use by the implementation.

Location:
uspace/lib/c/arch/amd64
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/amd64/include/libarch/fibril_context.h

    r67ca359 ra5c78a18  
    3030#define LIBC_ARCH_FIBRIL_CONTEXT_H_
    3131
    32 #define CONTEXT_OFFSET_SP   0x00
    33 #define CONTEXT_OFFSET_PC   0x08
    34 #define CONTEXT_OFFSET_RBX  0x10
    35 #define CONTEXT_OFFSET_RBP  0x18
    36 #define CONTEXT_OFFSET_R12  0x20
    37 #define CONTEXT_OFFSET_R13  0x28
    38 #define CONTEXT_OFFSET_R14  0x30
    39 #define CONTEXT_OFFSET_R15  0x38
    40 #define CONTEXT_OFFSET_TLS  0x40
    41 #define CONTEXT_SIZE        0x48
     32#define __CONTEXT_OFFSET_SP   0x00
     33#define __CONTEXT_OFFSET_PC   0x08
     34#define __CONTEXT_OFFSET_RBX  0x10
     35#define __CONTEXT_OFFSET_RBP  0x18
     36#define __CONTEXT_OFFSET_R12  0x20
     37#define __CONTEXT_OFFSET_R13  0x28
     38#define __CONTEXT_OFFSET_R14  0x30
     39#define __CONTEXT_OFFSET_R15  0x38
     40#define __CONTEXT_OFFSET_TLS  0x40
     41#define __CONTEXT_SIZE        0x48
    4242
    4343#ifndef __ASSEMBLER__
     
    4545#include <stdint.h>
    4646
    47 typedef struct context {
     47typedef struct __context {
    4848        /*
    4949         * We include only registers that must be preserved
     
    5959        uint64_t r15;
    6060        uint64_t tls;
    61 } context_t;
     61} __context_t;
    6262
    6363#endif
  • uspace/lib/c/arch/amd64/src/fibril.S

    r67ca359 ra5c78a18  
    4141
    4242        # in %rdi is passed 1st argument
    43         movq %rdx, CONTEXT_OFFSET_PC(%rdi)
    44         movq %rsp, CONTEXT_OFFSET_SP(%rdi)
     43        movq %rdx, __CONTEXT_OFFSET_PC(%rdi)
     44        movq %rsp, __CONTEXT_OFFSET_SP(%rdi)
    4545
    46         movq %rbx, CONTEXT_OFFSET_RBX(%rdi)
    47         movq %rbp, CONTEXT_OFFSET_RBP(%rdi)
    48         movq %r12, CONTEXT_OFFSET_R12(%rdi)
    49         movq %r13, CONTEXT_OFFSET_R13(%rdi)
    50         movq %r14, CONTEXT_OFFSET_R14(%rdi)
    51         movq %r15, CONTEXT_OFFSET_R15(%rdi)
     46        movq %rbx, __CONTEXT_OFFSET_RBX(%rdi)
     47        movq %rbp, __CONTEXT_OFFSET_RBP(%rdi)
     48        movq %r12, __CONTEXT_OFFSET_R12(%rdi)
     49        movq %r13, __CONTEXT_OFFSET_R13(%rdi)
     50        movq %r14, __CONTEXT_OFFSET_R14(%rdi)
     51        movq %r15, __CONTEXT_OFFSET_R15(%rdi)
    5252
    5353        movq %fs:0, %rax
    54         movq %rax, CONTEXT_OFFSET_TLS(%rdi)
     54        movq %rax, __CONTEXT_OFFSET_TLS(%rdi)
    5555
    5656        xorq %rax, %rax                      # __setjmp returns 0
     
    6464#
    6565FUNCTION_BEGIN(__longjmp)
    66         movq CONTEXT_OFFSET_R15(%rdi), %r15
    67         movq CONTEXT_OFFSET_R14(%rdi), %r14
    68         movq CONTEXT_OFFSET_R13(%rdi), %r13
    69         movq CONTEXT_OFFSET_R12(%rdi), %r12
    70         movq CONTEXT_OFFSET_RBP(%rdi), %rbp
    71         movq CONTEXT_OFFSET_RBX(%rdi), %rbx
     66        movq __CONTEXT_OFFSET_R15(%rdi), %r15
     67        movq __CONTEXT_OFFSET_R14(%rdi), %r14
     68        movq __CONTEXT_OFFSET_R13(%rdi), %r13
     69        movq __CONTEXT_OFFSET_R12(%rdi), %r12
     70        movq __CONTEXT_OFFSET_RBP(%rdi), %rbp
     71        movq __CONTEXT_OFFSET_RBX(%rdi), %rbx
    7272
    73         movq CONTEXT_OFFSET_SP(%rdi), %rsp   # ctx->sp -> %rsp
     73        movq __CONTEXT_OFFSET_SP(%rdi), %rsp   # ctx->sp -> %rsp
    7474
    75         movq CONTEXT_OFFSET_PC(%rdi), %rdx
     75        movq __CONTEXT_OFFSET_PC(%rdi), %rdx
    7676
    7777        movq %rdx,(%rsp)
    7878
    79         movq CONTEXT_OFFSET_TLS(%rdi), %rdi
     79        movq __CONTEXT_OFFSET_TLS(%rdi), %rdi
    8080        movq %rdi, %fs:0
    8181
Note: See TracChangeset for help on using the changeset viewer.