* Renamed kernel_startup to gKernelStartup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26731 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
15374c5dbd
commit
272457553e
@ -47,7 +47,7 @@
|
|||||||
#define CLEAR_BIT(a, b) ((a) & (~(1 << (b))))
|
#define CLEAR_BIT(a, b) ((a) & (~(1 << (b))))
|
||||||
|
|
||||||
/* during kernel startup, interrupts are disabled (among other things) */
|
/* during kernel startup, interrupts are disabled (among other things) */
|
||||||
extern bool kernel_startup;
|
extern bool gKernelStartup;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -260,7 +260,7 @@ class Free : public AbstractTraceEntry {
|
|||||||
|
|
||||||
} // namespace KernelHeapTracing
|
} // namespace KernelHeapTracing
|
||||||
|
|
||||||
# define T(x) if (!kernel_startup) new(std::nothrow) KernelHeapTracing::x;
|
# define T(x) if (!gKernelStartup) new(std::nothrow) KernelHeapTracing::x;
|
||||||
#else
|
#else
|
||||||
# define T(x) ;
|
# define T(x) ;
|
||||||
#endif
|
#endif
|
||||||
@ -1211,8 +1211,8 @@ heap_raw_alloc(heap_allocator *heap, size_t size, uint32 binIndex)
|
|||||||
heap_leak_check_info *info = (heap_leak_check_info *)((addr_t)address
|
heap_leak_check_info *info = (heap_leak_check_info *)((addr_t)address
|
||||||
+ bin->element_size - sizeof(heap_leak_check_info));
|
+ bin->element_size - sizeof(heap_leak_check_info));
|
||||||
info->size = size - sizeof(heap_leak_check_info);
|
info->size = size - sizeof(heap_leak_check_info);
|
||||||
info->thread = (kernel_startup ? 0 : thread_get_current_thread_id());
|
info->thread = (gKernelStartup ? 0 : thread_get_current_thread_id());
|
||||||
info->team = (kernel_startup ? 0 : team_get_current_team_id());
|
info->team = (gKernelStartup ? 0 : team_get_current_team_id());
|
||||||
info->caller = get_caller();
|
info->caller = get_caller();
|
||||||
#endif
|
#endif
|
||||||
return address;
|
return address;
|
||||||
@ -1231,8 +1231,8 @@ heap_raw_alloc(heap_allocator *heap, size_t size, uint32 binIndex)
|
|||||||
+ (firstPage->index + pageCount) * heap->page_size
|
+ (firstPage->index + pageCount) * heap->page_size
|
||||||
- sizeof(heap_leak_check_info));
|
- sizeof(heap_leak_check_info));
|
||||||
info->size = size - sizeof(heap_leak_check_info);
|
info->size = size - sizeof(heap_leak_check_info);
|
||||||
info->thread = (kernel_startup ? 0 : thread_get_current_thread_id());
|
info->thread = (gKernelStartup ? 0 : thread_get_current_thread_id());
|
||||||
info->team = (kernel_startup ? 0 : team_get_current_team_id());
|
info->team = (gKernelStartup ? 0 : team_get_current_team_id());
|
||||||
info->caller = get_caller();
|
info->caller = get_caller();
|
||||||
#endif
|
#endif
|
||||||
return (void *)(firstPage->area->base + firstPage->index * heap->page_size);
|
return (void *)(firstPage->area->base + firstPage->index * heap->page_size);
|
||||||
@ -1759,12 +1759,12 @@ heap_init_post_thread()
|
|||||||
void *
|
void *
|
||||||
memalign(size_t alignment, size_t size)
|
memalign(size_t alignment, size_t size)
|
||||||
{
|
{
|
||||||
if (!kernel_startup && !are_interrupts_enabled()) {
|
if (!gKernelStartup && !are_interrupts_enabled()) {
|
||||||
panic("memalign(): called with interrupts disabled\n");
|
panic("memalign(): called with interrupts disabled\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!kernel_startup && size > HEAP_AREA_USE_THRESHOLD) {
|
if (!gKernelStartup && size > HEAP_AREA_USE_THRESHOLD) {
|
||||||
// don't even attempt such a huge allocation - use areas instead
|
// don't even attempt such a huge allocation - use areas instead
|
||||||
size_t areaSize = size + sizeof(area_allocation_info);
|
size_t areaSize = size + sizeof(area_allocation_info);
|
||||||
if (alignment != 0)
|
if (alignment != 0)
|
||||||
@ -1875,7 +1875,7 @@ malloc(size_t size)
|
|||||||
void
|
void
|
||||||
free(void *address)
|
free(void *address)
|
||||||
{
|
{
|
||||||
if (!kernel_startup && !are_interrupts_enabled()) {
|
if (!gKernelStartup && !are_interrupts_enabled()) {
|
||||||
panic("free(): called with interrupts disabled\n");
|
panic("free(): called with interrupts disabled\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1917,7 +1917,7 @@ free(void *address)
|
|||||||
void *
|
void *
|
||||||
realloc(void *address, size_t newSize)
|
realloc(void *address, size_t newSize)
|
||||||
{
|
{
|
||||||
if (!kernel_startup && !are_interrupts_enabled()) {
|
if (!gKernelStartup && !are_interrupts_enabled()) {
|
||||||
panic("realloc(): called with interrupts disabled\n");
|
panic("realloc(): called with interrupts disabled\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ recursive_lock_lock(recursive_lock *lock)
|
|||||||
{
|
{
|
||||||
thread_id thread = thread_get_current_thread_id();
|
thread_id thread = thread_get_current_thread_id();
|
||||||
|
|
||||||
if (!kernel_startup && !are_interrupts_enabled()) {
|
if (!gKernelStartup && !are_interrupts_enabled()) {
|
||||||
panic("recursive_lock_lock: called with interrupts disabled for lock "
|
panic("recursive_lock_lock: called with interrupts disabled for lock "
|
||||||
"%p (\"%s\")\n", lock, lock->lock.name);
|
"%p (\"%s\")\n", lock, lock->lock.name);
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ recursive_lock_trylock(recursive_lock *lock)
|
|||||||
{
|
{
|
||||||
thread_id thread = thread_get_current_thread_id();
|
thread_id thread = thread_get_current_thread_id();
|
||||||
|
|
||||||
if (!kernel_startup && !are_interrupts_enabled())
|
if (!gKernelStartup && !are_interrupts_enabled())
|
||||||
panic("recursive_lock_lock: called with interrupts disabled for lock "
|
panic("recursive_lock_lock: called with interrupts disabled for lock "
|
||||||
"%p (\"%s\")\n", lock, lock->lock.name);
|
"%p (\"%s\")\n", lock, lock->lock.name);
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ status_t
|
|||||||
_mutex_lock(mutex* lock, bool threadsLocked)
|
_mutex_lock(mutex* lock, bool threadsLocked)
|
||||||
{
|
{
|
||||||
#ifdef KDEBUG
|
#ifdef KDEBUG
|
||||||
if (!kernel_startup && !threadsLocked && !are_interrupts_enabled()) {
|
if (!gKernelStartup && !threadsLocked && !are_interrupts_enabled()) {
|
||||||
panic("_mutex_lock(): called with interrupts disabled for lock %p",
|
panic("_mutex_lock(): called with interrupts disabled for lock %p",
|
||||||
lock);
|
lock);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
# define TRACE(x...) ;
|
# define TRACE(x...) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool kernel_startup = true;
|
bool gKernelStartup = true;
|
||||||
|
|
||||||
static kernel_args sKernelArgs;
|
static kernel_args sKernelArgs;
|
||||||
static uint32 sCpuRendezvous;
|
static uint32 sCpuRendezvous;
|
||||||
@ -191,7 +191,7 @@ _start(kernel_args *bootKernelArgs, int currentCPU)
|
|||||||
|
|
||||||
// exit the kernel startup phase (mutexes, etc work from now on out)
|
// exit the kernel startup phase (mutexes, etc work from now on out)
|
||||||
TRACE("exiting kernel startup\n");
|
TRACE("exiting kernel startup\n");
|
||||||
kernel_startup = false;
|
gKernelStartup = false;
|
||||||
|
|
||||||
smp_cpu_rendezvous(&sCpuRendezvous2, 0);
|
smp_cpu_rendezvous(&sCpuRendezvous2, 0);
|
||||||
// release the AP cpus to go enter the scheduler
|
// release the AP cpus to go enter the scheduler
|
||||||
|
@ -711,7 +711,7 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count,
|
|||||||
int state;
|
int state;
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
|
|
||||||
if (kernel_startup)
|
if (gKernelStartup)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
if (sSemsActive == false)
|
if (sSemsActive == false)
|
||||||
return B_NO_MORE_SEMS;
|
return B_NO_MORE_SEMS;
|
||||||
@ -869,7 +869,7 @@ release_sem_etc(sem_id id, int32 count, uint32 flags)
|
|||||||
{
|
{
|
||||||
int32 slot = id % sMaxSems;
|
int32 slot = id % sMaxSems;
|
||||||
|
|
||||||
if (kernel_startup)
|
if (gKernelStartup)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
if (sSemsActive == false)
|
if (sSemsActive == false)
|
||||||
return B_NO_MORE_SEMS;
|
return B_NO_MORE_SEMS;
|
||||||
|
@ -1744,7 +1744,7 @@ vm_create_anonymous_area(team_id team, const char *name, void **address,
|
|||||||
vm_translation_map *map = &addressSpace->translation_map;
|
vm_translation_map *map = &addressSpace->translation_map;
|
||||||
off_t offset = 0;
|
off_t offset = 0;
|
||||||
|
|
||||||
if (!kernel_startup)
|
if (!gKernelStartup)
|
||||||
panic("ALREADY_WIRED flag used outside kernel startup\n");
|
panic("ALREADY_WIRED flag used outside kernel startup\n");
|
||||||
|
|
||||||
cache->Lock();
|
cache->Lock();
|
||||||
@ -2918,16 +2918,16 @@ display_mem(int argc, char **argv)
|
|||||||
|
|
||||||
address = ROUNDOWN(address, B_PAGE_SIZE);
|
address = ROUNDOWN(address, B_PAGE_SIZE);
|
||||||
|
|
||||||
kernel_startup = true;
|
gKernelStartup = true;
|
||||||
// vm_get_physical_page() needs to lock...
|
// vm_get_physical_page() needs to lock...
|
||||||
|
|
||||||
if (vm_get_physical_page(address, ©Address, PHYSICAL_PAGE_NO_WAIT) != B_OK) {
|
if (vm_get_physical_page(address, ©Address, PHYSICAL_PAGE_NO_WAIT) != B_OK) {
|
||||||
kprintf("getting the hardware page failed.");
|
kprintf("getting the hardware page failed.");
|
||||||
kernel_startup = false;
|
gKernelStartup = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel_startup = false;
|
gKernelStartup = false;
|
||||||
address += offset;
|
address += offset;
|
||||||
copyAddress += offset;
|
copyAddress += offset;
|
||||||
} else
|
} else
|
||||||
@ -3015,9 +3015,9 @@ display_mem(int argc, char **argv)
|
|||||||
|
|
||||||
if (physical) {
|
if (physical) {
|
||||||
copyAddress = ROUNDOWN(copyAddress, B_PAGE_SIZE);
|
copyAddress = ROUNDOWN(copyAddress, B_PAGE_SIZE);
|
||||||
kernel_startup = true;
|
gKernelStartup = true;
|
||||||
vm_put_physical_page(copyAddress);
|
vm_put_physical_page(copyAddress);
|
||||||
kernel_startup = false;
|
gKernelStartup = false;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -321,7 +321,7 @@ parse_parameters(struct driver_parameter **_parameters, int *_count,
|
|||||||
* sizeof(struct driver_parameter));
|
* sizeof(struct driver_parameter));
|
||||||
if (newArray == NULL)
|
if (newArray == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
memcpy(&newArray[*_count], ¶meter, sizeof(struct driver_parameter));
|
memcpy(&newArray[*_count], ¶meter, sizeof(struct driver_parameter));
|
||||||
newParameter = &newArray[*_count];
|
newParameter = &newArray[*_count];
|
||||||
|
|
||||||
@ -688,7 +688,7 @@ load_driver_settings(const char *driverName)
|
|||||||
{
|
{
|
||||||
settings_handle *handle;
|
settings_handle *handle;
|
||||||
int file = -1;
|
int file = -1;
|
||||||
|
|
||||||
if (driverName == NULL)
|
if (driverName == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -715,7 +715,7 @@ load_driver_settings(const char *driverName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we are allowed to call the driver settings pretty early in the boot process
|
// we are allowed to call the driver settings pretty early in the boot process
|
||||||
if (kernel_startup) {
|
if (gKernelStartup) {
|
||||||
mutex_unlock(&sLock);
|
mutex_unlock(&sLock);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user