Merge branch 'master' of ssh://git.haiku-os.org/haiku
This commit is contained in:
+3
-3
@@ -3,8 +3,8 @@
|
||||
* Copyright 2006, Jérôme Duval. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef __ACPI_PRIV_H__
|
||||
#define __ACPI_PRIV_H__
|
||||
#ifndef _ACPI_PRIVATE_H
|
||||
#define _ACPI_PRIVATE_H
|
||||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
@@ -227,4 +227,4 @@ status_t get_table(const char* signature, uint32 instance, void** tableHeader);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
#endif /* __ACPI_PRIV_H__ */
|
||||
#endif /* _ACPI_PRIVATE_H */
|
||||
+12
-7
@@ -20,11 +20,13 @@
|
||||
|
||||
#include <safemode.h>
|
||||
|
||||
extern "C" {
|
||||
#include "acpi.h"
|
||||
#include "accommon.h"
|
||||
#include "acdisasm.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acpi_priv.h"
|
||||
}
|
||||
#include "ACPIPrivate.h"
|
||||
|
||||
//#define TRACE_ACPI_BUS
|
||||
#ifdef TRACE_ACPI_BUS
|
||||
@@ -384,7 +386,7 @@ status_t
|
||||
install_fixed_event_handler(uint32 event, interrupt_handler* handler,
|
||||
void *data)
|
||||
{
|
||||
return AcpiInstallFixedEventHandler(event, (void*)handler, data) == AE_OK
|
||||
return AcpiInstallFixedEventHandler(event, (ACPI_EVENT_HANDLER)handler, data) == AE_OK
|
||||
? B_OK : B_ERROR;
|
||||
}
|
||||
|
||||
@@ -392,7 +394,7 @@ install_fixed_event_handler(uint32 event, interrupt_handler* handler,
|
||||
status_t
|
||||
remove_fixed_event_handler(uint32 event, interrupt_handler* handler)
|
||||
{
|
||||
return AcpiRemoveFixedEventHandler(event, (void*)handler) == AE_OK
|
||||
return AcpiRemoveFixedEventHandler(event, (ACPI_EVENT_HANDLER)handler) == AE_OK
|
||||
? B_OK : B_ERROR;
|
||||
}
|
||||
|
||||
@@ -441,7 +443,7 @@ get_device(const char* hid, uint32 index, char* result, size_t resultLength)
|
||||
char *buffer = NULL;
|
||||
|
||||
TRACE("get_device %s, index %ld\n", hid, index);
|
||||
status = AcpiGetDevices((ACPI_STRING)hid, (void*)&get_device_by_hid_callback,
|
||||
status = AcpiGetDevices((ACPI_STRING)hid, (ACPI_WALK_CALLBACK)&get_device_by_hid_callback,
|
||||
counter, (void**)&buffer);
|
||||
if (status != AE_OK || buffer == NULL)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
@@ -523,7 +525,7 @@ get_object(const char* path, acpi_object_type** _returnValue)
|
||||
|
||||
status = AcpiEvaluateObject(handle, NULL, NULL, &buffer);
|
||||
|
||||
*_returnValue = buffer.Pointer;
|
||||
*_returnValue = (acpi_object_type*)buffer.Pointer;
|
||||
return status == AE_OK ? B_OK : B_ERROR;
|
||||
}
|
||||
|
||||
@@ -545,7 +547,7 @@ get_object_typed(const char* path, acpi_object_type** _returnValue,
|
||||
|
||||
status = AcpiEvaluateObjectTyped(handle, NULL, NULL, &buffer, objectType);
|
||||
|
||||
*_returnValue = buffer.Pointer;
|
||||
*_returnValue = (acpi_object_type*)buffer.Pointer;
|
||||
return status == AE_OK ? B_OK : B_ERROR;
|
||||
}
|
||||
|
||||
@@ -642,7 +644,7 @@ prepare_sleep_state(uint8 state, void (*wakeFunc)(void), size_t size)
|
||||
status_t status;
|
||||
|
||||
// Note: The supplied code must already be locked into memory.
|
||||
status = get_memory_map(wakeFunc, size, &wakeVector, 1);
|
||||
status = get_memory_map((const void*)wakeFunc, size, &wakeVector, 1);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
@@ -676,7 +678,10 @@ enter_sleep_state(uint8 state, uint8 flags)
|
||||
|
||||
TRACE("enter_sleep_state %d with flags %d\n", state, flags);
|
||||
|
||||
cpu_status cpu = disable_interrupts();
|
||||
status = AcpiEnterSleepState(state, flags);
|
||||
restore_interrupts(cpu);
|
||||
panic("AcpiEnterSleepState should not return.");
|
||||
if (status != AE_OK)
|
||||
return B_ERROR;
|
||||
|
||||
+7
-10
@@ -9,8 +9,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "acpi_priv.h"
|
||||
#include "ACPIPrivate.h"
|
||||
extern "C" {
|
||||
#include "acpi.h"
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
@@ -77,8 +79,6 @@ acpi_device_init_driver(device_node *node, void **cookie)
|
||||
{
|
||||
ACPI_HANDLE handle;
|
||||
const char *path;
|
||||
acpi_device_cookie *device;
|
||||
status_t status = B_OK;
|
||||
uint32 type;
|
||||
|
||||
if (gDeviceManager->get_attr_uint32(node, ACPI_DEVICE_TYPE_ITEM, &type, false) != B_OK)
|
||||
@@ -86,7 +86,7 @@ acpi_device_init_driver(device_node *node, void **cookie)
|
||||
if (gDeviceManager->get_attr_string(node, ACPI_DEVICE_PATH_ITEM, &path, false) != B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
device = malloc(sizeof(*device));
|
||||
acpi_device_cookie *device = (acpi_device_cookie*)malloc(sizeof(*device));
|
||||
if (device == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
@@ -102,19 +102,16 @@ acpi_device_init_driver(device_node *node, void **cookie)
|
||||
device->type = type;
|
||||
device->node = node;
|
||||
|
||||
snprintf(device->name, sizeof(device->name), "acpi_device %s",
|
||||
path);
|
||||
|
||||
snprintf(device->name, sizeof(device->name), "acpi_device %s", path);
|
||||
*cookie = device;
|
||||
|
||||
return status;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
acpi_device_uninit_driver(void *cookie)
|
||||
{
|
||||
acpi_device_cookie *device = cookie;
|
||||
acpi_device_cookie *device = (acpi_device_cookie*)cookie;
|
||||
|
||||
free(device->path);
|
||||
free(device);
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "acpi_embedded_controller.h"
|
||||
#include "EmbeddedController.h"
|
||||
|
||||
#include <kernel.h>
|
||||
#include <stdio.h>
|
||||
+1
-1
@@ -44,7 +44,7 @@ extern "C" {
|
||||
# include "accommon.h"
|
||||
# include "acnamesp.h"
|
||||
# include "actypes.h"
|
||||
# include "acpi_priv.h"
|
||||
# include "ACPIPrivate.h"
|
||||
}
|
||||
|
||||
|
||||
@@ -200,12 +200,12 @@ SEARCH on [ FGristFiles $(tables_src) ] = [ FDirName $(HAIKU_TOP) src add-ons ke
|
||||
SEARCH on [ FGristFiles $(utilities_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi acpica components utilities ] ;
|
||||
|
||||
KernelAddon acpi :
|
||||
oshaiku.cpp
|
||||
acpi_busman.c
|
||||
acpi_module.c
|
||||
acpi_device.c
|
||||
acpi_ns_dump.cpp
|
||||
acpi_embedded_controller.cpp
|
||||
ACPICAHaiku.cpp
|
||||
BusManager.cpp
|
||||
Module.cpp
|
||||
Device.cpp
|
||||
NamespaceDump.cpp
|
||||
EmbeddedController.cpp
|
||||
SmallResourceData.cpp
|
||||
:
|
||||
libacpi_ca.a
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "acpi_priv.h"
|
||||
#include "ACPIPrivate.h"
|
||||
|
||||
#include <dpc.h>
|
||||
#include <PCI.h>
|
||||
@@ -126,7 +126,7 @@ acpi_enumerate_child_devices(device_node* node, const char* root)
|
||||
static status_t
|
||||
acpi_module_register_child_devices(void* cookie)
|
||||
{
|
||||
device_node* node = cookie;
|
||||
device_node* node = (device_node*)cookie;
|
||||
|
||||
status_t status = gDeviceManager->publish_device(node, "acpi/namespace",
|
||||
ACPI_NS_DUMP_DEVICE_MODULE_NAME);
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "acpi_priv.h"
|
||||
#include "ACPIPrivate.h"
|
||||
|
||||
#include <util/kernel_cpp.h>
|
||||
#include <util/ring_buffer.h>
|
||||
@@ -693,10 +693,12 @@ DwarfImageDebugInfo::GetStatement(FunctionDebugInfo* _function,
|
||||
int32 statementLine = -1;
|
||||
int32 statementColumn = -1;
|
||||
while (program.GetNextRow(state)) {
|
||||
bool isOurFile = state.file == fileIndex;
|
||||
// skip statements of other files
|
||||
if (state.file != fileIndex)
|
||||
continue;
|
||||
|
||||
if (statementAddress != 0
|
||||
&& (!isOurFile || state.isStatement || state.isSequenceEnd)) {
|
||||
&& (state.isStatement || state.isSequenceEnd)) {
|
||||
target_addr_t endAddress = state.address;
|
||||
if (address >= statementAddress && address < endAddress) {
|
||||
ContiguousStatement* statement = new(std::nothrow)
|
||||
@@ -714,10 +716,6 @@ DwarfImageDebugInfo::GetStatement(FunctionDebugInfo* _function,
|
||||
statementAddress = 0;
|
||||
}
|
||||
|
||||
// skip statements of other files
|
||||
if (!isOurFile)
|
||||
continue;
|
||||
|
||||
if (state.isStatement) {
|
||||
statementAddress = state.address;
|
||||
statementLine = state.line - 1;
|
||||
|
||||
@@ -2697,6 +2697,7 @@ DebugInfoEntryFactory::CreateDebugInfoEntry(uint16 tag, DebugInfoEntry*& _entry)
|
||||
entry = new(std::nothrow) DIESharedType;
|
||||
break;
|
||||
default:
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -825,8 +825,12 @@ DwarfFile::_ParseDebugInfoEntry(DataReader& dataReader,
|
||||
DebugInfoEntry* entry;
|
||||
status_t error = fDebugInfoFactory.CreateDebugInfoEntry(
|
||||
abbreviationEntry.Tag(), entry);
|
||||
if (error != B_OK)
|
||||
if (error != B_OK) {
|
||||
WARNING("Failed to generate entry for tag %lu, code %lu\n",
|
||||
abbreviationEntry.Tag(), code);
|
||||
return error;
|
||||
}
|
||||
|
||||
ObjectDeleter<DebugInfoEntry> entryDeleter(entry);
|
||||
|
||||
TRACE_DIE("%*sentry %p at %lld: %lu, tag: %s (%lu), children: %d\n",
|
||||
|
||||
@@ -251,9 +251,6 @@ InspectorWindow::MessageReceived(BMessage* msg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
BWindow::MessageReceived(msg);
|
||||
|
||||
@@ -109,6 +109,7 @@ TeamWindow::TeamWindow(::Team* team, UserInterfaceListener* listener)
|
||||
fStepOverButton(NULL),
|
||||
fStepIntoButton(NULL),
|
||||
fStepOutButton(NULL),
|
||||
fInspectorWindow(NULL),
|
||||
fSourceLocatePanel(NULL)
|
||||
{
|
||||
fTeam->Lock();
|
||||
@@ -237,6 +238,7 @@ TeamWindow::MessageReceived(BMessage* message)
|
||||
{
|
||||
_SaveInspectorSettings(CurrentMessage());
|
||||
fInspectorWindow = NULL;
|
||||
break;
|
||||
|
||||
}
|
||||
case B_REFS_RECEIVED:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2012, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@@ -7,10 +8,88 @@
|
||||
#include "IntegerFormatter.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <TypeConstants.h>
|
||||
|
||||
|
||||
static integer_format
|
||||
GetFormatForTypeAndFormat(type_code type, integer_format format,
|
||||
char* _formatString, int formatSize)
|
||||
{
|
||||
integer_format result = format;
|
||||
_formatString[0] = '%';
|
||||
++_formatString;
|
||||
formatSize -= 1;
|
||||
|
||||
switch (type) {
|
||||
case B_INT8_TYPE:
|
||||
switch (format) {
|
||||
case INTEGER_FORMAT_HEX_DEFAULT:
|
||||
result = INTEGER_FORMAT_HEX_8;
|
||||
break;
|
||||
case INTEGER_FORMAT_SIGNED:
|
||||
strlcpy(_formatString, B_PRId8, formatSize);
|
||||
break;
|
||||
case INTEGER_FORMAT_UNSIGNED:
|
||||
strlcpy(_formatString, B_PRIu8, formatSize);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case B_INT16_TYPE:
|
||||
switch (format) {
|
||||
case INTEGER_FORMAT_HEX_DEFAULT:
|
||||
result = INTEGER_FORMAT_HEX_16;
|
||||
break;
|
||||
case INTEGER_FORMAT_SIGNED:
|
||||
strlcpy(_formatString, B_PRId16, formatSize);
|
||||
break;
|
||||
case INTEGER_FORMAT_UNSIGNED:
|
||||
strlcpy(_formatString, B_PRIu16, formatSize);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case B_INT32_TYPE:
|
||||
switch (format) {
|
||||
case INTEGER_FORMAT_HEX_DEFAULT:
|
||||
result = INTEGER_FORMAT_HEX_32;
|
||||
break;
|
||||
case INTEGER_FORMAT_SIGNED:
|
||||
strlcpy(_formatString, B_PRId32, formatSize);
|
||||
break;
|
||||
case INTEGER_FORMAT_UNSIGNED:
|
||||
strlcpy(_formatString, B_PRIu32, formatSize);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case B_INT64_TYPE:
|
||||
default:
|
||||
switch (format) {
|
||||
case INTEGER_FORMAT_HEX_DEFAULT:
|
||||
result = INTEGER_FORMAT_HEX_64;
|
||||
break;
|
||||
case INTEGER_FORMAT_SIGNED:
|
||||
strlcpy(_formatString, B_PRId64, formatSize);
|
||||
break;
|
||||
case INTEGER_FORMAT_UNSIGNED:
|
||||
strlcpy(_formatString, B_PRIu64, formatSize);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*static*/ bool
|
||||
IntegerFormatter::FormatValue(const BVariant& value, integer_format format,
|
||||
char* buffer, size_t bufferSize)
|
||||
@@ -19,38 +98,30 @@ IntegerFormatter::FormatValue(const BVariant& value, integer_format format,
|
||||
if (!value.IsInteger(&isSigned))
|
||||
return false;
|
||||
|
||||
if (format == INTEGER_FORMAT_DEFAULT)
|
||||
format = isSigned ? INTEGER_FORMAT_SIGNED : INTEGER_FORMAT_UNSIGNED;
|
||||
char formatString[10];
|
||||
|
||||
if (format == INTEGER_FORMAT_HEX_DEFAULT) {
|
||||
switch (value.Type()) {
|
||||
case B_INT8_TYPE:
|
||||
case B_UINT8_TYPE:
|
||||
format = INTEGER_FORMAT_HEX_8;
|
||||
break;
|
||||
case B_INT16_TYPE:
|
||||
case B_UINT16_TYPE:
|
||||
format = INTEGER_FORMAT_HEX_16;
|
||||
break;
|
||||
case B_INT32_TYPE:
|
||||
case B_UINT32_TYPE:
|
||||
format = INTEGER_FORMAT_HEX_32;
|
||||
break;
|
||||
case B_INT64_TYPE:
|
||||
case B_UINT64_TYPE:
|
||||
default:
|
||||
format = INTEGER_FORMAT_HEX_64;
|
||||
break;
|
||||
}
|
||||
if (format == INTEGER_FORMAT_DEFAULT) {
|
||||
format = isSigned ? INTEGER_FORMAT_SIGNED : INTEGER_FORMAT_UNSIGNED;
|
||||
}
|
||||
|
||||
format = GetFormatForTypeAndFormat(value.Type(), format, formatString,
|
||||
sizeof(formatString));
|
||||
|
||||
// format the value
|
||||
switch (format) {
|
||||
case INTEGER_FORMAT_SIGNED:
|
||||
snprintf(buffer, bufferSize, "%lld", value.ToInt64());
|
||||
snprintf(buffer, bufferSize, formatString,
|
||||
value.Type() == B_INT8_TYPE ? value.ToInt8() :
|
||||
value.Type() == B_INT16_TYPE ? value.ToInt16() :
|
||||
value.Type() == B_INT32_TYPE ? value.ToInt32() :
|
||||
value.ToInt64());
|
||||
break;
|
||||
case INTEGER_FORMAT_UNSIGNED:
|
||||
snprintf(buffer, bufferSize, "%llu", value.ToUInt64());
|
||||
snprintf(buffer, bufferSize, formatString,
|
||||
value.Type() == B_INT8_TYPE ? value.ToUInt8() :
|
||||
value.Type() == B_INT16_TYPE ? value.ToUInt16() :
|
||||
value.Type() == B_INT32_TYPE ? value.ToUInt32() :
|
||||
value.ToUInt64());
|
||||
break;
|
||||
case INTEGER_FORMAT_HEX_8:
|
||||
snprintf(buffer, bufferSize, "%#x", (uint8)value.ToUInt64());
|
||||
@@ -62,7 +133,6 @@ IntegerFormatter::FormatValue(const BVariant& value, integer_format format,
|
||||
snprintf(buffer, bufferSize, "%#lx", (uint32)value.ToUInt64());
|
||||
break;
|
||||
case INTEGER_FORMAT_HEX_64:
|
||||
case INTEGER_FORMAT_HEX_DEFAULT:
|
||||
default:
|
||||
snprintf(buffer, bufferSize, "%#llx", value.ToUInt64());
|
||||
break;
|
||||
|
||||
@@ -281,6 +281,9 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
||||
uint8* messageBuffer = new(std::nothrow) uint8[totalSize];
|
||||
if (messageBuffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
ArrayDeleter<uint8> deleter(messageBuffer);
|
||||
|
||||
memset(messageBuffer, 0, totalSize);
|
||||
memcpy(messageBuffer, fHeader, sizeof(BMessage::message_header));
|
||||
uint8* tempBuffer = messageBuffer + sizeof(BMessage::message_header);
|
||||
@@ -313,7 +316,6 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
||||
}
|
||||
|
||||
error = fMessage.Unflatten((const char*)messageBuffer);
|
||||
delete[] messageBuffer;
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
|
||||
@@ -184,15 +184,17 @@ BStringColumn::DrawField(BField* _field, BRect rect, BView* parent)
|
||||
{
|
||||
float width = rect.Width() - (2 * kTEXT_MARGIN);
|
||||
BStringField* field = static_cast<BStringField*>(_field);
|
||||
bool clipNeeded = width < field->Width();
|
||||
|
||||
if (width != field->Width()) {
|
||||
if (clipNeeded) {
|
||||
BString out_string(field->String());
|
||||
|
||||
parent->TruncateString(&out_string, fTruncate, width + 2);
|
||||
field->SetClippedString(out_string.String());
|
||||
field->SetWidth(width);
|
||||
}
|
||||
DrawString(field->ClippedString(), parent, rect);
|
||||
|
||||
DrawString(clipNeeded ? field->ClippedString() : field->String(), parent, rect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user