Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metal] Fix bug: do not initialize IDT & TSS if unneeded #654

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ape/ape.lds
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,6 @@ HIDDEN(v_ape_realsectors =
HIDDEN(v_ape_realpages = v_ape_realsectors / (4096 / 512));
HIDDEN(v_ape_highsectors =
(ROUNDUP(RVA(_edata), 512) / 512) - v_ape_realsectors);
PROVIDE_HIDDEN(_tss = 0);
PROVIDE_HIDDEN(_tss_end = 0);
TSSDESCSTUB2(_tss, _tss, _tss_end ? _tss_end - _tss - 1 : 0);
#endif

Expand Down
8 changes: 8 additions & 0 deletions ape/macros.internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@

// Task State Segment Descriptor Entries.
.macro .tssdescstub name:req
.ifndef \name
.weak \name
.set \name,0
.endif
.ifndef \name\()_end
.weak \name\()_end
.set \name\()_end,0
.endif
.stub \name\()_desc_ent0,quad
.stub \name\()_desc_ent1,quad
.endm
Expand Down
6 changes: 3 additions & 3 deletions libc/intrin/interrupts.S
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ __excep0_isr:
ezlea .excep_msg,di # stack should be 16-byte aligned now
xor %eax,%eax # kprintf is variadic, remember to
# pass no. of vector regs. used (= 0)
.weak kprintf # weakly link kprintf() because this
ezlea kprintf,bx # module is a mandatory dependency
test %ebx,%ebx # and we want to keep life.com tiny
.weak kprintf # weakly link kprintf() because we
ezlea kprintf,bx # want to keep life.com tiny
test %ebx,%ebx
jz 8f
call *%rbx # print error message
8: cli
Expand Down