Skip to content

Commit 7cd3455

Browse files
author
sf
committed
Remove lapic TPR remnants on amd64
On amd64, the TPR register is also available via cr8. We use lcr8(0) to set it to 0 in the appropriate places. There is no need to touch it in lapic_map(). This means the only remaining symbol from the lapic MMIO page we use is local_apic. All other registers are expressed in offsets from that symbol via i82489_writereg/i82489_readreg(). Remove the other symbols. ok guenther@
1 parent 3ccc0e1 commit 7cd3455

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

sys/arch/amd64/amd64/lapic.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: lapic.c,v 1.74 2024/11/07 17:24:42 bluhm Exp $ */
1+
/* $OpenBSD: lapic.c,v 1.75 2025/08/02 07:33:28 sf Exp $ */
22
/* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */
33

44
/*-
@@ -179,10 +179,8 @@ lapic_map(paddr_t lapic_base)
179179
vaddr_t va;
180180
u_int64_t msr;
181181
u_long s;
182-
int tpr;
183182

184183
s = intr_disable();
185-
tpr = lapic_tpr;
186184

187185
msr = rdmsr(MSR_APICBASE);
188186

@@ -210,7 +208,6 @@ lapic_map(paddr_t lapic_base)
210208
x2apic_enabled = 1;
211209
codepatch_call(CPTAG_EOI, &x2apic_eoi);
212210

213-
lapic_writereg(LAPIC_TPRI, tpr);
214211
va = (vaddr_t)&local_apic;
215212
} else {
216213
/*
@@ -225,8 +222,6 @@ lapic_map(paddr_t lapic_base)
225222
pte = kvtopte(va);
226223
*pte = lapic_base | PG_RW | PG_V | PG_N | PG_G | pg_nx;
227224
invlpg(va);
228-
229-
lapic_tpr = tpr;
230225
}
231226

232227
/*

sys/arch/amd64/amd64/locore.S

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: locore.S,v 1.150 2025/02/02 05:45:20 guenther Exp $ */
1+
/* $OpenBSD: locore.S,v 1.151 2025/08/02 07:33:28 sf Exp $ */
22
/* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */
33

44
/*
@@ -148,18 +148,9 @@
148148

149149
#if NLAPIC > 0
150150
.align NBPG, 0xcc
151-
.globl local_apic, lapic_id, lapic_tpr
151+
.globl local_apic
152152
local_apic:
153-
.space LAPIC_ID
154-
lapic_id:
155-
.long 0x00000000
156-
.space LAPIC_TPRI-(LAPIC_ID+4)
157-
lapic_tpr:
158-
.space LAPIC_PPRI-LAPIC_TPRI
159-
lapic_ppr:
160-
.space LAPIC_ISR-LAPIC_PPRI
161-
lapic_isr:
162-
.space NBPG-LAPIC_ISR
153+
.space NBPG
163154
#endif
164155

165156
/*****************************************************************************/

0 commit comments

Comments
 (0)