Skip to content

Commit

Permalink
bind sdk fix decode bit start index
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkwork committed Jun 20, 2024
1 parent ef87334 commit aa8fcf3
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 71 deletions.
122 changes: 61 additions & 61 deletions gengo/bind/sdkMerge/bug/bug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,64 +57,64 @@ typedef unsigned __int64 UINT64, *PUINT64;



typedef struct xed_immdis_s {
unsigned int currently_used_space :4; // current number of assigned bytes
unsigned int max_allocated_space :4; // max allocation, 4 or 8
int present : 1;
int immediate_is_unsigned : 1;
} xed_immdis_t;

typedef union
{
struct VMX_SEGMENT_ACCESS_RIGHTS_TYPE
{
/**
* [Bits 3:0] Segment type.
*/
UINT32 Type : 4;

/**
* [Bit 4] S - Descriptor type (0 = system; 1 = code or data).
*/
UINT32 DescriptorType : 1;

/**
* [Bits 6:5] DPL - Descriptor privilege level.
*/
UINT32 DescriptorPrivilegeLevel : 2;

/**
* [Bit 7] P - Segment present.
*/
UINT32 Present : 1;

UINT32 Reserved1 : 4;

/**
* [Bit 12] AVL - Available for use by system software.
*/
UINT32 AvailableBit : 1;

/**
* [Bit 13] Reserved (except for CS). L - 64-bit mode active (for CS only).
*/
UINT32 LongMode : 1;

/**
* [Bit 14] D/B - Default operation size (0 = 16-bit segment; 1 = 32-bit segment).
*/
UINT32 DefaultBig : 1;

/**
* [Bit 15] G - Granularity.
*/
UINT32 Granularity : 1;
/**
* [Bit 16] Segment unusable (0 = usable; 1 = unusable).
*/
UINT32 Unusable : 1;
UINT32 Reserved2 : 15;
};

UINT32 AsUInt;
} VMX_SEGMENT_ACCESS_RIGHTS_TYPE;
// typedef struct xed_immdis_s {
// unsigned int currently_used_space :4; // current number of assigned bytes
// unsigned int max_allocated_space :4; // max allocation, 4 or 8
// int present : 1;
// int immediate_is_unsigned : 1;
// } xed_immdis_t;

//typedef union
//{
// struct VMX_SEGMENT_ACCESS_RIGHTS_TYPE
// {
// /**
// * [Bits 3:0] Segment type.
// */
// UINT32 Type : 4;
//
// /**
// * [Bit 4] S - Descriptor type (0 = system; 1 = code or data).
// */
// UINT32 DescriptorType : 1;
//
// /**
// * [Bits 6:5] DPL - Descriptor privilege level.
// */
// UINT32 DescriptorPrivilegeLevel : 2;
//
// /**
// * [Bit 7] P - Segment present.
// */
// UINT32 Present : 1;
//
// UINT32 Reserved1 : 4;
//
// /**
// * [Bit 12] AVL - Available for use by system software.
// */
// UINT32 AvailableBit : 1;
//
// /**
// * [Bit 13] Reserved (except for CS). L - 64-bit mode active (for CS only).
// */
// UINT32 LongMode : 1;
//
// /**
// * [Bit 14] D/B - Default operation size (0 = 16-bit segment; 1 = 32-bit segment).
// */
// UINT32 DefaultBig : 1;
//
// /**
// * [Bit 15] G - Granularity.
// */
// UINT32 Granularity : 1;
// /**
// * [Bit 16] Segment unusable (0 = usable; 1 = unusable).
// */
// UINT32 Unusable : 1;
// UINT32 Reserved2 : 15;
// };
//
// UINT32 AsUInt;
//} VMX_SEGMENT_ACCESS_RIGHTS_TYPE;
2 changes: 0 additions & 2 deletions gengo/bind/sdkMerge/bug/tmp/bug.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions gengo/clang/layout_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,9 @@ func (r *RecordLayout) UnmarshalString(data string) error {
// mylog.Check(errors.New("improperly terminated layout"))

switch {
case strings.Contains(data, "unnamed at"):
//return nil
//mylog.Warning("skip unmarshal RecordLayout", data)
case strings.Contains(data, "__NSConstantString_tag"):
mylog.Warning("skip unmarshal RecordLayout", data)
return nil
//mylog.Warning("skip unmarshal RecordLayout", data)
//return nil
}

first := true
Expand Down Expand Up @@ -117,7 +114,7 @@ func (r *RecordLayout) UnmarshalString(data string) error {
typen := after
//save strut type todo test
if strings.HasPrefix(typen, "struct ") {
typen = "struct "
//typen = "struct "
}
if lastSpace := strings.LastIndex(after, " "); lastSpace != -1 {
// If the last space is followed by a closing parenthesis, then it is part of the type.
Expand All @@ -131,7 +128,7 @@ func (r *RecordLayout) UnmarshalString(data string) error {
}

if name == "" {
continue
//continue
}

// Create node
Expand Down
2 changes: 1 addition & 1 deletion gengo/gengo/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ func (mod Module) EmitFrom(ast clang.Node, layouts *clang.LayoutMap) {
mylog.Todo("TypedefDecl cpp model not working")
// Define typedefs.
clang.Visit(ast, func(td *clang.TypedefDecl) bool {
mylog.Warning("TypedefDecl "+td.Name, td.Type.QualType)
mylog.Warning(td.Name, td.Type.QualType)
if td.Name == "CR3_TYPE" {
println()
}
Expand Down

0 comments on commit aa8fcf3

Please sign in to comment.