diff options
author | Alex Richardson <alexrichardson@google.com> | 2023-06-07 14:31:07 -0700 |
---|---|---|
committer | Alex Richardson <alexrichardson@google.com> | 2023-06-07 15:55:50 -0700 |
commit | e3a463e5857fb2ff736c21a00ab69cb6a20f9938 (patch) | |
tree | 62feaeb9d13adeacb11cfd01844ead892fdcfcab | |
parent | c2a31bf8a6bbced04d9c63325a2de24842dbb780 (diff) | |
download | lk-e3a463e5857fb2ff736c21a00ab69cb6a20f9938.tar.gz |
[x86][clang] Allow clang to evaluate isr_stub_len
The current code results in
`error: invalid reassignment of non-absolute variable 'isr_stub_start'`.
Use a numbered label instead (as that can be reassigned) and reference
the last occurrence using the b suffix.
-rw-r--r-- | arch/x86/32/exceptions.S | 9 | ||||
-rw-r--r-- | arch/x86/64/exceptions.S | 8 |
2 files changed, 8 insertions, 9 deletions
diff --git a/arch/x86/32/exceptions.S b/arch/x86/32/exceptions.S index 8ca8771b..98ac81f1 100644 --- a/arch/x86/32/exceptions.S +++ b/arch/x86/32/exceptions.S @@ -21,8 +21,7 @@ _isr: .set i, 0 .rept NUM_INT -.set isr_stub_start, . - +100: /* unnamed label for start of isr stub */ .if i == 8 || (i >= 10 && i <= 14) || i == 17 nop /* error code pushed by exception */ nop /* 2 nops are the same length as push byte */ @@ -34,12 +33,12 @@ _isr: jmp interrupt_common .endif -/* figure out the length of a single isr stub (usually 6 or 9 bytes) */ -.set isr_stub_len, . - isr_stub_start - .set i, i + 1 .endr +/* figure out the length of a single isr stub (usually 6 or 9 bytes) */ +.set isr_stub_len, . - 100b + /* annoying, but force AS to use the same (longer) encoding of jmp for all of the stubs */ .fill 256 diff --git a/arch/x86/64/exceptions.S b/arch/x86/64/exceptions.S index e66c53ce..86a54827 100644 --- a/arch/x86/64/exceptions.S +++ b/arch/x86/64/exceptions.S @@ -26,7 +26,7 @@ _isr: .set i, 0 .rept NUM_INT -.set isr_stub_start, . +100: /* unnamed label for start of isr stub */ .if i == 8 || (i >= 10 && i <= 14) || i == 17 .align 16 @@ -43,12 +43,12 @@ _isr: .align 16 .endif -/* figure out the length of a single isr stub (usually 6 or 9 bytes) */ -.set isr_stub_len, . - isr_stub_start - .set i, i + 1 .endr +/* figure out the length of a single isr stub (usually 6 or 9 bytes) */ +.set isr_stub_len, . - 100b + /* annoying, but force AS to use the same (longer) encoding of jmp for all of the stubs */ .fill 256 |