|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * This file contains a thread that is used to do some random stuff on PPC machines.
24: * So far, we used it to adjust the number of free mappings.
25: *
26: */
27:
28: #include <cpus.h>
29: #include <debug.h>
30: #include <mach_kgdb.h>
31: #include <mach_vm_debug.h>
32: #include <db_machine_commands.h>
33:
34: #include <kern/thread.h>
35: #include <mach/vm_attributes.h>
36: #include <mach/vm_param.h>
37: #include <vm/vm_kern.h>
38: #include <vm/vm_map.h>
39: #include <vm/vm_page.h>
40: #include <kern/spl.h>
41:
42: #include <kern/misc_protos.h>
43: #include <ppc/misc_protos.h>
44: #include <ppc/proc_reg.h>
45: #include <ppc/mem.h>
46: #include <ppc/pmap.h>
47: #include <ppc/pmap_internals.h>
48: #include <ppc/new_screen.h>
49: #include <ppc/Firmware.h>
50: #include <ppc/mappings.h>
51: #include <ppc/miscserv.h>
52: #include <ddb/db_output.h>
53:
54: unsigned int missy_run; /* Run request */
55: decl_simple_lock_data(,missy_lock)
56:
57: void missy_serv(void) { /* Do various stuff */
58:
59: thread_t thread;
60: processor_set_t pset;
61: kern_return_t ret;
62: policy_base_t base;
63: policy_limit_t limit;
64: policy_fifo_base_data_t fifo_base;
65: policy_fifo_limit_data_t fifo_limit;
66: spl_t s;
67:
68: simple_lock_init(&missy_lock, 0); /* Initialize our control lock */
69: thread = current_thread(); /* Find out who we are */
70: thread->vm_privilege = FALSE; /* Don't let us dip into the reserved pool */
71: stack_privilege(thread); /* We really need to keep our stack */
72:
73: pset = thread->processor_set; /* Where are we? */
74: base = (policy_base_t) &fifo_base; /* Get the base priority */
75: limit = (policy_limit_t) &fifo_limit;
76: fifo_base.base_priority = BASEPRI_KERNEL;
77: fifo_limit.max_priority = BASEPRI_KERNEL;
78: ret = thread_set_policy(thread->top_act, pset, POLICY_FIFO, /* Make sure we have really high priority */
79: base, POLICY_TIMESHARE_BASE_COUNT,
80: limit, POLICY_TIMESHARE_LIMIT_COUNT);
81: if (ret != KERN_SUCCESS) printf("missy_serv: we couldn't get fifo...\n");
82:
83: while(1) { /* Here we stay... */
84:
85: mapping_adjust(); /* Adjust mapping stuff */
86:
87: s = splhigh(); /* Don't bother from now on */
88: simple_lock(&missy_lock); /* Control ourselves */
89: assert_wait((event_t) &missy_run, THREAD_UNINT); /* Say that we will wait for this */
90: simple_unlock(&missy_lock); /* Uncontrol ourselves */
91: splx(s); /* Restore 'rupts */
92:
93: thread_block((void (*)(void)) 0); /* Wait for the next time */
94:
95: }
96: }
97:
98:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.