* Add suword32() for cases where we want to write out a word and not a long.
* argc and envc are integers, not longs.
* Change has no effect on intel/amd boxes
* Fill in "ps_strings" struct for ps, w, etc.
*/
suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp);
- suword(&arginfo->ps_nargvstr, argc);
+ suword32(&arginfo->ps_nargvstr, argc);
/*
* Fill in argument portion of vector table.
suword(vectp++, 0);
suword(&arginfo->ps_envstr, (long)(intptr_t)vectp);
- suword(&arginfo->ps_nenvstr, envc);
+ suword32(&arginfo->ps_nenvstr, envc);
/*
* Fill in environment portion of vector table.
ret
/*
- * su{byte,sword,word} - MP SAFE
+ * su{byte,sword,word,word32} - MP SAFE
*
- * Write a byte (word, longword) to user memory
+ * Write a long to user memory
*/
ENTRY(suword)
movl PCPU(curthread),%ecx
ret
/*
+ * Write an integer to user memory
+ */
+ENTRY(suword32)
+ movl PCPU(curthread),%ecx
+ movl TD_PCB(%ecx),%ecx
+ movl $fusufault,PCB_ONFAULT(%ecx)
+ movl 4(%esp),%edx
+
+ cmpl $VM_MAX_USER_ADDRESS-4,%edx /* verify address validity */
+ ja fusufault
+
+ movl 8(%esp),%eax
+ movl %eax,(%edx)
+ xorl %eax,%eax
+ movl PCPU(curthread),%ecx
+ movl TD_PCB(%ecx),%ecx
+ movl %eax,PCB_ONFAULT(%ecx)
+ ret
+
+/*
* susword - MP SAFE
*/
ENTRY(susword)
/*
* Store a 64-bit word, a 32-bit word, a 16-bit word, or an 8-bit byte to
* user memory. All these functions are MPSAFE.
+ *
* addr = %rdi, value = %rsi
+ *
+ * Write a long
*/
ALTENTRY(suword64)
ENTRY(suword)
movq %rax,PCB_ONFAULT(%rcx)
ret
+/*
+ * Write an int
+ */
ENTRY(suword32)
movq PCPU(curthread),%rcx
movq TD_PCB(%rcx), %rcx
int subyte (void *base, int byte);
long fuword (const void *base);
int suword (void *base, long word);
+int suword32 (void *base, int word);
int fusword (void *base);
int susword (void *base, int word);
u_long casuword(volatile u_long *p, u_long oldval, u_long newval);