#define CONFIG_SWAP_ONLY
#define CONFIG_USERMEM_DIRECT
#define CONFIG_BANKS 1
-#define PROC_SIZE 128
+#define PROC_SIZE 128 /* 64K, 128 * 512 */
#define CONFIG_SPLIT_UDATA
#define UDATA_SIZE 1024
#define PROGBASE 0x20000UL
#define PROGTOP 0x30000UL
-#define SWAP_SIZE (256 + 2) /* 2 for the udata */
+#define SWAP_SIZE (130 + 2) /* 2 for the udata */
#define SWAPBASE PROGBASE
#define SWAPTOP 0x30000UL
-#define MAX_SWAPS PTABSIZE
+#define MAX_SWAPS PTABSIZE /* Mandatory for swap only */
#define swap_map(x) ((uint8_t *)(x))
#define SWAPDEV (1)
/* Should be uput etc */
memcpy((void *)udata.u_codebase, &vdso, 0x40);
}
+
+extern void *get_usp(void);
+extern void set_usp(void *p);
+
+void signal_frame(uint8_t *trapframe, uint32_t d0, uint32_t d1, uint32_t a0,
+ uint32_t a1)
+{
+ extern void *udata_shadow;
+ uint8_t *usp = get_usp();
+ udata_ptr = udata_shadow;
+ uint16_t ccr = *(uint16_t *)trapframe;
+ uint32_t addr = *(uint32_t *)(trapframe + 2);
+ int err = 0;
+
+ /* Build the user stack frame */
+
+ /* FIXME: eventually we should put the trap frame details and trap
+ info into the frame */
+ usp -= 4;
+ err |= uputl(addr, usp);
+ usp -= 4;
+ err |= uputw(ccr, usp);
+ usp -= 2;
+ err |=uputl(a1, usp);
+ usp -= 4;
+ err |= uputl(a0, usp);
+ usp -= 4;
+ err |= uputl(d1, usp);
+ usp -= 4;
+ err |= uputl(d0, usp);
+ usp -= 4;
+ err |= uputl(udata.u_codebase + 4, usp);
+ set_usp(usp);
+
+ if (err) {
+ kprintf("%d: stack fault\n", udata.u_ptab->p_pid);
+ doexit(dump_core(SIGKILL));
+ }
+ /* Now patch up the kernel frame */
+ *(uint16_t *)trapframe = 0;
+ *(uint32_t *)(trapframe + 2) = (uint32_t)udata.u_sigvec[udata.u_cursig];
+ udata.u_sigvec[udata.u_cursig] = SIG_DFL;
+ udata.u_cursig = 0;
+}