mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
Fixe to kernel build and syscalls.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5738 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -110,12 +110,14 @@ static void dispatch_syscall(void)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
" push {r4}\n" /* Save R4 */
|
||||
" push {r4, r5}\n" /* Save R4 and R5 */
|
||||
" mov r5, lr\n" /* Save lr in R5 */
|
||||
" ldr r4, =g_stublookup\n" /* R4=The base of the stub lookup table */
|
||||
" lsl r0, r0, #2\n" /* R0=Offset of the stub for this syscall */
|
||||
" ldr r4, [r4, r0]\n" /* R4=Address of the stub for this syscall */
|
||||
" blx r5\n" /* Call the stub (modifies R14) */
|
||||
" pop {r4}\n" /* Restore R4 */
|
||||
" blx r5\n" /* Call the stub (modifies lr) */
|
||||
" mov lr, r5\n" /* Restore lr */
|
||||
" pop {r4, r5}\n" /* Restore R4 and R5*/
|
||||
" mov r2, r0\n" /* R2=Saves return value in R0 */
|
||||
" mov r0, #3\n" /* R0=SYS_syscall_return */
|
||||
" svc 0" /* Return from the syscall */
|
||||
@@ -321,7 +323,8 @@ int up_svcall(int irq, FAR void *context)
|
||||
current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R14], current_regs[REG_R15]);
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
svcdbg("xPSR: %08x BASEPRI: %08x EXEC_RETURN: %08x\n",
|
||||
current_regs[REG_XPSR], current_regs[REG_BASEPRI], current_regs[REG_EXC_RETURN]);
|
||||
current_regs[REG_XPSR], current_regs[REG_BASEPRI],
|
||||
current_regs[REG_EXC_RETURN]);
|
||||
#else
|
||||
svcdbg("xPSR: %08x BASEPRI: %08x\n",
|
||||
current_regs[REG_XPSR], current_regs[REG_BASEPRI]);
|
||||
|
||||
@@ -112,9 +112,13 @@ static void dispatch_syscall(void)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
" push {r4}\n" /* Save R4 */
|
||||
" mov r4, lr\n" /* Save lr in R4 */
|
||||
" ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */
|
||||
" ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this syscall */
|
||||
" blx ip\n" /* Call the stub (modifies R14)*/
|
||||
" blx ip\n" /* Call the stub (modifies lr)*/
|
||||
" mov lr, r4\n" /* Restore lr */
|
||||
" pop {r4}\n" /* Restore r4 */
|
||||
" mov r2, r0\n" /* R2=Saved return value in R0 */
|
||||
" mov r0, #3\n" /* R0=SYS_syscall_return */
|
||||
" svc 0" /* Return from the syscall */
|
||||
@@ -152,7 +156,7 @@ int up_svcall(int irq, FAR void *context)
|
||||
regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
|
||||
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
|
||||
#ifdef REG_EXC_RETURN
|
||||
svcdbg(" PSR: %08x LR: %08x\n", regs[REG_XPSR], current_regs[REG_EXC_RETURN]);
|
||||
svcdbg(" PSR: %08x LR: %08x\n", regs[REG_XPSR], regs[REG_EXC_RETURN]);
|
||||
#else
|
||||
svcdbg(" PSR: %08x\n", regs[REG_XPSR]);
|
||||
#endif
|
||||
@@ -265,7 +269,7 @@ int up_svcall(int irq, FAR void *context)
|
||||
rtcb->xcp.sysreturn = 0;
|
||||
|
||||
/* The return value must be in R0-R1. dispatch_syscall() temporarily
|
||||
* moved the value for R0 to R2.
|
||||
* moved the value for R0 into R2.
|
||||
*/
|
||||
|
||||
current_regs[REG_R0] = current_regs[REG_R2];
|
||||
@@ -322,7 +326,12 @@ int up_svcall(int irq, FAR void *context)
|
||||
svcdbg(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
current_regs[REG_R8], current_regs[REG_R9], current_regs[REG_R10], current_regs[REG_R11],
|
||||
current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R14], current_regs[REG_R15]);
|
||||
svcdbg(" PSR=%08x\n", current_regs[REG_XPSR]);
|
||||
#ifdef REG_EXC_RETURN
|
||||
svcdbg(" PSR: %08x LR: %08x\n",
|
||||
current_regs[REG_XPSR], current_regs[REG_EXC_RETURN]);
|
||||
#else
|
||||
svcdbg(" PSR: %08x\n", current_regs[REG_XPSR]);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -300,10 +300,18 @@ void up_addregion(void)
|
||||
*/
|
||||
|
||||
#ifdef LPC17_AHB_HEAPBASE
|
||||
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||
|
||||
/* Yes... Add the AHB SRAM heap region. */
|
||||
/* Yes.. allow user-mode access to the AHB SRAM user heap memory */
|
||||
|
||||
lpc17_mpu_uheap((uintptr_t)LPC17_AHB_HEAPBASE, LPC17_AHB_HEAPSIZE);
|
||||
|
||||
#endif
|
||||
|
||||
/* Add the AHB SRAM user heap region. */
|
||||
|
||||
kumm_addregion((FAR void*)LPC17_AHB_HEAPBASE, LPC17_AHB_HEAPSIZE);
|
||||
|
||||
kmm_addregion((FAR void*)LPC17_AHB_HEAPBASE, LPC17_AHB_HEAPSIZE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1546,7 +1546,7 @@ static void lpc17_widebus(FAR struct sdio_dev_s *dev, bool wide)
|
||||
|
||||
static void lpc17_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
|
||||
{
|
||||
uint32_t clock;
|
||||
uint32_t clkcr;
|
||||
|
||||
switch (rate)
|
||||
{
|
||||
@@ -1554,39 +1554,39 @@ static void lpc17_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
|
||||
|
||||
default:
|
||||
case CLOCK_SDIO_DISABLED:
|
||||
clock = LPC17_CLCKCR_INIT;
|
||||
clkcr = LPC17_CLCKCR_INIT;
|
||||
return;
|
||||
|
||||
/* Enable in initial ID mode clocking (<400KHz) */
|
||||
|
||||
case CLOCK_IDMODE:
|
||||
clock = (LPC17_CLCKCR_INIT | SDCARD_CLOCK_CLKEN);
|
||||
clkcr = (LPC17_CLCKCR_INIT | SDCARD_CLOCK_CLKEN);
|
||||
break;
|
||||
|
||||
/* Enable in MMC normal operation clocking */
|
||||
|
||||
case CLOCK_MMC_TRANSFER:
|
||||
clock = (SDCARD_CLOCK_MMCXFR | SDCARD_CLOCK_CLKEN);
|
||||
clkcr = (SDCARD_CLOCK_MMCXFR | SDCARD_CLOCK_CLKEN);
|
||||
break;
|
||||
|
||||
/* SD normal operation clocking (wide 4-bit mode) */
|
||||
|
||||
case CLOCK_SD_TRANSFER_4BIT:
|
||||
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
|
||||
clock = (SDCARD_CLOCK_SDWIDEXFR | SDCARD_CLOCK_CLKEN);
|
||||
clkcr = (SDCARD_CLOCK_SDWIDEXFR | SDCARD_CLOCK_CLKEN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
/* SD normal operation clocking (narrow 1-bit mode) */
|
||||
|
||||
case CLOCK_SD_TRANSFER_1BIT:
|
||||
clock = (SDCARD_CLOCK_SDXFR | SDCARD_CLOCK_CLKEN);
|
||||
clkcr = (SDCARD_CLOCK_SDXFR | SDCARD_CLOCK_CLKEN);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set the new clock frequency along with the clock enable/disable bit */
|
||||
|
||||
lpc17_setclock(clock);
|
||||
lpc17_setclock(clkcr);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -124,4 +124,3 @@ void sdio_wrprotect(FAR struct sdio_dev_s *dev, bool wrprotect);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_SDCARD_H */
|
||||
|
||||
|
||||
@@ -198,22 +198,22 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
|
||||
#if CONFIG_MM_REGIONS > 1
|
||||
void up_addregion(void)
|
||||
{
|
||||
/* Add the region */
|
||||
|
||||
kmm_addregion((FAR void*)SAM3U_INTSRAM1_BASE, CONFIG_SAM3U_SRAM1_SIZE);
|
||||
|
||||
/* Allow user access to the heap memory */
|
||||
|
||||
sam3u_mpu_uheap(SAM3U_INTSRAM1_BASE, CONFIG_SAM3U_SRAM1_SIZE);
|
||||
|
||||
/* Add the region */
|
||||
|
||||
#if CONFIG_MM_REGIONS > 2
|
||||
kmm_addregion((FAR void*)SAM3U_NFCSRAM_BASE, CONFIG_SAM3U_NFCSRAM_SIZE);
|
||||
kumm_addregion((FAR void*)SAM3U_INTSRAM1_BASE, CONFIG_SAM3U_SRAM1_SIZE);
|
||||
|
||||
#if CONFIG_MM_REGIONS > 2
|
||||
/* Allow user access to the heap memory */
|
||||
|
||||
sam3u_mpu_uheap(SAM3U_NFCSRAM_BASE, CONFIG_SAM3U_NFCSRAM_SIZE);
|
||||
|
||||
/* Add the region */
|
||||
|
||||
kumm_addregion((FAR void*)SAM3U_NFCSRAM_BASE, CONFIG_SAM3U_NFCSRAM_SIZE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user