- Use kmem_malloc rather than kmem_alloc() for GDT/LDT/tss allocations etc.
This eliminates some unusual uses of that API in favor of more typical uses of kmem_malloc(). Discussed with: kib/alc Tested by: pho Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
dcd47379ff
commit
2f84c08eee
@ -356,8 +356,8 @@ amd64_set_ioperm(td, uap)
|
||||
*/
|
||||
pcb = td->td_pcb;
|
||||
if (pcb->pcb_tssp == NULL) {
|
||||
tssp = (struct amd64tss *)kmem_alloc(kernel_map,
|
||||
ctob(IOPAGES+1));
|
||||
tssp = (struct amd64tss *)kmem_malloc(kernel_map,
|
||||
ctob(IOPAGES+1), M_WAITOK);
|
||||
if (tssp == NULL)
|
||||
return (ENOMEM);
|
||||
iomap = (char *)&tssp[1];
|
||||
@ -463,8 +463,9 @@ user_ldt_alloc(struct proc *p, int force)
|
||||
return (mdp->md_ldt);
|
||||
mtx_unlock(&dt_lock);
|
||||
new_ldt = malloc(sizeof(struct proc_ldt), M_SUBPROC, M_WAITOK);
|
||||
new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map,
|
||||
max_ldt_segment * sizeof(struct user_segment_descriptor));
|
||||
new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_map,
|
||||
max_ldt_segment * sizeof(struct user_segment_descriptor),
|
||||
M_WAITOK);
|
||||
if (new_ldt->ldt_base == NULL) {
|
||||
FREE(new_ldt, M_SUBPROC);
|
||||
mtx_lock(&dt_lock);
|
||||
|
@ -164,8 +164,9 @@ sysarch(td, uap)
|
||||
break;
|
||||
case I386_SET_LDT:
|
||||
if (kargs.largs.descs != NULL) {
|
||||
lp = (union descriptor *)kmem_alloc(kernel_map,
|
||||
kargs.largs.num * sizeof(union descriptor));
|
||||
lp = (union descriptor *)kmem_malloc(kernel_map,
|
||||
kargs.largs.num * sizeof(union descriptor),
|
||||
M_WAITOK);
|
||||
if (lp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
@ -298,7 +299,8 @@ i386_extend_pcb(struct thread *td)
|
||||
0 /* granularity */
|
||||
};
|
||||
|
||||
ext = (struct pcb_ext *)kmem_alloc(kernel_map, ctob(IOPAGES+1));
|
||||
ext = (struct pcb_ext *)kmem_malloc(kernel_map, ctob(IOPAGES+1),
|
||||
M_WAITOK);
|
||||
if (ext == 0)
|
||||
return (ENOMEM);
|
||||
bzero(ext, sizeof(struct pcb_ext));
|
||||
@ -471,8 +473,8 @@ user_ldt_alloc(struct mdproc *mdp, int len)
|
||||
M_SUBPROC, M_WAITOK);
|
||||
|
||||
new_ldt->ldt_len = len = NEW_MAX_LD(len);
|
||||
new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map,
|
||||
round_page(len * sizeof(union descriptor)));
|
||||
new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_map,
|
||||
round_page(len * sizeof(union descriptor)), M_WAITOK);
|
||||
if (new_ldt->ldt_base == NULL) {
|
||||
free(new_ldt, M_SUBPROC);
|
||||
mtx_lock_spin(&dt_lock);
|
||||
@ -511,8 +513,8 @@ user_ldt_alloc(struct mdproc *mdp, int len)
|
||||
M_SUBPROC, M_WAITOK);
|
||||
|
||||
new_ldt->ldt_len = len = NEW_MAX_LD(len);
|
||||
new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map,
|
||||
len * sizeof(union descriptor));
|
||||
new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_map,
|
||||
len * sizeof(union descriptor), M_WAITOK);
|
||||
if (new_ldt->ldt_base == NULL) {
|
||||
free(new_ldt, M_SUBPROC);
|
||||
mtx_lock_spin(&dt_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user