mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 19:34:43 +01:00
This is similar to commit 5e921ff49e
which moved the pcb for amd64, but a bit different. arm64's pcb is
much larger (over 1KB!) than amd64's since it still embeds FP
registers. Moving the pcb out of the kstack frees up that much
additional kstack space. Unlike amd64 however, embedding the pcb in
struct mdthread is not practical as the resulting struct thread would
grow such that UMA would now store 1 thread per 4k page instead of 2
threads per page. By using a separate UMA zone for pcbs, 2 struct
threads can continue to fit in a single 4k page, and 3 pcbs can fit in
another 4k page.
Reviewed by: kib, jrtc27, andrew
Sponsored by: AFRL, DARPA
Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
57 lines
2.0 KiB
C
57 lines
2.0 KiB
C
/*-
|
|
* Copyright (c) 2001 Jake Burkholder.
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*/
|
|
|
|
#ifndef _MACHINE_STACK_H_
|
|
#define _MACHINE_STACK_H_
|
|
|
|
#define INKERNEL(va) \
|
|
((va) >= VM_MIN_KERNEL_ADDRESS && (va) <= VM_MAX_KERNEL_ADDRESS)
|
|
|
|
struct unwind_state {
|
|
uintptr_t fp;
|
|
uintptr_t pc;
|
|
};
|
|
|
|
bool unwind_frame(struct thread *, struct unwind_state *);
|
|
|
|
#ifdef _SYS_PROC_H_
|
|
|
|
#define GET_STACK_USAGE(total, used) do { \
|
|
struct thread *td = curthread; \
|
|
(total) = ptoa(td->td_kstack_pages); \
|
|
(used) = td->td_kstack + (total) - (char *)&td; \
|
|
} while (0)
|
|
|
|
static __inline bool
|
|
kstack_contains(struct thread *td, vm_offset_t va, size_t len)
|
|
{
|
|
return (va >= (vm_offset_t)td->td_kstack && va + len >= va &&
|
|
va + len <= (vm_offset_t)td_kstack_top(td));
|
|
}
|
|
#endif /* _SYS_PROC_H_ */
|
|
|
|
#endif /* !_MACHINE_STACK_H_ */
|