Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
Rename asm.h to ia32.h
Browse files Browse the repository at this point in the history
The functions declared in include/asm.h are all implemented in
core/ia32_ops.asm and core/ia32.c, so rename the header to ia32.h
and move it to core/include/.

+ Remove the redundant #include of the original asm.h from hax.h.
+ Fix a few #include statements, so the project can be built from
  within Xcode.
  • Loading branch information
raphaelning committed Jul 20, 2018
1 parent 8508583 commit 47bbf98
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion core/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
*/

#include "include/cpuid.h"
#include "../include/asm.h"

#include "include/ia32.h"

typedef union cpuid_feature_t {
struct {
Expand Down
5 changes: 3 additions & 2 deletions core/ia32.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "../include/hax.h"
#include "../include/asm.h"
#include "include/ia32.h"

struct qword_val {
uint32 low;
Expand Down Expand Up @@ -119,6 +118,8 @@ void bts(uint8 *addr, uint bit)
asm_bts(base, offset);
}

struct vcpu_t;

void _vmx_vmwrite(struct vcpu_t *vcpu, const char *name,
component_index_t component,
mword source_val)
Expand Down
2 changes: 1 addition & 1 deletion core/include/cpuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifndef HAX_CORE_CPUID_H_
#define HAX_CORE_CPUID_H_

#include "hax_types.h"
#include "../../include/hax_types.h"

#define CPUID_CACHE_SIZE 6

Expand Down
2 changes: 1 addition & 1 deletion core/include/emulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#ifdef HAX_TESTS
#include <stdint.h>
#else
#include "hax_types.h"
#include "../../include/hax_types.h"
#endif

#include "emulate_ops.h"
Expand Down
8 changes: 4 additions & 4 deletions include/asm.h → core/include/ia32.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef HAX_ASM_H_
#define HAX_ASM_H_
#ifndef HAX_CORE_IA32_H_
#define HAX_CORE_IA32_H_

#include "hax_types.h"
#include "../../include/hax_types.h"

union cpuid_args_t;
struct system_desc_t;
Expand Down Expand Up @@ -102,4 +102,4 @@ void ASMCALL get_kernel_gdt(struct system_desc_t *sys_desc);
void ASMCALL get_kernel_idt(struct system_desc_t *sys_desc);
uint16 ASMCALL get_kernel_ldt(void);

#endif // HAX_ASM_H_
#endif // HAX_CORE_IA32_H_
5 changes: 3 additions & 2 deletions core/include/segments.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
#ifndef HAX_CORE_SEGMENTS_H_
#define HAX_CORE_SEGMENTS_H_

#include "types.h"
#include "../../include/hax.h"
#include "ia32.h"
// TODO: Get rid of is_compatible(), and then delete the following #include
#include "../../include/hax_interface.h"

#ifdef __WINNT__
#pragma pack(push, 1)
Expand Down
2 changes: 2 additions & 0 deletions core/include/vmx.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ typedef enum encode_t encode_t;
#define ENCODE_MASK 0x3
#define ENCODE_SHIFT 13

struct invept_desc;

vmx_result_t ASMCALL asm_invept(uint type, struct invept_desc *desc);
vmx_result_t ASMCALL asm_vmclear(const paddr_t *addr_in);
vmx_result_t ASMCALL asm_vmptrld(const paddr_t *addr_in);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
64B85BE91EF4D34D00223ABD /* ept2.c in Sources */ = {isa = PBXBuildFile; fileRef = 64B85BE81EF4D34D00223ABD /* ept2.c */; };
64BB0CD220F36C470064593A /* vmx_ops.asm in Sources */ = {isa = PBXBuildFile; fileRef = 64BB0CD020F36C470064593A /* vmx_ops.asm */; };
64BB0CD320F36C470064593A /* ia32_ops.asm in Sources */ = {isa = PBXBuildFile; fileRef = 64BB0CD120F36C470064593A /* ia32_ops.asm */; };
64CD0F582101B51100099B53 /* ia32.h in Headers */ = {isa = PBXBuildFile; fileRef = 64CD0F572101B51100099B53 /* ia32.h */; };
6E2DBBCC18EB6125003B66C9 /* page_walker.c in Sources */ = {isa = PBXBuildFile; fileRef = 6E2DBBCB18EB6125003B66C9 /* page_walker.c */; };
6E2DBBCE18EB6155003B66C9 /* page_walker.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E2DBBCD18EB6155003B66C9 /* page_walker.h */; };
A669096B20F9985300739075 /* ia32.c in Sources */ = {isa = PBXBuildFile; fileRef = A669096A20F9985300739075 /* ia32.c */; };
Expand Down Expand Up @@ -135,6 +136,7 @@
64B85BE81EF4D34D00223ABD /* ept2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ept2.c; path = ../../../core/ept2.c; sourceTree = "<group>"; };
64BB0CD020F36C470064593A /* vmx_ops.asm */ = {isa = PBXFileReference; explicitFileType = sourcecode.nasm; name = vmx_ops.asm; path = ../../../core/vmx_ops.asm; sourceTree = "<group>"; };
64BB0CD120F36C470064593A /* ia32_ops.asm */ = {isa = PBXFileReference; explicitFileType = sourcecode.nasm; name = ia32_ops.asm; path = ../../../core/ia32_ops.asm; sourceTree = "<group>"; };
64CD0F572101B51100099B53 /* ia32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ia32.h; sourceTree = "<group>"; };
6E2DBBCB18EB6125003B66C9 /* page_walker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = page_walker.c; path = ../../../core/page_walker.c; sourceTree = "<group>"; };
6E2DBBCD18EB6155003B66C9 /* page_walker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = page_walker.h; sourceTree = "<group>"; };
A669096A20F9985300739075 /* ia32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ia32.c; path = ../../../core/ia32.c; sourceTree = "<group>"; };
Expand Down Expand Up @@ -276,6 +278,7 @@
B98ECF9F13A059BB00485DDB /* include */ = {
isa = PBXGroup;
children = (
64CD0F572101B51100099B53 /* ia32.h */,
642FD41C20D9F79100C197FF /* emulate_ops.h */,
642FD41D20D9F79100C197FF /* emulate.h */,
CFD697481ED2DCB700F10631 /* memory.h */,
Expand Down Expand Up @@ -337,6 +340,7 @@
B98ECFC513A059BB00485DDB /* types.h in Headers */,
B98ECFC613A059BB00485DDB /* vcpu.h in Headers */,
B98ECFC813A059BB00485DDB /* vm.h in Headers */,
64CD0F582101B51100099B53 /* ia32.h in Headers */,
B98ECFC913A059BB00485DDB /* vmx.h in Headers */,
4324E35613A3781500FA7CFB /* hax_core_interface.h in Headers */,
43440D1F13A3834B002E1442 /* hax_interface_mac.h in Headers */,
Expand Down
5 changes: 4 additions & 1 deletion include/hax.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
#include "hax_types.h"
#include "hax_list.h"
#include "hax_interface.h"
#include "asm.h"

// TODO: Refactor proc_event_pending(), and then delete the following forward
// declaration
struct vcpu_t;

extern int hax_page_size;

Expand Down

0 comments on commit 47bbf98

Please sign in to comment.