|
Hi Peter,
Here's a pgm that does that. The "memcpy" function does the equivalent
of a CPYBWP (Copy Bytes With Pointers) MI instruction under the covers.
Note that pointers have to be on 16-byte boundaries. If you declare
them as pointers in your structure (not as a string or something else)
the C compiler will align them properly, even with "_Packed".
--Dave
/*----------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <milib.h>
#include <mih/rslvsp>
#include <mih/setsppfp>
typedef _Packed struct {
int anInt;
_SYSPTR aSyp;
char aStr[9];
} struc_t;
/*----------------------------------------------*/
void main(int argc, char **argv)
{
_SYSPTR spcSyp;
_SPCPTR spcSpp;
_RSLV_Template_T rslvTmplt;
struc_t struc;
/* Get a space ptr to the *usrspc */
rslvTmplt.Obj.Type_Subtype = _Usrspc;
memset(rslvTmplt.Obj.Name, ' ', sizeof(rslvTmplt.Obj.Name));
memcpy(rslvTmplt.Obj.Name, "AUSRSPC", 7);
rslvTmplt.Auth = _AUTH_RETRIEVE;
_RSLVSP2(&spcSyp, &rslvTmplt);
spcSpp = _SETSPPFP(spcSyp);
/* Get a system ptr to a *pgm */
rslvTmplt.Obj.Type_Subtype = _Program;
memset(rslvTmplt.Obj.Name, ' ', sizeof(rslvTmplt.Obj.Name));
memcpy(rslvTmplt.Obj.Name, "APGM", 4);
rslvTmplt.Auth = _AUTH_RETRIEVE;
_RSLVSP2(&struc.aSyp, &rslvTmplt);
memcpy(struc.aStr, "some data", 9);
struc.anInt = 42;
/* Copy the structure (with the pointer) to the *usrspc */
memcpy(spcSpp, &struc, sizeof(struc));
return;
}
Peter Daransky wrote:
Hi,I try to write resolved system pointer of one object to user space ... But it doesn't work for me!? Better sayed i've a C structure with manyvariables and my wish is write it complet as a block of data to userspace, so that i can later read it with the resolved pointer ... Do i need perform something special (API or MI instruction ...) ? Has someone done something similar ? A little example in C will be help :-) Thank you peter_
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.