Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8348165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:36:42+00:00 2026-06-09T07:36:42+00:00

Inside my kernel-mode driver is the following code: PHYSICAL_ADDRESS physAddr; PVOID pvk; unsigned int

  • 0

Inside my kernel-mode driver is the following code:

PHYSICAL_ADDRESS    physAddr;
PVOID               pvk;
unsigned int        reg_addr; // physical address to write to
unsigned int*       reg_val;  // pointer to value to be written

// assume reg_addr and reg_val are initialized to some values

physAddr.QuadPart = (ULONGLONG)reg_addr;
pvk = MmMapIoSpace(physAddr,sizeof(reg_addr),MmNonCached);
WRITE_REGISTER_ULONG((ULONG*)pvk,(ULONG)&reg_val);

The address is not being written to, and I’m not sure why. Is this the correct procedure or am I missing a step? Also, could my pointer arithmetic be wrong? I’ve tried all permutations, and none have resulted in the correct result. I want the physical memory specified by reg_addr to be written with what is specified by the value pointed to by reg_val.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:36:44+00:00Added an answer on June 9, 2026 at 7:36 am

    There are a few things that look odd/wrong with your code:-

    First, PHYSICAL_ADDRESS.QuadPart is a 64-bit value, but you’re assigning a 32-bit int to it. Are you sure that’s what you want to do?

    Second, I assume you want to map a 32-bit ‘ULONG’ register:

    pvk = MmMapIoSpace(physAddr,sizeof(reg_addr),MmNonCached); 
    

    That will probably work, but what I think you mean is this

    pvk = MmMapIoSpace(physAddr, sizeof(ULONG), MmNonCached); 
    

    Finally, you’re writing the address of the pointer variable reg_val to your register. Your comment implies you want to write the value pointed to by reg_val? If so, use this instead.

    WRITE_REGISTER_ULONG((ULONG*)pvk, *reg_val);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was following this: Dynamically allocating memory inside __device/global__ CUDA kernel But it still
Inside of a kernel, is it OK to pass the address of a struct,
I'd like to call something like usleep() inside a CUDA kernel. The basic goal
Inside my .aspx I have some JSON code that looks like this: function someFunctionName()
valgrind is reporting uninitialized memory errors from code like this: unsigned char buf[100]; struct
Guys, is it possible to get physical path to asp.net mvc 2 application inside
I am trying to compile a code that has a malloc function inside the
I'm working on embedded device where kernel image is stored inside /dev/mtd4 part of
I'm studying the mechanism of module loading inside the linux kernel, and I'm stuck
I am trying to get the battery level inside a Linux kernel module (the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.