summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpu.sym4
-rw-r--r--global.c4
-rw-r--r--global.h3
-rw-r--r--lexxer.l24
-rw-r--r--parser.y7
-rw-r--r--type.c10
6 files changed, 35 insertions, 17 deletions
diff --git a/cpu.sym b/cpu.sym
index fcf6241..5e34074 100644
--- a/cpu.sym
+++ b/cpu.sym
@@ -106,3 +106,7 @@ expr sizeof(double) sizeof_double
expr sizeof(mach_msg_header_t) sizeof_mach_msg_header_t
expr sizeof(mach_msg_type_long_t) sizeof_mach_msg_type_long_t
expr sizeof(mach_msg_type_t) sizeof_mach_msg_type_t
+expr sizeof(vm_offset_t) vm_offset_size
+expr (sizeof(vm_offset_t)*8) vm_offset_size_in_bits
+expr sizeof(mach_port_name_t) port_name_size
+expr (sizeof(mach_port_name_t)*8) port_name_size_in_bits
diff --git a/global.c b/global.c
index 5685186..e2eb76e 100644
--- a/global.c
+++ b/global.c
@@ -24,6 +24,7 @@
* rights to redistribute these changes.
*/
+#include "cpu.h"
#include "error.h"
#include "global.h"
@@ -65,6 +66,9 @@ string_t InternalHeaderFileName = strNULL;
string_t UserFileName = strNULL;
string_t ServerFileName = strNULL;
+int port_size = port_name_size;
+int port_size_in_bits = port_name_size_in_bits;
+
void
more_global(void)
{
diff --git a/global.h b/global.h
index 8dbb6fd..cadd7e7 100644
--- a/global.h
+++ b/global.h
@@ -67,6 +67,9 @@ extern string_t InternalHeaderFileName;
extern string_t UserFileName;
extern string_t ServerFileName;
+extern int port_size;
+extern int port_size_in_bits;
+
extern void more_global(void);
#ifndef NULL
diff --git a/lexxer.l b/lexxer.l
index 48dda4a..71f43b2 100644
--- a/lexxer.l
+++ b/lexxer.l
@@ -160,7 +160,7 @@ static void doSharp(const char *body); /* process body of # directives */
<Normal>(?i:countinout) FRETURN(flCountInOut);
<Normal>(?i:retcode) FRETURN(flNone);
-<Normal>(?i:polymorphic) TRETURN(MACH_MSG_TYPE_POLYMORPHIC,word_size_in_bits);
+<Normal>(?i:polymorphic) TRETURN(MACH_MSG_TYPE_POLYMORPHIC,port_size_in_bits);
<Normal>"MACH_MSG_TYPE_UNSTRUCTURED" TRETURN(MACH_MSG_TYPE_UNSTRUCTURED,0);
<Normal>"MACH_MSG_TYPE_BIT" TRETURN(MACH_MSG_TYPE_BIT,1);
@@ -175,17 +175,17 @@ static void doSharp(const char *body); /* process body of # directives */
<Normal>"MACH_MSG_TYPE_STRING" TRETURN(MACH_MSG_TYPE_STRING,0);
<Normal>"MACH_MSG_TYPE_STRING_C" TRETURN(MACH_MSG_TYPE_STRING_C,0);
-<Normal>"MACH_MSG_TYPE_MOVE_RECEIVE" TPRETURN(MACH_MSG_TYPE_MOVE_RECEIVE,MACH_MSG_TYPE_PORT_RECEIVE,word_size_in_bits);
-<Normal>"MACH_MSG_TYPE_COPY_SEND" TPRETURN(MACH_MSG_TYPE_COPY_SEND,MACH_MSG_TYPE_PORT_SEND,word_size_in_bits);
-<Normal>"MACH_MSG_TYPE_MAKE_SEND" TPRETURN(MACH_MSG_TYPE_MAKE_SEND,MACH_MSG_TYPE_PORT_SEND,word_size_in_bits);
-<Normal>"MACH_MSG_TYPE_MOVE_SEND" TPRETURN(MACH_MSG_TYPE_MOVE_SEND,MACH_MSG_TYPE_PORT_SEND,word_size_in_bits);
-<Normal>"MACH_MSG_TYPE_MAKE_SEND_ONCE" TPRETURN(MACH_MSG_TYPE_MAKE_SEND_ONCE,MACH_MSG_TYPE_PORT_SEND_ONCE,word_size_in_bits);
-<Normal>"MACH_MSG_TYPE_MOVE_SEND_ONCE" TPRETURN(MACH_MSG_TYPE_MOVE_SEND_ONCE,MACH_MSG_TYPE_PORT_SEND_ONCE,word_size_in_bits);
-
-<Normal>"MACH_MSG_TYPE_PORT_NAME" TRETURN(MACH_MSG_TYPE_PORT_NAME,word_size_in_bits);
-<Normal>"MACH_MSG_TYPE_PORT_RECEIVE" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC,MACH_MSG_TYPE_PORT_RECEIVE,word_size_in_bits);
-<Normal>"MACH_MSG_TYPE_PORT_SEND" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC,MACH_MSG_TYPE_PORT_SEND,word_size_in_bits);
-<Normal>"MACH_MSG_TYPE_PORT_SEND_ONCE" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC,MACH_MSG_TYPE_PORT_SEND_ONCE,word_size_in_bits);
+<Normal>"MACH_MSG_TYPE_MOVE_RECEIVE" TPRETURN(MACH_MSG_TYPE_MOVE_RECEIVE,MACH_MSG_TYPE_PORT_RECEIVE,port_size_in_bits);
+<Normal>"MACH_MSG_TYPE_COPY_SEND" TPRETURN(MACH_MSG_TYPE_COPY_SEND,MACH_MSG_TYPE_PORT_SEND,port_size_in_bits);
+<Normal>"MACH_MSG_TYPE_MAKE_SEND" TPRETURN(MACH_MSG_TYPE_MAKE_SEND,MACH_MSG_TYPE_PORT_SEND,port_size_in_bits);
+<Normal>"MACH_MSG_TYPE_MOVE_SEND" TPRETURN(MACH_MSG_TYPE_MOVE_SEND,MACH_MSG_TYPE_PORT_SEND,port_size_in_bits);
+<Normal>"MACH_MSG_TYPE_MAKE_SEND_ONCE" TPRETURN(MACH_MSG_TYPE_MAKE_SEND_ONCE,MACH_MSG_TYPE_PORT_SEND_ONCE,port_size_in_bits);
+<Normal>"MACH_MSG_TYPE_MOVE_SEND_ONCE" TPRETURN(MACH_MSG_TYPE_MOVE_SEND_ONCE,MACH_MSG_TYPE_PORT_SEND_ONCE,port_size_in_bits);
+
+<Normal>"MACH_MSG_TYPE_PORT_NAME" TRETURN(MACH_MSG_TYPE_PORT_NAME,port_name_size_in_bits);
+<Normal>"MACH_MSG_TYPE_PORT_RECEIVE" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC,MACH_MSG_TYPE_PORT_RECEIVE,port_size_in_bits);
+<Normal>"MACH_MSG_TYPE_PORT_SEND" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC,MACH_MSG_TYPE_PORT_SEND,port_size_in_bits);
+<Normal>"MACH_MSG_TYPE_PORT_SEND_ONCE" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC,MACH_MSG_TYPE_PORT_SEND_ONCE,port_size_in_bits);
<Normal>"MACH_MSG_TYPE_POLYMORPHIC" TRETURN(MACH_MSG_TYPE_POLYMORPHIC,0);
<Normal>":" RETURN(syColon);
diff --git a/parser.y b/parser.y
index 8c2190b..8d6b2aa 100644
--- a/parser.y
+++ b/parser.y
@@ -116,6 +116,7 @@
#include <stdio.h>
+#include "cpu.h"
#include "error.h"
#include "lexxer.h"
#include "global.h"
@@ -223,12 +224,18 @@ SubsystemMod : syKernelUser
if (IsKernelUser)
warn("duplicate KernelUser keyword");
IsKernelUser = TRUE;
+ port_size = vm_offset_size;
+ port_size_in_bits = vm_offset_size_in_bits;
+ init_type();
}
| syKernelServer
{
if (IsKernelServer)
warn("duplicate KernelServer keyword");
IsKernelServer = TRUE;
+ port_size = vm_offset_size;
+ port_size_in_bits = vm_offset_size_in_bits;
+ init_type();
}
;
diff --git a/type.c b/type.c
index eb88cf4..86137ae 100644
--- a/type.c
+++ b/type.c
@@ -848,7 +848,7 @@ init_type(void)
itRequestPortType->itInNameStr = "MACH_MSG_TYPE_COPY_SEND";
itRequestPortType->itOutName = MACH_MSG_TYPE_PORT_SEND;
itRequestPortType->itOutNameStr = "MACH_MSG_TYPE_PORT_SEND";
- itRequestPortType->itSize = word_size_in_bits;
+ itRequestPortType->itSize = port_size_in_bits;
itCalculateSizeInfo(itRequestPortType);
itCalculateNameInfo(itRequestPortType);
@@ -858,7 +858,7 @@ init_type(void)
itZeroReplyPortType->itInNameStr = "0";
itZeroReplyPortType->itOutName = 0;
itZeroReplyPortType->itOutNameStr = "0";
- itZeroReplyPortType->itSize = word_size_in_bits;
+ itZeroReplyPortType->itSize = port_size_in_bits;
itCalculateSizeInfo(itZeroReplyPortType);
itCalculateNameInfo(itZeroReplyPortType);
@@ -868,7 +868,7 @@ init_type(void)
itRealReplyPortType->itInNameStr = "MACH_MSG_TYPE_MAKE_SEND_ONCE";
itRealReplyPortType->itOutName = MACH_MSG_TYPE_PORT_SEND_ONCE;
itRealReplyPortType->itOutNameStr = "MACH_MSG_TYPE_PORT_SEND_ONCE";
- itRealReplyPortType->itSize = word_size_in_bits;
+ itRealReplyPortType->itSize = port_size_in_bits;
itCalculateSizeInfo(itRealReplyPortType);
itCalculateNameInfo(itRealReplyPortType);
@@ -906,7 +906,7 @@ itCheckRequestPortType(identifier_t name, const ipc_type_t *it)
(it->itOutName != MACH_MSG_TYPE_PORT_SEND_ONCE) &&
(it->itOutName != MACH_MSG_TYPE_POLYMORPHIC)) ||
(it->itNumber != 1) ||
- (it->itSize != word_size_in_bits) ||
+ (it->itSize != port_size_in_bits) ||
!it->itInLine ||
it->itDeallocate != d_NO ||
!it->itStruct ||
@@ -927,7 +927,7 @@ itCheckReplyPortType(identifier_t name, const ipc_type_t *it)
(it->itOutName != MACH_MSG_TYPE_POLYMORPHIC) &&
(it->itOutName != 0)) ||
(it->itNumber != 1) ||
- (it->itSize != word_size_in_bits) ||
+ (it->itSize != port_size_in_bits) ||
!it->itInLine ||
it->itDeallocate != d_NO ||
!it->itStruct ||