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

  • SEARCH
  • Home
  • 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 8941983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:25:41+00:00 2026-06-15T11:25:41+00:00

I want to move information byte by byte from one memory location to another

  • 0

I want to move information byte by byte from one memory location to another without using any library function. Am using a 16bits architecture emulated in qemu and this code is part of tiny small kernel i am writing, so i can not use any system call

// The struct i want to copy
struct procinfo info_tmp;
// here i put some stuff in my struct    
info_tmp.pid = tablaprocesos[indiceProceso].pid;
kstrcpy(info_tmp.nombre, tablaprocesos[indiceProceso].nombre);  
info_tmp.segmento = tablaprocesos[indiceProceso].memoria;
if(tablaprocesos[indiceProceso].estado==PROCESO_LISTO)
  info_tmp.estado = 0;
else if(tablaprocesos[indiceProceso].estado==PROCESO_RUN)
  info_tmp.estado = 1;
else if(tablaprocesos[indiceProceso].estado==BLOQ_TECLADO ||
tablaprocesos[indiceProceso].estado==PROCESO_SYSCALL)
  info_tmp.estado = 2;
else
  info_tmp.estado = 3; // Zombie
// Tiempo total = tiempoSYS + tiempoUSER
info_tmp.tiempo = tablaprocesos[indiceProceso].tiempoUSER +
  tablaprocesos[indiceProceso].tiempoSYS;    

// pointer to destination that i want to copy to
infoProc = (struct procinfo *)(((int)es << 16) + (0x0000ffff & ebx));
// now pointer to my source struct  
procinfo * origen = &info_tmp;         
int limit = sizeof(struct procinfo);
int i;
for(i=0;i<limit;i++){  
   //  I need here to read only one byte from my source pointer to a variable "byte"

   // macro written in ASM to copy one byte to a pointed location
   // it writes in another data segment of another process
   WRITE_POINTER_FAR(infoProc,byte);
   // next byte
   origen += 1; 
   infoProc += 1;
}

Is there a direct way to do it without the need to write a small code in ASM to do it manually ?

Note: This code is part of a 16bits segmented OS kernel (a 64KB segment for each process), the source struct is in the kernel segment and i want to copy it to a location in another process segment and it can not be like *targetBytePointer = *sourceBytePointer.

  • 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-15T11:25:42+00:00Added an answer on June 15, 2026 at 11:25 am
    // The struct i want to copy
    struct procinfo info_tmp;
    // here i put some stuff in my struct    
    info_tmp.pid = tablaprocesos[indiceProceso].pid;
    kstrcpy(info_tmp.nombre, tablaprocesos[indiceProceso].nombre);  
    info_tmp.segmento = tablaprocesos[indiceProceso].memoria;
    
    switch(tablaprocesos[indiceProceso].estado) {
    case PROCESO_LISTO:
      info_tmp.estado = 0; break;
    case PROCESO_RUN:
      info_tmp.estado = 1; break;
    case BLOQ_TECLADO :
    case PROCESO_SYSCALL:
      info_tmp.estado = 2; break;
    default:
      info_tmp.estado = 3; // Zombie
            break;
            }
    // Tiempo total = tiempoSYS + tiempoUSER
    info_tmp.tiempo = tablaprocesos[indiceProceso].tiempoUSER +
      tablaprocesos[indiceProceso].tiempoSYS;
    
    // pointer to destination that i want to copy to
    infoProc = (struct procinfo *)(((int)es << 16) + (0x0000ffff & ebx));
    char *dest = (char*) infoProc;
    // now pointer to my source struct  
    char * origen = (char*) &info_tmp;
    int limit = sizeof(struct procinfo);
    int i;
    for(i=0;i<limit;i++){ 
       char byte;
       //  I need here to read only one byte from my source pointer to a variable "byte"
    
       // macro written in ASM to copy one byte to a pointed location
       // it writes in another data segment of another process
       byte = *origen;
       WRITE_POINTER_FAR(dest,byte);
       // next byte
       origen += 1;
       dest += 1;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to move a table to a new filegroup. Using the accepted answer
I want to move a part, i.e. one subdirectory of an existing, private mercurial
I want to move some file to other place, using Java SE 1.6 So,
I want to move all files and folders inside a folder to another folder.
If you want to move your development process from Test-Driven Development to Behavior-Driven Development
I want to move all of my enterprise libraray configuration information, as well as
I'm currently using standard Ant and I want to move to Ant4Eclipse (http://www.ant4eclipse.org/) to
I have a class that has to take product information from one system's database
Hi I want the site tables to not move or the information in them
I want to move an image within a circle with my touch on move.

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.