kernel, arm ucontext: ARM DBG=-g run fixes

kernel:
	. modules can be as big as the space (8MB) between them
	  instead of 4MB; memory is slightly bigger with DBG=-g

arm ucontext:
	. r4 is clobbered by the restore function, as it's
	  used as a scratch register, causing problems for the
	  DBG=-g build
	. r1-r3 are safe for scratch registers, as they are
	  caller-save, so use r3 instead; and don't bother
	  restoring r1-r3, but preserve r4

vfs:
	. improve TLL pointer sanity check a bit

Change-Id: I0e3cfc367fdc14477e40d04b5e044f288ca4cc7d
This commit is contained in:
Ben Gras 2013-06-23 18:37:57 +02:00
parent 456359aa72
commit cdf2f55a90
3 changed files with 8 additions and 9 deletions

View file

@ -105,7 +105,6 @@ int overlaps(multiboot_module_t *mod, int n, int cmp_mod)
#define MB_MODS_BASE 0x82000000
#define MB_PARAM_MOD 0x88000000
#define MB_MODS_ALIGN 0x00800000 /* 8 MB */
#define MB_MODS_SIZE 0x00400000 /* 4 MB */
#define MB_MMAP_START 0x80000000
#define MB_MMAP_SIZE 0x10000000 /* 256 MB */
@ -123,7 +122,8 @@ void setup_mbi(multiboot_info_t *mbi)
int i;
for (i = 0; i < MB_MODS_NR; ++i) {
mb_modlist[i].mod_start = MB_MODS_BASE + i * MB_MODS_ALIGN;
mb_modlist[i].mod_end = mb_modlist[i].mod_start + MB_MODS_SIZE ;
mb_modlist[i].mod_end = mb_modlist[i].mod_start + MB_MODS_ALIGN
- ARM_PAGE_SIZE;
mb_modlist[i].cmdline = 0;
}

View file

@ -126,9 +126,6 @@ ENTRY(setcontext)
pop {r0, r3}
1: /* Restore the registers */
ldr r1, [r0, #REG1] /* Restore r1 */
ldr r2, [r0, #REG2] /* Restore r2 */
ldr r3, [r0, #REG3] /* Restore r3 */
ldr r4, [r0, #REG4] /* Restore r4 */
ldr r5, [r0, #REG5] /* Restore r5 */
ldr r6, [r0, #REG6] /* Restore r6 */
@ -140,10 +137,10 @@ ENTRY(setcontext)
ldr fp, [r0, #FPREG] /* Restore fp */
ldr sp, [r0, #SPREG] /* Restore sp */
ldr lr, [r0, #LRREG] /* Restore lr */
mov r4, r0
ldr r0, [r4, #REG0] /* Restore r0 */
mov r3, r0
ldr r0, [r3, #REG0] /* Restore r0 */
2:
ldr pc, [r4, #PCREG] /* Restore pc */
ldr pc, [r3, #PCREG] /* Restore pc */
/* void ctx_start()

View file

@ -125,11 +125,13 @@ void tll_init(tll_t *tllp)
int tll_islocked(tll_t *tllp)
{
assert(tllp >= (tll_t *) PAGE_SIZE);
return(tllp->t_current != TLL_NONE);
}
int tll_locked_by_me(tll_t *tllp)
{
assert(tllp >= (tll_t *) PAGE_SIZE);
assert(self != NULL);
return(tllp->t_owner == self && !(tllp->t_status & TLL_PEND));
}
@ -139,7 +141,7 @@ int tll_lock(tll_t *tllp, tll_access_t locktype)
/* Try to lock three-level-lock tll with type locktype */
assert(self != NULL);
assert(tllp != NULL);
assert(tllp >= (tll_t *) PAGE_SIZE);
assert(locktype != TLL_NONE);
self->w_next = NULL;