Skip to content

Commit

Permalink
picocrt: Adapt x86 crt0 code for old clang assembler
Browse files Browse the repository at this point in the history
Before clang-12, the built-in x86 assembler seems to treat prefixes as
separate instructions. This meant that it wouldn't allow them on the
same source line as the rest of the instruction. Split out the 'cs'
prefix used in the x86 crt0 code to a separate line so that old clang
versions can also assemble the code.

Signed-off-by: Keith Packard <[email protected]>
  • Loading branch information
keith-packard committed Oct 1, 2024
1 parent de31e5a commit 45cf4dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion picocrt/machine/x86/crt0-32.S
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
.type start, @function
_start:
.code16
cs lgdtl gdt_desc - _start + 0x10
cs
lgdtl gdt_desc - _start + 0x10
mov $1, %eax
mov %eax, %cr0
ljmpl $0x10,$_start32
Expand Down
3 changes: 2 additions & 1 deletion picocrt/machine/x86/crt0-64.S
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
.type start, @function
_start:
.code16
cs lgdtl gdt_desc - _start + 0x10
cs
lgdtl gdt_desc - _start + 0x10

# enable sse and pae
mov $0x620, %eax
Expand Down

0 comments on commit 45cf4dc

Please sign in to comment.