Subversion Repositories SvarDOS

Rev

Rev 1588 | Rev 1590 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1588 Rev 1589
Line 117... Line 117...
117
 
117
 
118
  /* patch up RMOD's PSP: Parent's PSP segment @ 0x16-0x17 */
118
  /* patch up RMOD's PSP: Parent's PSP segment @ 0x16-0x17 */
119
  myptr[0x16] = rmodseg & 0xff; /* RMOD is his own parent */
119
  myptr[0x16] = rmodseg & 0xff; /* RMOD is his own parent */
120
  myptr[0x17] = rmodseg >> 8;
120
  myptr[0x17] = rmodseg >> 8;
121
 
121
 
122
  /* patch up RMOD's PSP: SS:SP pointer @ 0x2E-0x31 */
122
  /* patch up RMOD's PSP: SS:SP pointer @ 0x2E-0x31  --  I abuse the PSP's
-
 
123
   * command line tail as stack, but I do NOT set the stacat the end of the
-
 
124
   * tail. E. C. Masloch kindly explained why this would be a bad idea:
-
 
125
   *
-
 
126
   * "This is wrong and will potentially overwrite part of your buffers that
-
 
127
   * start past the PSP. This is because the dword [PSP:2Eh] is not used merely
-
 
128
   * to set SS:SP but rather to find the stack frame created by the int 21h
-
 
129
   * call. Therefore the int 21h call that terminates the child process will
-
 
130
   * then pop a number of registers off starting from the address stored in the
-
 
131
   * PSP." <https://github.com/SvarDOS/bugz/issues/38#issuecomment-1817445740>
-
 
132
   */
123
  myptr[0x2e] = 254; /* I abuse the PSP's command line tail as stack */
133
  myptr[0x2e] = 192; /* middle of the command line tail area so I have 64 bytes */
124
  myptr[0x2f] = 0;
134
  myptr[0x2f] = 0;   /* before and 64 bytes in front of me */
125
  myptr[0x30] = rmodseg & 0xff;
135
  myptr[0x30] = rmodseg & 0xff;
126
  myptr[0x31] = rmodseg >> 8;
136
  myptr[0x31] = rmodseg >> 8;
127
 
137
 
128
  /* patch up RMOD's PSP: JFT size @ 0x32-0x33 */
138
  /* patch up RMOD's PSP: JFT size @ 0x32-0x33 */
129
  myptr[0x32] = 20; /* default JFT size (max that fits without an extra allocation) */
139
  myptr[0x32] = 20; /* default JFT size (max that fits without an extra allocation) */