OSDN Git Service

8695fef83ce633a50e3f42ad85ace28e66dfdb5b
[drdeamon64/drdeamon64.git] / libintel64asm / drd64_intel64_asm_system.c
1 /*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
2
3                          D r . D e a m o n  6 4
4                         for INTEL64(R), AMD64(R)
5         
6    Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10
11  1. Redistributions of source code must retain the above copyright notice,
12     this list of conditions and the following disclaimer.
13  2. Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions and the following disclaimer in the
15     documentation and/or other materials provided with the distribution.
16
17 THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
30
31 /* File Info -----------------------------------------------------------
32 File: drd64_intel64_asm_system.c
33 Function: Intel64 Line Assembler System Functions (Init./Term./etc)
34 Comment:  none
35 ----------------------------------------------------------------------*/
36
37 #include"drd64_intel64.h"
38 #include"drd64_intel64_dbtype.h"
39 #include"drd64_intel64_asm.h"
40 #include"drd64_intel64_disasm.h"
41 #define DRD64_SRC_INTEL64_ASM_SYSTEM
42 #include"drd64_intel64_asm_system.h"
43
44 static  Drd64_Intel64_OperandNode       *pp_operandnode_base;
45 static  int                                                     i_operandnode_nums;
46
47
48 /*----------------------------------------------------------------------
49 ----------------------------------------------------------------------*/
50 EXTERN int
51         Drd64_Intel64_InitAssembleSystem(
52                 void)
53 {
54         Drd64_Intel64_OperandNode       *pp_temp;
55
56         pp_operandnode_base     = NULL;
57         pp_temp = NULL;
58         pp_temp = (Drd64_Intel64_OperandNode *)malloc(
59                                         sizeof(Drd64_Intel64_OperandNode) * MAX_OPERAND_NODES);
60         if( NULL == pp_temp )   { return 0x01;  }
61
62         pp_operandnode_base     = pp_temp;
63         i_operandnode_nums      = 0;
64         
65         return 0x00;
66 }
67
68
69 /*----------------------------------------------------------------------
70 ----------------------------------------------------------------------*/
71 EXTERN int
72         Drd64_Intel64_TermAssembleSystem(
73                 void)
74 {
75         if( NULL != pp_operandnode_base )       {
76                 free( pp_operandnode_base );
77                 pp_operandnode_base     = NULL;
78         }       
79         
80         return 0x00;
81 }
82
83
84 /*----------------------------------------------------------------------
85 ----------------------------------------------------------------------*/
86 EXTERN Drd64_Intel64_OperandNode        *
87         Drd64_Intel64_AllocOperandNode(
88                 void )
89 {
90         Drd64_Intel64_OperandNode       *p_node;
91         
92         p_node  = NULL;
93         if( MAX_OPERAND_NODES - 1 > i_operandnode_nums )        {
94                 p_node  = (pp_operandnode_base + i_operandnode_nums);
95                 i_operandnode_nums++;
96         }
97
98         if( NULL != p_node )    {
99                 memset( p_node, 0x00, sizeof( Drd64_Intel64_OperandNode ));
100         }
101
102         return p_node;
103 }
104
105
106 /*----------------------------------------------------------------------
107 ----------------------------------------------------------------------*/
108 EXTERN int
109         Drd64_Intel64_ResetOperandNode_Memory(
110                 void )
111 {
112         i_operandnode_nums      = 0;
113         
114         return 0x00;
115 }
116
117
118 /* EOF of drd64_intel64_asm_system.c ----------------------------------- */