View | Details | Raw Unified | Return to bug 262691 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/arm64/arm64/swtch.S (-51 / +27 lines)
Lines 94-111 ENTRY(cpu_throw) Link Here
94
	msr	tpidr_el0, x6
94
	msr	tpidr_el0, x6
95
	ldr	x6, [x4, #PCB_TPIDRRO]
95
	ldr	x6, [x4, #PCB_TPIDRRO]
96
	msr	tpidrro_el0, x6
96
	msr	tpidrro_el0, x6
97
	ldp	x8, x9, [x4, #PCB_REGS + 8 * 8]
97
	ldp	x19, x20, [x4, #PCB_REGS + 19 * 8]
98
	ldp	x10, x11, [x4, #PCB_REGS + 10 * 8]
98
	ldp	x21, x22, [x4, #PCB_REGS + 21 * 8]
99
	ldp	x12, x13, [x4, #PCB_REGS + 12 * 8]
99
	ldp	x23, x24, [x4, #PCB_REGS + 23 * 8]
100
	ldp	x14, x15, [x4, #PCB_REGS + 14 * 8]
100
	ldp	x25, x26, [x4, #PCB_REGS + 25 * 8]
101
	ldp	x16, x17, [x4, #PCB_REGS + 16 * 8]
101
	ldp	x27, x28, [x4, #PCB_REGS + 27 * 8]
102
	ldr	     x19, [x4, #PCB_REGS + 19 * 8]
102
	ldp	x29, lr, [x4, #PCB_REGS + 29 * 8]
103
	ldp	x20, x21, [x4, #PCB_REGS + 20 * 8]
104
	ldp	x22, x23, [x4, #PCB_REGS + 22 * 8]
105
	ldp	x24, x25, [x4, #PCB_REGS + 24 * 8]
106
	ldp	x26, x27, [x4, #PCB_REGS + 26 * 8]
107
	ldp	x28, x29, [x4, #PCB_REGS + 28 * 8]
108
	ldr	lr, [x4, #PCB_LR]
109
103
110
	ret
104
	ret
111
END(cpu_throw)
105
END(cpu_throw)
Lines 125-142 ENTRY(cpu_switch) Link Here
125
	ldr	x4, [x0, #TD_PCB]
119
	ldr	x4, [x0, #TD_PCB]
126
120
127
	/* Store the callee-saved registers */
121
	/* Store the callee-saved registers */
128
	stp	x8, x9, [x4, #PCB_REGS + 8 * 8]
122
	stp	x19, x20, [x4, #PCB_REGS + 19 * 8]
129
	stp	x10, x11, [x4, #PCB_REGS + 10 * 8]
123
	stp	x21, x22, [x4, #PCB_REGS + 21 * 8]
130
	stp	x12, x13, [x4, #PCB_REGS + 12 * 8]
124
	stp	x23, x24, [x4, #PCB_REGS + 23 * 8]
131
	stp	x14, x15, [x4, #PCB_REGS + 14 * 8]
125
	stp	x25, x26, [x4, #PCB_REGS + 25 * 8]
132
	stp	x16, x17, [x4, #PCB_REGS + 16 * 8]
126
	stp	x27, x28, [x4, #PCB_REGS + 27 * 8]
133
	stp	x18, x19, [x4, #PCB_REGS + 18 * 8]
127
	stp	x29, lr, [x4, #PCB_REGS + 29 * 8]
134
	stp	x20, x21, [x4, #PCB_REGS + 20 * 8]
135
	stp	x22, x23, [x4, #PCB_REGS + 22 * 8]
136
	stp	x24, x25, [x4, #PCB_REGS + 24 * 8]
137
	stp	x26, x27, [x4, #PCB_REGS + 26 * 8]
138
	stp	x28, x29, [x4, #PCB_REGS + 28 * 8]
139
	str	lr, [x4, #PCB_LR]
140
	/* And the old stack pointer */
128
	/* And the old stack pointer */
141
	mov	x5, sp
129
	mov	x5, sp
142
	mrs	x6, tpidrro_el0
130
	mrs	x6, tpidrro_el0
Lines 195-220 ENTRY(cpu_switch) Link Here
195
	msr	tpidr_el0, x6
183
	msr	tpidr_el0, x6
196
	ldr	x6, [x4, #PCB_TPIDRRO]
184
	ldr	x6, [x4, #PCB_TPIDRRO]
197
	msr	tpidrro_el0, x6
185
	msr	tpidrro_el0, x6
198
	ldp	x8, x9, [x4, #PCB_REGS + 8 * 8]
186
	ldp	x19, x20, [x4, #PCB_REGS + 19 * 8]
199
	ldp	x10, x11, [x4, #PCB_REGS + 10 * 8]
187
	ldp	x21, x22, [x4, #PCB_REGS + 21 * 8]
200
	ldp	x12, x13, [x4, #PCB_REGS + 12 * 8]
188
	ldp	x23, x24, [x4, #PCB_REGS + 23 * 8]
201
	ldp	x14, x15, [x4, #PCB_REGS + 14 * 8]
189
	ldp	x25, x26, [x4, #PCB_REGS + 25 * 8]
202
	ldp	x16, x17, [x4, #PCB_REGS + 16 * 8]
190
	ldp	x27, x28, [x4, #PCB_REGS + 27 * 8]
203
	ldr	     x19, [x4, #PCB_REGS + 19 * 8]
191
	ldp	x29, lr, [x4, #PCB_REGS + 29 * 8]
204
	ldp	x20, x21, [x4, #PCB_REGS + 20 * 8]
205
	ldp	x22, x23, [x4, #PCB_REGS + 22 * 8]
206
	ldp	x24, x25, [x4, #PCB_REGS + 24 * 8]
207
	ldp	x26, x27, [x4, #PCB_REGS + 26 * 8]
208
	ldp	x28, x29, [x4, #PCB_REGS + 28 * 8]
209
	ldr	lr, [x4, #PCB_LR]
210
192
211
	str	xzr, [x4, #PCB_REGS + 18 * 8]
193
	str	xzr, [x4, #PCB_REGS + 18 * 8]
212
	ret
194
	ret
213
END(cpu_switch)
195
END(cpu_switch)
214
196
215
ENTRY(fork_trampoline)
197
ENTRY(fork_trampoline)
216
	mov	x0, x8
198
	mov	x0, x19
217
	mov	x1, x9
199
	mov	x1, x20
218
	mov	x2, sp
200
	mov	x2, sp
219
	mov	fp, #0	/* Stack traceback stops here. */
201
	mov	fp, #0	/* Stack traceback stops here. */
220
	bl	_C_LABEL(fork_exit)
202
	bl	_C_LABEL(fork_exit)
Lines 258-280 ENTRY(fork_trampoline) Link Here
258
	 * will be set to the desired value anyway.
240
	 * will be set to the desired value anyway.
259
	 */
241
	 */
260
	ERET
242
	ERET
261
	
243
262
END(fork_trampoline)
244
END(fork_trampoline)
263
245
264
ENTRY(savectx)
246
ENTRY(savectx)
265
	/* Store the callee-saved registers */
247
	/* Store the callee-saved registers */
266
	stp	x8,  x9,  [x0, #PCB_REGS + 8 * 8]
248
	stp	x19, x20, [x0, #PCB_REGS + 19 * 8]
267
	stp	x10, x11, [x0, #PCB_REGS + 10 * 8]
249
	stp	x21, x22, [x0, #PCB_REGS + 21 * 8]
268
	stp	x12, x13, [x0, #PCB_REGS + 12 * 8]
250
	stp	x23, x24, [x0, #PCB_REGS + 23 * 8]
269
	stp	x14, x15, [x0, #PCB_REGS + 14 * 8]
251
	stp	x25, x26, [x0, #PCB_REGS + 25 * 8]
270
	stp	x16, x17, [x0, #PCB_REGS + 16 * 8]
252
	stp	x27, x28, [x0, #PCB_REGS + 27 * 8]
271
	stp	x18, x19, [x0, #PCB_REGS + 18 * 8]
253
	stp	x29, lr, [x0, #PCB_REGS + 29 * 8]
272
	stp	x20, x21, [x0, #PCB_REGS + 20 * 8]
273
	stp	x22, x23, [x0, #PCB_REGS + 22 * 8]
274
	stp	x24, x25, [x0, #PCB_REGS + 24 * 8]
275
	stp	x26, x27, [x0, #PCB_REGS + 26 * 8]
276
	stp	x28, x29, [x0, #PCB_REGS + 28 * 8]
277
	str	lr, [x0, #PCB_LR]
278
	/* And the old stack pointer */
254
	/* And the old stack pointer */
279
	mov	x5, sp
255
	mov	x5, sp
280
	mrs	x6, tpidrro_el0
256
	mrs	x6, tpidrro_el0
(-)b/sys/arm64/arm64/vm_machdep.c (-6 / +6 lines)
Lines 105-112 cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) Link Here
105
	td2->td_frame = tf;
105
	td2->td_frame = tf;
106
106
107
	/* Set the return value registers for fork() */
107
	/* Set the return value registers for fork() */
108
	td2->td_pcb->pcb_x[8] = (uintptr_t)fork_return;
108
	td2->td_pcb->pcb_x[19] = (uintptr_t)fork_return;
109
	td2->td_pcb->pcb_x[9] = (uintptr_t)td2;
109
	td2->td_pcb->pcb_x[20] = (uintptr_t)td2;
110
	td2->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
110
	td2->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
111
	td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame;
111
	td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame;
112
	td2->td_pcb->pcb_fpusaved = &td2->td_pcb->pcb_fpustate;
112
	td2->td_pcb->pcb_fpusaved = &td2->td_pcb->pcb_fpustate;
Lines 183-190 cpu_copy_thread(struct thread *td, struct thread *td0) Link Here
183
	bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
183
	bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
184
	bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb));
184
	bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb));
185
185
186
	td->td_pcb->pcb_x[8] = (uintptr_t)fork_return;
186
	td->td_pcb->pcb_x[19] = (uintptr_t)fork_return;
187
	td->td_pcb->pcb_x[9] = (uintptr_t)td;
187
	td->td_pcb->pcb_x[20] = (uintptr_t)td;
188
	td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
188
	td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
189
	td->td_pcb->pcb_sp = (uintptr_t)td->td_frame;
189
	td->td_pcb->pcb_sp = (uintptr_t)td->td_frame;
190
	td->td_pcb->pcb_fpflags &= ~(PCB_FP_STARTED | PCB_FP_KERN | PCB_FP_NOSAVE);
190
	td->td_pcb->pcb_fpflags &= ~(PCB_FP_STARTED | PCB_FP_KERN | PCB_FP_NOSAVE);
Lines 287-294 void Link Here
287
cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg)
287
cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg)
288
{
288
{
289
289
290
	td->td_pcb->pcb_x[8] = (uintptr_t)func;
290
	td->td_pcb->pcb_x[19] = (uintptr_t)func;
291
	td->td_pcb->pcb_x[9] = (uintptr_t)arg;
291
	td->td_pcb->pcb_x[20] = (uintptr_t)arg;
292
}
292
}
293
293
294
void
294
void

Return to bug 262691