MCPcopy Index your code
hub / github.com/F-Stack/f-stack / ff_freebsd_init

Function ff_freebsd_init

lib/ff_freebsd_init.c:123–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123int
124ff_freebsd_init(void)
125{
126 int boot_pages;
127 unsigned int num_hash_buckets;
128 char tmpbuf[32] = {0};
129 void *bootmem;
130 int error;
131
132 snprintf(tmpbuf, sizeof(tmpbuf), "%u", ff_global_cfg.freebsd.hz);
133 error = kern_setenv("kern.hz", tmpbuf);
134 if (error != 0) {
135 panic("kern_setenv failed: kern.hz=%s\n", tmpbuf);
136 }
137
138 struct ff_freebsd_cfg *cur;
139 cur = ff_global_cfg.freebsd.boot;
140 while (cur) {
141 error = kern_setenv(cur->name, cur->str);
142 if (error != 0) {
143 printf("kern_setenv failed: %s=%s\n", cur->name, cur->str);
144 }
145
146 cur = cur->next;
147 }
148
149 physmem = ff_global_cfg.freebsd.physmem;
150
151 pcpup = malloc(sizeof(struct pcpu), M_DEVBUF, M_ZERO);
152 pcpu_init(pcpup, 0, sizeof(struct pcpu));
153 PCPU_SET(prvspace, pcpup);
154 CPU_SET(0, &all_cpus);
155
156 ff_init_thread0();
157
158 boot_pages = 16;
159 bootmem = (void *)kmem_malloc(boot_pages*PAGE_SIZE, M_ZERO);
160 //uma_startup(bootmem, boot_pages);
161 uma_startup1((vm_offset_t)bootmem);
162 uma_startup2();
163
164 num_hash_buckets = 8192;
165 uma_page_slab_hash = (struct uma_page_head *)kmem_malloc(sizeof(struct uma_page)*num_hash_buckets, M_ZERO);
166 uma_page_mask = num_hash_buckets - 1;
167
168 mutex_init();
169 mi_startup();
170 sx_init(&proctree_lock, "proctree");
171 ff_fdused_range(ff_global_cfg.freebsd.fd_reserve);
172
173 cur = ff_global_cfg.freebsd.sysctl;
174 while (cur) {
175 error = kernel_sysctlbyname(curthread, cur->name, NULL, NULL,
176 cur->value, cur->vlen, NULL, 0);
177
178 if (error != 0) {
179 printf("kernel_sysctlbyname failed: %s=%s, error:%d\n",
180 cur->name, cur->str, error);

Callers 1

ff_initFunction · 0.85

Calls 15

snprintfFunction · 0.85
mallocFunction · 0.85
pcpu_initFunction · 0.85
ff_init_thread0Function · 0.85
uma_startup1Function · 0.85
uma_startup2Function · 0.85
ff_fdused_rangeFunction · 0.85
kernel_sysctlbynameFunction · 0.85
lo_set_defaultaddrFunction · 0.85
kern_setenvFunction · 0.70
panicFunction · 0.70
printfFunction · 0.70

Tested by

no test coverage detected