Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 2fa9190

Browse files
committed
ARC: pt_regs update #2: Remove unused gutter at start of pt_regs
Signed-off-by: Vineet Gupta <[email protected]>
1 parent 283237a commit 2fa9190

File tree

4 files changed

+15
-26
lines changed

4 files changed

+15
-26
lines changed

arch/arc/include/asm/entry.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,6 @@
432432
st.a r9, [sp, -4]
433433
lr r9, [erbta]
434434
st.a r9, [sp, -4]
435-
436-
/* move up by 1 word to "create" pt_regs->"stack_place_holder" */
437-
sub sp, sp, 4
438435
.endm
439436

440437
/*--------------------------------------------------------------
@@ -474,9 +471,6 @@
474471
* by hardware and that is not good.
475472
*-------------------------------------------------------------*/
476473
.macro RESTORE_ALL_SYS
477-
478-
add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */
479-
480474
ld.ab r9, [sp, 4]
481475
sr r9, [erbta]
482476
ld.ab r9, [sp, 4]
@@ -530,9 +524,6 @@
530524
st.a r9, [sp, -4]
531525
lr r9, [bta_l1]
532526
st.a r9, [sp, -4]
533-
534-
/* move up by 1 word to "create" pt_regs->"stack_place_holder" */
535-
sub sp, sp, 4
536527
.endm
537528

538529
.macro SAVE_ALL_INT2
@@ -561,9 +552,6 @@
561552
st.a r9, [sp, -4]
562553
lr r9, [bta_l2]
563554
st.a r9, [sp, -4]
564-
565-
/* move up by 1 word to "create" pt_regs->"stack_place_holder" */
566-
sub sp, sp, 4
567555
.endm
568556

569557
/*--------------------------------------------------------------
@@ -577,8 +565,6 @@
577565
*-------------------------------------------------------------*/
578566

579567
.macro RESTORE_ALL_INT1
580-
add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */
581-
582568
ld.ab r9, [sp, 4] /* Actual reg file */
583569
sr r9, [bta_l1]
584570
ld.ab r9, [sp, 4]
@@ -601,8 +587,6 @@
601587
.endm
602588

603589
.macro RESTORE_ALL_INT2
604-
add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */
605-
606590
ld.ab r9, [sp, 4]
607591
sr r9, [bta_l2]
608592
ld.ab r9, [sp, 4]

arch/arc/include/asm/ptrace.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
/* THE pt_regs: Defines how regs are saved during entry into kernel */
1818

1919
struct pt_regs {
20-
/*
21-
* 1 word gutter after reg-file has been saved
22-
* Technically not needed, Since SP always points to a "full" location
23-
* (vs. "empty"). But pt_regs is shared with tools....
24-
*/
25-
long res;
2620

2721
/* Real registers */
2822
long bta; /* bta_l1, bta_l2, erbta */

arch/arc/include/uapi/asm/ptrace.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@
2020
*
2121
* This is to decouple pt_regs from user-space ABI, to be able to change it
2222
* w/o affecting the ABI.
23-
* Although the layout (initial padding) is similar to pt_regs to have some
24-
* optimizations when copying pt_regs to/from user_regs_struct.
23+
*
24+
* The intermediate pad,pad2 are relics of initial layout based on pt_regs
25+
* for optimizations when copying pt_regs to/from user_regs_struct.
26+
* We no longer need them, but can't be changed as they are part of ABI now.
2527
*
2628
* Also, sigcontext only care about the scratch regs as that is what we really
27-
* save/restore for signal handling.
29+
* save/restore for signal handling. However gdb also uses the same struct
30+
* hence callee regs need to be in there too.
2831
*/
2932
struct user_regs_struct {
3033

34+
long pad;
3135
struct {
32-
long pad;
3336
long bta, lp_start, lp_end, lp_count;
3437
long status32, ret, blink, fp, gp;
3538
long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;

arch/arc/kernel/ptrace.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ static int genregs_get(struct task_struct *target,
4040
offsetof(struct user_regs_struct, LOC), \
4141
offsetof(struct user_regs_struct, LOC) + 4);
4242

43+
#define REG_O_ZERO(LOC) \
44+
if (!ret) \
45+
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, \
46+
offsetof(struct user_regs_struct, LOC), \
47+
offsetof(struct user_regs_struct, LOC) + 4);
48+
49+
REG_O_ZERO(pad);
4350
REG_O_CHUNK(scratch, callee, ptregs);
4451
REG_O_CHUNK(callee, efa, cregs);
4552
REG_O_CHUNK(efa, stop_pc, &target->thread.fault_address);
@@ -88,6 +95,7 @@ static int genregs_set(struct task_struct *target,
8895
offsetof(struct user_regs_struct, LOC), \
8996
offsetof(struct user_regs_struct, LOC) + 4);
9097

98+
REG_IGNORE_ONE(pad);
9199
/* TBD: disallow updates to STATUS32, orig_r8 etc*/
92100
REG_IN_CHUNK(scratch, callee, ptregs); /* pt_regs[bta..orig_r8] */
93101
REG_IN_CHUNK(callee, efa, cregs); /* callee_regs[r25..r13] */

0 commit comments

Comments
 (0)